Oracle 10g数据库闪回之后怎么样noresetlogs打开数据库(一)
很多时候数据库resetlogs打开之后会引起诸多不便,比如在Oracle 10g下,闪回数据库之后必须要resetlogs打开,那怎么样才能避免数据库resetlogs打开呢?
以下步骤仅用于测试,在生产环境下慎用。
(1)将数据库启动在mount状态,打开强制模式的闪回点dd,记录控制文件的checkpoint和checkpoint count
SQL> startup mount
ORACLE instance started.
Total System Global Area 1069547520 bytes
Fixed Size 2101704 bytes
Variable Size 276827704 bytes
Database Buffers 784334848 bytes
Redo Buffers 6283264 bytes
Database mounted.
SQL> create restore point dd guarantee flashback database;
Restore point created.
SQL> select to_char(checkpoint_change#) from v$datafile;
TO_CHAR(CHECKPOINT_CHANGE#)
----------------------------------------
10999733115905
10999733115905
10999733115905
10999733115905
SQL> select file#,to_char(checkpoint_change#),CHECKPOINT_COUNT from v$datafile_header;
FILE# TO_CHAR(CHECKPOINT_CHANGE#) CHECKPOINT_COUNT
---------- ---------------------------------------- ----------------
1 10999733115905 70
2 10999733115905 70
3 10999733115905 70
4 10999733115905 69
(2)在mount状态下备份控制文件和日志文件
[ora10g@xe2 lank]$ cp redo01.log redo01.log.bak
[ora10g@xe2 lank]$ cp redo02.log redo02.log.bak
[ora10g@xe2 lank]$ cp redo03.log redo03.log.bak
[ora10g@xe2 lank]$ cp control01.ctl control01.ctl.bak
(3)打开数据库之后切换几个归档
SQL> alter database open;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
(4)将数据库闪回至闪回点dd,可以发现数据文件的checkpoint和控制文件checkpoint均已闪回至闪回点状态,但是checkpoint count没有,这需要用bbed手动修改
SQL> flashback database to restore point dd;
Flashback complete.
SQL> select to_char(checkpoint_change#) from v$datafile_header;
TO_CHAR(CHECKPOINT_CHANGE#)
----------------------------------------
10999733115905
10999733115905
10999733115905
10999733115905
SQL> select file#,to_char(checkpoint_change#),CHECKPOINT_COUNT from v$datafile_header;
FILE# TO_CH