1.create table t_emp and get scn of database.
SQL> show user;
USER 为 "SCOTT"
SQL> create table t_emp as select * from emp;
表已创建。
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
1160405
SQL> conn / as sysdba
已连接。
SQL> shutdown immediate;
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
2.use old datafile to replace lastest datafile
omit
3.startup database to mount status
SQL> conn / as sysdba
已连接。
SQL> shutdown immediate;
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> exit
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
C:\>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期五 9月 2 14:23:06 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
已连接到空闲例程。
SQL> startup mount;
ORACLE 例程已经启动。
Total System Global Area 612368384 bytes
Fixed Size 1250428 bytes
Variable Size 226495364 bytes
Database Buffers 377487360 bytes
Redo Buffers 7135232 bytes
4.check controlfile/datafile/v$recover_file scn
a)check controlfile checkpoint scn
SQL> select CHECKPOINT_CHANGE# from v$datafile;
CHECKPOINT_CHANGE#
------------------
1160885
1160885
1160885
1160885
1160885
b)check datafile checkpoint scn
SQL> select CHECKPOINT_CHANGE# from v$datafile_header;
CHECKPOINT_CHANGE#
------------------
1130943
1130943
1130943
1130943
1130943
c)check the v$recovery_file
SQL> select file#, change# from v$recover_file;
FILE# CHANGE#
---------- ----------
1 1130943
2 1130943
3 1130943
4 1130943
5 1130943
we can found that the datafile checkpoint scn is old. then roll forward the datafile scn.
5.recover database and check scn
SQL> recover database;
完成介质恢复。
SQL>
now we check controlfile/datafile/v$recover_file scn again.
SQL> select CHECKPOINT_CHANGE# from v$datafile;
CHECKPOINT_CHANGE#
------------------
1160885
1160885
1160885
1160885
1160885
SQL> select CHECKPOINT_CHANGE# from v$datafile_header;
CHECKPOINT_CHANGE#
------------------
1160884
1160884
1160884
1160884
1160884
SQL> select file#, change# from v$recover_file;
未选定行
6.open database directly.
SQL> alter database open;
7.check the result of recovery
SQL> desc scott.emp;
名称 是否为空? 类型
----------------------------------------- -------- ----------------------------
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26019288/viewspace-706487/
,如需转载,请注明出处,否则将追究法律责任。