ORACLE 恢复目录数据库

1.crosscheck command: # crosscheck 检测备份文件的有效性

  1. crosscheck backup;A(available) X(expired)  
  2. crosscheck backupset;  
  3. crosscheck backup of tablespace users;  
  4. crosscheck backup of datafile 1;  
  5. crosscheck backup of controlfile;  
  6. crosscheck backup of tag=”;  
  7. crosscheck archivelog all;  
  8. crosscheck backup of spfile;  
  9.   
  10. demo 1:  
  11. sys>alter system switch logfile;  
  12. $rm archivelog  
  13. rman>crosscheck archivelog all;  
  14. rman>delete expired archivelog all; # 删除所有过期的归档日志  
  15.      or delete copycopy of archivelog sequence xx;  

2.修改备份文件的有效性(change command) # change 修改备份文件的有效性

  1. change backupset xx available;  
  2. change backupset 29 unavailable;  
  3. change backup of database available;  
  4.   
  5. demo 1:  
  6. rman>backup as copycopy datafile 4 format=’/u02/app/oracle/df_%s_%t.dbf’;  
  7. rman>list copycopy;  
  8. rman>change datafilecopy ‘/u02/app/oracle/DF_22_663294060.DBF’ unavailable;  
  9. rman>list copycopy;  
  10. rman>change datafilecopy ‘/u02/app/oracle/DF_22_663294060.DBF’ available;  
  11. rman>list copycopy;  

3.catalog 注册信息(catalog command) # catalog 注册信息

  1. catalog datafilecopy ‘file_name’;  
  2. catalog archivelog ‘arch_file’,’arch_file’;  
  3. catalog archivelog    
  4.   
  5. demo 1:  
  6. sys>alter tablespace users begin backup;  
  7. cp /u01/app/oracle/oradata/orcl/users01.dbf /u02/app/oracle/oradata/orcl/users01.dbf (backup)  
  8. sys>alter tablespace users end backup;  
  9. rman>list copycopy;  
  10. rman>catalog datafilecopy ‘/u02/app/oracle/oradata/orcl/users01.dbf’;  
  11. rman>list copycopy  

4.取消注册(Uncataloging RMAN Records)

  1. CHANGE … UNCATALOG command   
  2. CHANGE ARCHIVELOG … UNCATALOG;  
  3. CHANGE DATAFILECOPY ‘/DB01/BACKUP/users01.dbf’ UNCATALOG;  
  4.   
  5. sys>alter system switch logfile;  
  6. rman>list copycopy;  
  7. rman>change archivelog ‘file_name’ uncatalog;  
  8. rman>catalog archivelog ‘file_name’ ;  
  9. rman>list copycopy;  

5.恢复目录数据库(recovery catalog database)

  1. (1).create user rman identified by rman   # 可以自定义一个表空间  
  2.     default tablespace sysaux  
  3.     quota unlimited on sysaux;  
  4. (2).grant recovery_catalog_owner,connect,resource to rman;  
  5. (3).rman catalog rman/rman;       
  6.    # 有了恢复目录再执行备份,需要使用此命令 rman  target sys/oracle@orcl  catalog rman/rman  
  7. (4).create catalog tablespace sysaux;  # 创建恢复目录  
  8. (5).register database;(unregister database);  
  9. (6).resync catalog;  
  10.   select * from RC_BACKUP_SET;  

Author: Michael

关注数据分析,挖掘数据金矿。

One thought on “ORACLE 恢复目录数据库”

Leave a Reply

Your email address will not be published. Required fields are marked *