码迷,mamicode.com
首页 > 数据库 > 详细

oracle恢复案例:rename一个数据文件后做不完全恢复

时间:2014-06-01 15:01:23      阅读:321      评论:0      收藏:0      [点我收藏+]

标签: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> 

oracle恢复案例:rename一个数据文件后做不完全恢复,布布扣,bubuko.com

oracle恢复案例:rename一个数据文件后做不完全恢复

标签:oracle   备份   恢复   

原文地址:http://blog.csdn.net/huangyanlong/article/details/27952679

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!