手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Dataguard环境下数据库的备份与恢复

[日期:2012-10-29] 来源:51cto  作者:斩月 [字体:大 中 小]

五:将备库的备份数据复制到主库,并使用catalog命令注册到主库的控制文件中

  1. [Oracle@db2 ~]$ scp test01_03novc2b_1_1 db1:/home/oracle/  
  2. [oracle@db1 ~]$ rman target /  
  3. Recovery Manager: Release 11.2.0.3.0 - Production on Mon Oct 29 11:45:02 2012  
  4. Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.  
  5. connected to target database: DB1 (DBID=1387827106, not open)  
  6.  
  7. RMAN> list backup of tablespace test01;  
  8. specification does not match any backup in the repository  
  9.  
  10. RMAN>  catalog backuppiece '/home/oracle/test01_03novc2b_1_1';  
  11.  
  12. cataloged backup piece  
  13. backup piece handle=/home/oracle/test01_03novc2b_1_1 RECID=42 STAMP=797946436 
  14.  
  15. RMAN> list backup of tablespace test01;  
  16.  
  17. List of Backup Sets 
  18. ===================  
  19.  
  20. BS Key  Type LV Size       Device Type Elapsed Time Completion Time     
  21. ------- ---- -- ---------- ----------- ------------ -------------------  
  22. 42      Full    3.98M      DISK        00:00:00     2012-10-29-11:38:51  
  23.         BP Key: 42   Status: AVAILABLE  Compressed: NO  Tag: TAG20121029T113851  
  24.         Piece Name: /home/oracle/test01_03novc2b_1_1  
  25.   List of Datafiles in backup set 42  
  26.   File LV Type Ckp SCN    Ckp Time            Name  
  27.   ---- -- ---- ---------- ------------------- ----  
  28.   34      Full 10350465   2012-10-29-11:35:32 /u01/app/oracle/oradata/db1/test01.dbf 

六:还原和恢复表空间test01,并将主库启动到读写状态,测试主备库数据实时同步情况

  1. RMAN> restore tablespace test01;  
  2. Starting restore at 2012-10-29-11:47:50  
  3. allocated channel: ORA_DISK_1  
  4. channel ORA_DISK_1: SID=21 device type=DISK 
  5.  
  6. channel ORA_DISK_1: starting datafile backup set restore  
  7. channel ORA_DISK_1: specifying datafile(s) to restore from backup set  
  8. channel ORA_DISK_1: restoring datafile 00034 to /u01/app/oracle/oradata/db1/test01.dbf  
  9. channel ORA_DISK_1: reading from backup piece /home/oracle/test01_03novc2b_1_1  
  10. channel ORA_DISK_1: piece handle=/home/oracle/test01_03novc2b_1_1 tag=TAG20121029T113851 
  11. channel ORA_DISK_1: restored backup piece 1  
  12. channel ORA_DISK_1: restore complete, elapsed time: 00:00:01  
  13. Finished restore at 2012-10-29-11:47:52  
  14.  
  15. RMAN> recover tablespace test01;  
  16. Starting recover at 2012-10-29-11:48:02  
  17. using channel ORA_DISK_1  
  18.  
  19. starting media recovery  
  20. media recovery complete, elapsed time: 00:00:01  
  21.  
  22. Finished recover at 2012-10-29-11:48:03  
  23.  
  24. RMAN> alter database open;  
  25. database opened  
  26.  
  27. [oracle@db1 ~]$ sqlplus  /nolog  
  28. SQL*Plus: Release 11.2.0.3.0 Production on Mon Oct 29 11:48:47 2012  
  29. Copyright (c) 1982, 2011, Oracle.  All rights reserved.  
  30.  
  31. SQL> conn /as sysdba  
  32. Connected.  
  33. SQL> truncate table rman;  
  34. Table truncated.  
  35.  
  36. [oracle@db2 ~]$ sqlplus  /nolog  
  37. SQL*Plus: Release 11.2.0.3.0 Production on Mon Oct 29 11:49:12 2012  
  38. Copyright (c) 1982, 2011, Oracle.  All rights reserved.  
  39.  
  40. SQL> conn /as sysdba  
  41. Connected.  
  42. SQL> select count(*) from rman;  
  43.  
  44.   COUNT(*)  
  45. ----------  
  46.          0 
linux
相关资讯       DataGuard  Oracle备份 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款