|
测试一:
冷备份前test用户有表AA ,冷备份后删除表AA
做恢复时,仅恢复了所有的数据文件,未覆盖当前的控制文件和在线日志文件
恢复命令:recover database until cancel
恢复中指定了当前的在线日志,apply完成后用open resetlogs打开数据库
打开后表AA不存在,结果正确
这个恢复和用热备数据文件的恢复操作基本类似
[php]
SQL> alter system switch logfile;
System altered.
SQL> connect test/test
Connected.
SQL> drop table aa;
Table dropped.
SQL> create table aa (id number);
Table created.
SQL> insert into aa values(1);
1 row created.
SQL> commit;
Commit complete.
SQL> connect / as sysdba
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
$ ls
bak sdb
$ cd sdb
$ ls
control01.ctl control03.ctl example01.dbf redo01.log redo03.log temp01.dbf undotbs01.dbf xdb01.dbf
control02.ctl drsys01.dbf indx01.dbf redo02.log system01.dbf tools01.dbf user01.dbf
[/php]
下面冷备所有数据文件、控制文件、在线日志文件[/COLOR]
[php]
$ cp * ../bak/
[/php]
重新启库,删除表AA[/COLOR]
[php]
$ sqlplus '/ as sysdba'
SQL*Plus: Release 9.2.0.4.0 - Production on Tue May 11 12:56:19 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 739740648 bytes
Fixed Size 732136 bytes
Variable Size 301989888 bytes
Database Buffers 436207616 bytes
Redo Buffers 811008 bytes
Database mounted.
Database opened.
SQL> connect test/test
Connected.
SQL> drop table aa;
Table dropped.
SQL> connect / as sysdba
Connected.
SQL> shutdown abort;
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
[/php]
仅恢复所有的数据文件[/COLOR]
[php]
$ cd bak
$ ls
1_23.dbf control02.ctl drsys01.dbf indx01.dbf redo02.log system01.dbf tools01.dbf user01.dbf
control01.ctl control03.ctl example01.dbf redo01.log redo03.log temp01.dbf undotbs01.dbf xdb01.dbf
$ cp *.dbf ../sdb/
$ cd ../sdb
$ ls
1_23.dbf control02.ctl drsys01.dbf indx01.dbf redo02.log system01.dbf tools01.dbf user01.dbf
control01.ctl control03.ctl example01.dbf redo01.log redo03.log temp01.dbf undotbs01.dbf xdb01.dbf
[/php]
recover database[/COLOR]
[php]
$ sqlplus '/ as sysdba'
SQL*Plus: Release 9.2.0.4.0 - Production on Tue May 11 12:59:14 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 739740648 bytes
Fixed Size 732136 bytes
Variable Size 301989888 bytes
Database Buffers 436207616 bytes
Redo Buffers 811008 bytes
Database mounted.
SQL> recover database until cancel;
ORA-00279: change 19677591 generated at 05/11/2004 12:54:13 needed for thread 1
ORA-00289: suggestion : /oracle/oradata/bak/1_24.dbf
ORA-00280: change 19677591 for thread 1 is in sequence #24
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log '/oracle/oradata/bak/1_24.dbf'
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
ORA-00308: cannot open archived log '/oracle/oradata/bak/1_24.dbf'
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
SQL> recover database until cancel;
ORA-00279: change 19677591 generated at 05/11/2004 12:54:13 needed for thread 1
ORA-00289: suggestion : /oracle/oradata/bak/1_24.dbf
ORA-00280: change 19677591 for thread 1 is in sequence #24
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/oracle/oradata/sdb/redo01.log
ORA-00310: archived log contains sequence 22; sequence 24 required
ORA-00334: archived log: '/oracle/oradata/sdb/redo01.log'
SQL> recover database until cancel;
ORA-00279: change 19677591 generated at 05/11/2004 12:54:13 needed for thread 1
ORA-00289: suggestion : /oracle/oradata/bak/1_24.dbf
ORA-00280: change 19677591 for thread 1 is in sequence #24
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/oracle/oradata/sdb/redo02.log
ORA-00310: archived log contains sequence 23; sequence 24 required
ORA-00334: archived log: '/oracle/oradata/sdb/redo02.log'
SQL> recover database until cancel;
ORA-00279: change 19677591 generated at 05/11/2004 12:54:13 needed for thread 1
ORA-00289: suggestion : /oracle/oradata/bak/1_24.dbf
ORA-00280: change 19677591 for thread 1 is in sequence #24
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/oracle/oradata/sdb/redo03.log
Log applied.
Media recovery complete.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
SQL> connect test/test
Connected.
SQL> select * from aa;
select * from aa
*
ERROR at line 1:
ORA-00942: table or view does not exist
[/php] |
|