备份与恢复:用user模式基于日志序列的不完全恢复

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:942

备份与恢复:用user模式基于日志序列的不完全恢复

sql>shutdown immediate;
冷备数据库所有数据文件
SQL> startup
ORACLE instance started.
Total System Global Area 101785252 bytes
Fixed Size 454308 bytes
Variable Size 75497472 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> select * from test;
A
----------
1
2
3
4
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination D:\oracle\ora92\RDBMS
Oldest online log sequence 0
Next log sequence to archive 1
Current log sequence 1
SQL> alter system switch logfile;
System altered.
SQL> insert into test values(5);
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination D:\oracle\ora92\RDBMS
Oldest online log sequence 1
Next log sequence to archive 3
Current log sequence 3
SQL> insert into test values(6);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test;
A
----------
1
2
3
4
5
6
6 rows selected.
SQL> alter system switch logfile;
System altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination D:\oracle\ora92\RDBMS
Oldest online log sequence 2
Next log sequence to archive 4
Current log sequence 4
SQL> select * from test;
A
----------
1
2
3
4
5
6
6 rows selected.
SQL> insert into test values(7); --7这个值用到的日志序列为4
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination D:\oracle\ora92\RDBMS
Oldest online log sequence 3
Next log sequence to archive 5
Current log sequence 5
SQL> insert into test values(8); --8这个值用到的日志序列为5
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
恢复所有冷备的数据文件
SQL> startup mount;
ORACLE instance started.
Total System Global Area 101785252 bytes
Fixed Size 454308 bytes
Variable Size 75497472 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
Database mounted.
做不完全恢复到日志序列为4
SQL> recover database until cancel;
ORA-00279: change 270609 generated at 04/21/2008 10:22:02 needed for thread 1
ORA-00289: suggestion : D:\ORACLE\ORA92\RDBMS\ARC00001.001
ORA-00280: change 270609 for thread 1 is in sequence #1

Specify log: {=suggested | filename | AUTO | CANCEL}
D:\oracle\ora92\rdbms\ARC00001.001
ORA-00279: change 270822 generated at 04/21/2008 10:28:29 needed for thread 1
ORA-00289: suggestion : D:\ORACLE\ORA92\RDBMS\ARC00002.001
ORA-00280: change 270822 for thread 1 is in sequence #2
ORA-00278: log file 'D:\oracle\ora92\rdbms\ARC00001.001' no longer needed for
this recovery

Specify log: {=suggested | filename | AUTO | CANCEL}
D:\oracle\ora92\rdbms\ARC00002.001
ORA-00279: change 270856 generated at 04/21/2008 10:30:06 needed for thread 1
ORA-00289: suggestion : D:\ORACLE\ORA92\RDBMS\ARC00003.001
ORA-00280: change 270856 for thread 1 is in sequence #3
ORA-00278: log file 'D:\oracle\ora92\rdbms\ARC00002.001' no longer needed for
this recovery

Specify log: {=suggested | filename | AUTO | CANCEL}
D:\oracle\ora92\rdbms\ARC00003.001
ORA-00279: change 270869 generated at 04/21/2008 10:30:37 needed for thread 1
ORA-00289: suggestion : D:\ORACLE\ORA92\RDBMS\ARC00004.001
ORA-00280: change 270869 for thread 1 is in sequence #4
ORA-00278: log file 'D:\oracle\ora92\rdbms\ARC00003.001' no longer needed for
this recovery

Specify log: {=suggested | filename | AUTO | CANCEL}
D:\oracle\ora92\rdbms\ARC00004.001
ORA-00279: change 270918 generated at 04/21/2008 10:33:01 needed for thread 1
ORA-00289: suggestion : D:\ORACLE\ORA92\RDBMS\ARC00005.001
ORA-00280: change 270918 for thread 1 is in sequence #5
ORA-00278: log file 'D:\oracle\ora92\rdbms\ARC00004.001' no longer needed for
this recovery

Specify log: {=suggested | filename | AUTO | CANCEL}
cancel --ARC00005.001 这个撤消不恢复了
Media recovery cancelled.
SQL> alter database open resetlogs;
Database altered.
SQL> select * from test;
A
----------
1
2
3
4
5
6
7
7 rows selected.
SQL>
看结果只恢复到日志序列4对应的test表数据为7

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】