关于一个冷备恢复的案例, 1)
冷备 2)
建一张表T1 3)
切两次日志,三组REDO日志状态为两个ACTIVE一个CURRENT 4)
Shutdown abort 5)
删除所有dbf文件 6)
恢复 7)
验证表T1是否存在
1.数据库冷备 SQL> shutdownimmediate ORACLE instanceshut down.
SQL>host cp/u01/data/prod /u01/data/prod2
2.打开数据库新建一张表T1并切换日志为两个active一个current
SQL> startup ORACLE instance started.
Total System Global Area
285212672 bytes Fixed Size
1218968 bytes Variable Size
79693416 bytes Database Buffers
197132288 bytes Redo Buffers
7168000 bytes Database mounted. Database opened. SQL> select group#,status from v$log;
GROUP# STATUS
---------- --------------------------------
1 INACTIVE
2 CURRENT
3 INACTIVE
SQL> create table t1 as select * from DBA_objects;
Table created.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- --------------------------------
1 INACTIVE
2 CURRENT
3 INACTIVE
SQL> alter system switch logfile;
System altered.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- --------------------------------
1 INACTIVE
2 ACTIVE
3 CURRENT
SQL> alter system switch logfile;
System altered.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- --------------------------------
1 CURRENT
2 ACTIVE
3 ACTIVE
SQL> shutdown abort ORACLE instance shut down.
3.删除数据库所有dbf文件,模拟数据文件丢失故障 SQL>host rm –rf /u01/data/prod/*.dbf
4.数据恢复 SQL>host cp –rf /u01/data/prod2/*.dbf/u01/data/prod/ SQL> startup ORACLE instance started.
Total System Global Area
285212672 bytes Fixed Size
1218968 bytes Variable Size
79693416 bytes Database Buffers
197132288 bytes Redo Buffers
7168000 bytes Database mounted. ORA-01113: file 1 needs media recovery ORA-01110: data file 1:'/u01/data/prod/system01.dbf'
SQL> recover database; Media recovery complete. SQL> alter database open;
Database altered.
SQL> select count(*) from t1;
COUNT(*)
----------
50315
数据库得到完全恢复 |