Thursday, April 03, 2008

recover by SCN

16:21:06 SQL> startup mount
ORACLE instance started.

Total System Global Area 1073741824 bytes
Fixed Size 2062264 bytes
Variable Size 264243272 bytes
Database Buffers 801112064 bytes
Redo Buffers 6324224 bytes
Database mounted.
16:23:35 SQL> recover database until change 900335279 using backup controlfile;
ORA-00279: change 900335086 generated at 04/03/2008 15:48:24 needed for thread
1
ORA-00289: suggestion :
/ra012/oradata/VCDRT2/oraarch/VCDRT2_0001_651080862_1.arc
ORA-00280: change 900335086 for thread 1 is in sequence #1


16:24:04 Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00279: change 900335233 generated at 04/03/2008 16:18:01 needed for thread
1
ORA-00289: suggestion :
/ra012/oradata/VCDRT2/oraarch/VCDRT2_0001_651080862_2.arc
ORA-00280: change 900335233 for thread 1 is in sequence #2
ORA-00278: log file '/ra012/oradata/VCDRT2/oraarch/VCDRT2_0001_651080862_1.arc'
no longer needed for this recovery


16:24:07 Specify log: {=suggested | filename | AUTO | CANCEL}

Log applied.
Media recovery complete.
16:24:12 SQL> alter database open resetlogs;

Database altered.

16:24:29 SQL> select * from orara.test1;

F1
----------
102
103
101

16:24:37 SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.


--DO the same experiment, but will try another command "alter database recover database ..."
--it shows that they are different at mount state.

radev01:*:VCDRT2:/ra012/oradata/VCDRT2> ls -lrt oraarch
total 976
-rw-r----- 1 orara dba 434176 Apr 3 16:18 VCDRT2_0001_651080862_1.arc
-rw-r----- 1 orara dba 55296 Apr 3 16:20 VCDRT2_0001_651080862_2.arc
-rw-r----- 1 orara dba 2048 Apr 3 16:20 VCDRT2_0001_651080862_3.arc



--to show commands "alter database recover database" is different with "recover database"

16:26:16 SQL> startup mount
ORACLE instance started.

Total System Global Area 1073741824 bytes
Fixed Size 2062264 bytes
Variable Size 264243272 bytes
Database Buffers 801112064 bytes
Redo Buffers 6324224 bytes
Database mounted.
16:28:37 SQL> alter database recover database until change 900335279 using backup controlfile;
alter database recover database until change 900335279 using backup controlfile
*
ERROR at line 1:
ORA-00279: change 900335086 generated at 04/03/2008 15:48:24 needed for thread
1
ORA-00289: suggestion :
/ra012/oradata/VCDRT2/oraarch/VCDRT2_0001_651080862_1.arc
ORA-00280: change 900335086 for thread 1 is in sequence #1


16:28:57 SQL>


--I also learned that the SCN should be specified in decimal.

in 9i, it is hexadecimal in alert.log
so, need to use scientific calculator to covert it, eg. (7924614612541=0x0735.17d6c63d)

otherwise, error prompted .

--wrong
17:57:30 SQL> recover database until change 0x073517d6c63d using backup controlfile;
ORA-00905: missing keyword


--correct

17:57:58 SQL> recover database until change 7924614612541 using backup controlfile;
ORA-00279: change 7924607131028 generated at 02/02/2008 21:30:17 needed for
thread 1
ORA-00289: suggestion : /ict22/oraarch/ICTP/ICT_ARC_1_42077.arc
ORA-00280: change 7924607131028 for thread 1 is in sequence #42077