`
qcyycom
  • 浏览: 182551 次
社区版块
存档分类
最新评论

Controlfile Recovery WITHOUT Resetlogs

 
阅读更多

Well last week I had a few posts about controlfile recovery; one about recovering without a backup and one about recovering with a backup using RESETLOGS. In the second post I showed how when you restore a backup controlfile Oracle will always require you to recover then open the database with RESETLOGS.

Hemant Chitale pointed out that you do not always need to do a RESETLOGS when you open the database. If you recreate the controlfile rather than restoring a backup then Oracle allows you to open the database normally (assuming of course a normal database shutdown). Naturally you will lose any information in your controlfile (RMAN configuration and records, the incarnation table, etc) so I would personally prefer keeping the old file. But it’s certainly possible – so here’s a demo of Hemant’s suggestion on Oracle 10 release 2. Really it’s abit of a rehash; Hemant actually posted all of this himself on oracle-l last week. (And more – he also posted a scenario of losing both the controlfile and online logs.) He also mentioned it in his blog. So for more detail you can also check out email.

The setup is exactly the same as recovery with a backup controlfile – I’m just going to do some different steps starting at the “Recovery” part:

Recovery

We’ll pick up from the other post with the attempt to open the database that fails. Remember that I have already restored a backup controlfile and mounted it.

SQL> alter database open noresetlogs;
alter database open noresetlogs
*
ERROR at line 1:
ORA-01588: must use RESETLOGS option for database open

Now if you already have a backup of your controlfile then you’re all set. But of course if you don’t you can even make one using your controlfile backup. That’s what I did here:

SQL> alter database backup controlfile to trace
  2  as '/u04/oracle/oradata/jt10g/newctl.sql';

Database altered.

Now one thing that we’re definitely going to lose is the incarnation table. Let’s have a quick look at the contents right now.

SQL> select * from v$database_incarnation;

INCARNATION# RESETLOGS_CHANGE# RESETLOGS PRIOR_RESETLOGS_CHANGE# PRIOR_RES
------------ ----------------- --------- ----------------------- ---------
STATUS  RESETLOGS_ID PRIOR_INCARNATION# FLASHBACK_DATABASE_ALLOWED
------- ------------ ------------------ --------------------------
           1                 1 12-JUL-05                       0
PARENT     563434975                  0 NO

           2            524107 03-MAY-07                       1 12-JUL-05
PARENT     621607779                  1 NO

           3            565455 03-MAY-07                  524107 03-MAY-07
PARENT     621627183                  2 NO

           4            784376 09-MAY-07                  565455 03-MAY-07
CURRENT    622130726                  3 NO

Recreating the Control File

It’s worth quickly pointing out that you can of course do this as long as you can generate the proper CREATE CONTROLFILE statement. If you know your datafile and logfile layout then you can generate this statement even with no backup of anything. Of course the best way to get it is with “backup to trace”.

First you need to have the instance started but no controlfile mounted. When you recreate the controlfile it will read the CONTROL_FILES initialization parameter and overwrite any existing files.

SQL> shutdown immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.

SQL> startup nomount
ORACLE instance started.

Total System Global Area  629145600 bytes
Fixed Size                  1980712 bytes
Variable Size             180356824 bytes
Database Buffers          440401920 bytes
Redo Buffers                6406144 bytes

SQL> CREATE CONTROLFILE REUSE DATABASE "JT10G" NORESETLOGS  NOARCHIVELOG
  2      MAXLOGFILES 16
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 100
  5      MAXINSTANCES 8
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 '/u04/oracle/oradata/jt10g/redo01.log'  SIZE 50M,
  9    GROUP 2 '/u04/oracle/oradata/jt10g/redo02.log'  SIZE 50M,
 10    GROUP 3 '/u04/oracle/oradata/jt10g/redo03.log'  SIZE 50M
 11  DATAFILE
 12    '/u04/oracle/oradata/jt10g/system01.dbf',
 13    '/u04/oracle/oradata/jt10g/undotbs01.dbf',
 14    '/u04/oracle/oradata/jt10g/sysaux01.dbf',
 15    '/u04/oracle/oradata/jt10g/users01.dbf',
 16    '/u04/oracle/oradata/jt10g/example01.dbf'
 17  CHARACTER SET WE8ISO8859P1
 18  ;

Control file created.

SQL> ALTER DATABASE OPEN;

Database altered.

I got that statement out of a trace file. Also you need to remember to recreate your tempfiles; the appropriate statements will also be in your trace file.

SQL> ALTER TABLESPACE TEMP
  2  ADD TEMPFILE '/u04/oracle/oradata/jt10g/temp01.dbf' REUSE;

Tablespace altered.

Now as I mentioned before you will lose all information in your controlfile. Let’s quickly verify this by examining the incarnation table.

SQL> select * from v$database_incarnation;

INCARNATION# RESETLOGS_CHANGE# RESETLOGS PRIOR_RESETLOGS_CHANGE# PRIOR_RES
------------ ----------------- --------- ----------------------- ---------
STATUS  RESETLOGS_ID PRIOR_INCARNATION# FLASHBACK_DATABASE_ALLOWED
------- ------------ ------------------ --------------------------
           1            784376 09-MAY-07                  565455 03-MAY-07
CURRENT    622130726                  0 NO

And there you have it. Controlfile recovery without a RESETLOGS. As I mentioned before I prefer the RESETLOGS case and keeping the original controlfile if at all possible. Perhaps the main reason is that incarnations exist for a reason; they help you keep track of changes to you database. It’s good to have that electronic record. But this is also a very important recovery method to be aware of!


FROM: http://www.ardentperf.com/2007/05/15/controlfile-recovery-without-resetlogs/

分享到:
评论

相关推荐

    RMAN测试演练即讲解

    (6) alter database open resetlogs 6、 模拟redolog file恢复(其实下面操作在sqlplus里面,不在rman执行) (1) shutdown immediate; (2) startup mount; (3) recover database until cancel; (4) alter ...

    file control

    share the file,hope can help the people who need it.

    Oracle9i灾难恢复详细步骤 pdf

    2. 有 datafile、archivelog、controlfile、spfile 的有效备份和全备后的Archivelog,不完全恢复整个数据库。 3. Controlfile 中包括所有的backupset 信息(RMAN 信息),参考下文的备份脚本。 4. 在 controlfile 的...

    oracle归档日志步骤+RMAN步骤

    alter system set db_recovery_file_size=20G; SQL> shutown immediate SQL> conn / as sysdba SQL> startup mount SQL> alter database archivelog; 启动归档 SQL> alter database open; SQL> archive...

    Oracle归档日志删除

    Ora我们都都知道在controlfile中记录着每一个archivelog的相关信息,当然们在OS下把这些物理文件delete掉后,在我们的 controlfile中仍然记录着这些archivelog的信息,在oracle的OEM管理器中有可视化的日志展现出,...

    Oracle 11g For Dummies.pdf

    How to assess potential threats to your database, configure Oracle Recovery Manager, and set up backup and recovery procedures When to use online, offline, controlfile, and archivelog backups ...

    blackflagking#Notes-Databases#Oracle备份恢复之recover database的四条语句区别

    与recover database using backup controlfile until cancel效果一样Oracle会以当前controlfile

    第十一章实验作业.docx

    Alter database backup controlfile to ‘c:\control.bkp’; (2)以脚本文件形式备份控制文件 Alter database backup controlfile to trace; (3)查看脚本文件的存放位置 Show parameter user_dump_dest; (4)...

    oracle rac日常基本维护命令

    +FLASH_RECOVERY_AREA/orcl/controlfile/current.258.570913191 +FLASH_RECOVERY_AREA/orcl/onlinelog/group_1.257.570913201 +FLASH_RECOVERY_AREA/orcl/onlinelog/group_2.256.570913211 +FLASH_RECOVERY_AREA/...

    Oracle数据库.pdf

    使用数据字典v$controlfile,查看当前数据库的控制文件的名称与路 径,具体如下: SQL> COLUMN name FORMAT A50; SQL> SELECT name FROM v$controlfile; 通过SHOW PARAMETER语句可以查看块的默认大小信息 SQL> SHOW...

    cadence v16.0 安装方法

    这两天一直在试着安装 cadence v16.0 。可是按现在网上说 试过了,怎么还是装不好啊?最后找到了一个新的 crack 。

    12_ORCLE数据库管理_示例脚本

    select * from v$controlfile --列出所有参数的位置及状态信息 select * from v$parameter --列出控制文件中记录的部分信息 select * from v$controlfile_record_section -----------------------------------...

    Oracle归档日志写满(ora-00257)了怎么办

    SQL> select * from V$FLASH_RECOVERY_AREA_USAGE; –查看归档内容使用情况 FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES ———— —————— ————————- ————— ...

    RMAN恢复实践

    RMAN恢复实践:详细脚本,包括controlfile,全库等等

    RAC+RMAN单实例的恢复

    1)拷贝源数据库的备份(分清是全备或是增量备份)到目标库。... 4)恢复备份中的controlfile到目标库,并使库至mount状态。 5)恢复数据,更改数据文件,临时文件,日志文件的路径。 6)恢复数据库。

    oracle 安装教程

    方便好用,解决安装问题,十分好用。SELECT status,name FROM v$controlfile;

    oracle实验报告

    controlfile reuse maxinstances 1 maxdatafiles 100 maxlogfiles 5 maxlogmembers 5 maxloghistory 2 logfile 'E:\app\oracle\oradata\mydb\log01.log' size 10m, 'E:\app\oracle\oradata\mydb\log02.log...

    系统及数据库备份.doc

    /opt/ignite/bin/make_tape_recovery -I -x inc_entire=vg00 -a /dev/rmt/0mn 2 数据库归档日志和控制文件备份 1. 数据库安装在HZ1MDBP,HZ1MDBS主机上,使用的是直接热备份的方式。 利用HP-UX的CRONTAB定时运行...

    在Oracle关闭情况下如何修改spfile的参数

    发现问题 我使用的Oracle11g,当我敲下如下一段命令后,就让我傻眼了。。 alter system set sga_max_size=960M scope=spfile; shutdown immediate startup 此时的startup报错了,错误为: ...ORA-00844: Parameter ...

    第三方API开发说明电子账户版.rar_新中新一卡通_第三方API开发说明电子账户版

    (3)当程序调用模糊查询操作时,如果查询成功,查询成功的文件放在RecvTemp目录下,如果是下载控制文件,下载成功的文件放到ControlFile目录下,控制文件的名称是:Control.bin;如果下载相片文件,下载成功的文件放...

Global site tag (gtag.js) - Google Analytics