SQL> conn internal
SQL> shutdown immediate;
用热备的控制文件恢复(把热备的控制文件拷贝回来)
mount数据库
SQL> startup mount
ORACLE instance started.
完全恢复和until cancel using backup controlfile都失败
SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done
SQL> recover database until cancel using backup controlfile;
ORA-00279: change 424123 generated at 10/20/2002 20:44:12 needed for thread 1
Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00266: name of archived log file needed
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: 'D:\BACKUPDB\SYSTEM01.DBF'
重建控制文件
SQL> alter database backup controlfile to trace;
Database altered.
找到那个控制文件,然后编辑
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "BACKUP" NORESETLOGS ARCHIVELOG
MAXLOGFILES 32
MAXLOGMEMBERS 2
MAXDATAFILES 254
MAXINSTANCES 1
MAXLOGHISTORY 453
LOGFILE
GROUP 1 'D:\BACKUPDB\REDO01.LOG' SIZE 1M,
GROUP 2 'D:\BACKUPDB\REDO02.LOG' SIZE 1M,
GROUP 3 'D:\BACKUPDB\REDO03.LOG' SIZE 1M
DATAFILE
'D:\BACKUPDB\SYSTEM01.DBF',
'D:\BACKUPDB\RBS01.DBF',
'D:\BACKUPDB\USERS01.DBF',
'D:\BACKUPDB\TEMP01.DBF',
'D:\BACKUPDB\TOOLS01.DBF',
'D:\BACKUPDB\INDX01.DBF'
CHARACTER SET ZHS16GBK
;
RECOVER DATABASE
ALTER SYSTEM ARCHIVE LOG ALL;
ALTER DATABASE OPEN;
重建控制文件,并且恢复数据库(完全恢复成功!)
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
SQL>@D:\BACKUPDB\udump\ORA02120.sql
ORA-01081: cannot start already-running ORACLE - shut it down first
Cluster altered.
ORA-00283: recovery session canceled due to errors
ORA-00264: no recovery required
System altered.
Database altered.
验证恢复结果:完全恢复
SQL> conn lunar/lunar
SQL> select * from test1;
完全恢复成功!
说明:
当shutdown immediate的以后,如果丢失全部控制文件(不包括数据文件和redo),需要用热备的控制文件恢复数据库的时候,要想完全恢复(一直恢复到redo中commit的数据),必须执行以下步骤:
1. mount数据库,
2. backup controlfile to trace
3. 修改这个生成的控制文件
4. nomount
5. 重建控制文件
阅读(794) | 评论(0) | 转发(0) |