ITPub博客

首页 > Linux操作系统 > Linux操作系统 > RMAN恢復簡單操作

RMAN恢復簡單操作

原创 Linux操作系统 作者:tom_xieym 时间:2012-02-15 17:03:34 0 删除 编辑

                 RMAN恢復實例-20120215

概念描述

restore 只是用备份来还原,recover是用archivelog或者online log 举例说明:假设我时间点A,做了个备份,时间点B数据库挂了restore database ;// 这个操作利用时间点A做的备份来还原,返回到时间点A recover database ;//这个操作利用archivelog and online logrecover,从时间点A,推进到时间点B restore 是轉儲也是還原被損壞文件(RMAN經常用)recover 是恢復通過redo log & archive log恢復 restore 还原recover 恢复

1.目標數據庫,用DBCA建立和源庫一樣的DATABASE(注意DB_BLOCK,字符集)

2.先全備源數據庫

CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 2048 M FORMAT   '/u01/dump_dir/%U'; 

 

configure controlfile autobackup on;

 

change archivelog all crosscheck ;

 

BACKUP DATABASE  INCLUDE CURRENT CONTROLFILE FOR STANDBY PLUS ARCHIVELOG;

3.密碼文件同步下

4.源庫創建pfile文件,copy目標庫

Create pfile=’/data/backup/pfile.ora’ from spfile;

5.將備份集copy到目標庫相應位置

List看下需要copy的備份集

   RMAN> list backup;

 

using target database control file instead of recovery catalog

 

List of Backup Sets

===================

 

 

BS Key  Size       Device Type Elapsed Time Completion Time

------- ---------- ----------- ------------ ---------------

1       1.09G      DISK        00:00:17     15-FEB-12     

        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20120215T112951

        Piece Name: /data/backup/01n3ch9f_1_1

 

  List of Archived Logs in backup set 1

  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

6.先啟動目標數據庫到nomount

   SQL> startup nomount;

   將控制文件恢復到相應的位置

   Restore controlfile from autobackup;

7.再啟動到mount狀態下,恢復數據庫

   SQL> alter database mount;

   RMAN>restore database;

8.恢復整個數據庫,并recover

RMAN>recover database;

   會報錯如下:

RMAN> recover database;

 

Starting recover at 15-FEB-12

using channel ORA_DISK_1

 

starting media recovery

 

channel ORA_DISK_1: starting archived log restore to default destination

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=587

channel ORA_DISK_1: reading from backup piece /data/backup/0an3cvli_1_12

channel ORA_DISK_1: piece handle=/data/backup/0an3cvli_1_12 tag=TAG20120215T153513

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

archived log file name=/data/sssdb/arch/1_587_759406989.arc thread=1 sequence=587

unable to find archived log

archived log thread=1 sequence=588

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 02/15/2012 16:40:23

RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 588 and starting SCN of 24517576

 

可先不用管它。

 

9.最后嘗試開啟目標數據庫
SQL> alter database open resetlogs;

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25850100/viewspace-716337/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 开发DBA和产品DBA
请登录后发表评论 登录
全部评论

注册时间:2011-05-20

  • 博文量
    77
  • 访问量
    95468