|
|
test1:数据库正常关闭,非current的日志丢失
SQL> select group#,sequence#,status from v$log;
GROUP# SEQUENCE# STATUS
---------- ---------- ----------------
1 46 INACTIVE
2 47 CURRENT
SQL> select * from v$logfile;
1 STALE ONLINE /oradata/example/redo01.log
2 ONLINE /oradata/example/redo02.log
current的日志是redo02.log
sql>shutdown immediate;
sql>host
mv redo01.log barch/.
把当前inactive日志移走,模拟丢失
sql>startup
ORACLE instance started.
Total System Global Area 110171476 bytes
Fixed Size 451924 bytes
Variable Size 58720256 bytes
Database Buffers 50331648 bytes
Redo Buffers 667648 bytes
Database mounted.
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/oradata/example/redo01.log'
提示日志文件丢失
SQL> alter database clear logfile '/oradata/example/redo01.log';
Database altered.
SQL> alter database open;
Database altered.
SQL>host
ls 会发现redo01.log文件被重建
test2:正常关闭,current日志丢失,需要模拟不完全恢复,但数据不会丢失
SQL> shutdown immediate
sql>host
rm *.log
SQL> startup
ORACLE instance started.
Total System Global Area 110171476 bytes
Fixed Size 451924 bytes
Variable Size 58720256 bytes
Database Buffers 50331648 bytes
Redo Buffers 667648 bytes
Database mounted.
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/oradata/example/redo01.log'
模拟不完全恢复
SQL> recover database until cancel;
Media recovery complete.
SQL> alter database open resetlogs;
Database altered.
这是需要立即对数据库进行全备
test3:数据库非正常关闭,并且current日志丢失,只能先恢复原来的备份,在进行不完全恢复拉
会有数据丢失,不可避免 |
|