oracle恢复案例:rename一个数据文件后做不完全恢复
SQL>startup mount; //启动到mount状态
SQL> show parameter control_files //查看控制文件的位置信息
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string +DATA/metro/controlfile/backup
.268.848861257
SQL> select name from v$datafile;
//查看数据文件的信息
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/metro/system01.dbf
/u01/app/oracle/oradata/metro/undotbs01.dbf
/u01/app/oracle/oradata/metro/sysaux01.dbf
/u01/app/oracle/oradata/metro/users01.dbf
/u01/app/oracle/oradata/metro/example01.dbf
SQL> alter database rename file ‘/u01/app/oracle/oradata/metro/system01.dbf‘ to ‘+DATA/METRO/DATAFILE/SYSTEM.257.848858337‘;
//更改数据文件的信息
SQL> select status from v$instance;
//查看数据库当前状态
STATUS
------------
MOUNTED
SQL> alter database open; //尝试启库,报出需要resetlogs提示
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;//以resetlogs形式启库,提示数据文件1不
alter database open resetlogs
*
ERROR at line 1:
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: ‘+DATA/metro/datafile/system.257.848858337‘
SQL> select checkpoint_change# from v$datafile; //检查控制文件中各数据文件SCN
CHECKPOINT_CHANGE#
------------------
862849
862849
862849
862849
862849
SQL> select checkpoint_change# from v$datafile_header; //检查实际文件的SCN号
CHECKPOINT_CHANGE#
------------------
861998
863385
863385
863385
863385
SQL> recover datafile 1;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done
SQL> recover datafile 1 using backup controlfile;
ORA-00274: illegal recovery option USING
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 using backup controlfile; //使用备份的控制文件恢复数据库
ORA-00279: change 861998 generated at 05/29/2014 15:02:17 needed for thread 1
ORA-00289: suggestion : /u01/app/oracle/arch1/1_15_848741495.dbf
ORA-00280: change 861998 for thread 1 is in sequence #15 //提示恢复需要sequence号为15的日志
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00308: cannot open archived log ‘/u01/app/oracle/arch1/1_15_848741495.dbf‘
ORA-27037: unable to obtain file status
IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 3
SQL> select * from v$log; //查看日志组信息
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
1 1 14 52428800 2 YES INACTIVE
859720 29-MAY-14
3 1 13 52428800 2 YES INACTIVE
858472 29-MAY-14
2 1 15 52428800 2 NO CURRENT
859846 29-MAY-14
SQL> select group#,member from v$logfile;
GROUP#
----------
MEMBER
--------------------------------------------------------------------------------
3
/u01/app/oracle/oradata/metro/redo03.log
2
/u01/app/oracle/oradata/metro/redo02.log
1
/u01/app/oracle/oradata/metro/redo01.log
GROUP#
----------
MEMBER
--------------------------------------------------------------------------------
1
/disk1/metro/redofile/redo01a.log
2
/disk1/metro/redofile/redo02a.log
3
/disk1/metro/redofile/redo03a.log
6 rows selected.
SQL> recover database using backup controlfile;
ORA-00279: change 861998 generated at 05/29/2014 15:02:17 needed for thread 1
ORA-00289: suggestion : /u01/app/oracle/arch1/1_15_848741495.dbf
ORA-00280: change 861998 for thread 1 is in sequence #15
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/disk1/metro/redofile/redo02a.log //输入查找到sequence号为15对应的日志
Log applied.
Media recovery complete.
SQL> select checkpoint_change# from v$datafile_header; //恢复完成后检查点的SCN
CHECKPOINT_CHANGE#
------------------
863385
863385
863385
863385
863385
SQL> alter database open
2 ;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs; //使用resetlogs打开库
Database altered.
SQL> select name from v$datafile //查看数据文件信息
2 ;
NAME
--------------------------------------------------------------------------------
+DATA/metro/datafile/system.257.848858337
/u01/app/oracle/oradata/metro/undotbs01.dbf
/u01/app/oracle/oradata/metro/sysaux01.dbf
/u01/app/oracle/oradata/metro/users01.dbf
/u01/app/oracle/oradata/metro/example01.dbf
SQL>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。