oracle 笔记8(Fundamentals II)

十五、RMAN Incomplete Recovery

1、The Procedure

(1) Mount the database

(2) Allocate multiple channels for parallelization

(3) Restore all datafiles

(4) Recover the database by using until time, until sequence,or until scn.

(5) Open the database by Using resetlogs

(6) Perform a whole database backup


2、UNTIL TIME Example




RMAN> backup database format '/u01/backup/rman_i_%U';


启动 backup 于 16-8月 -11
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=144 devtype=DISK
通道 ORA_DISK_1: 启动全部数据文件备份集
通道 ORA_DISK_1: 正在指定备份集中的数据文件
输入数据文件 fno=00006 name=/home/oracle/oradata/TS/mytbs.dbf
输入数据文件 fno=00001 name=/home/oracle/oradata/TS/system01.dbf
输入数据文件 fno=00003 name=/home/oracle/oradata/TS/sysaux01.dbf
输入数据文件 fno=00005 name=/home/oracle/oradata/TS/example01.dbf
输入数据文件 fno=00007 name=/home/oracle/oradata/TS/autostrace01.dbf
输入数据文件 fno=00008 name=/home/oracle/oradata/TS/app1_01.dbf
输入数据文件 fno=00002 name=/home/oracle/oradata/TS/undotbs01.dbf
输入数据文件 fno=00009 name=/home/oracle/oradata/TS/app02_01.dbf
输入数据文件 fno=00004 name=/home/oracle/oradata/TS/users01.dbf
通道 ORA_DISK_1: 正在启动段 1 于 16-8月 -11
通道 ORA_DISK_1: 已完成段 1 于 16-8月 -11
段句柄=/u01/backup/rman_i_03mk52s3_1_1 标记=TAG20110816T143648 注释=NONE
通道 ORA_DISK_1: 备份集已完成, 经过时间:00:02:10
完成 backup 于 16-8月 -11


启动 Control File and SPFILE Autobackup 于 16-8月 -11
段 handle=/u01/backup/ctl_c-2088014681-20110816-00 comment=NONE
完成 Control File and SPFILE Autobackup 于 16-8月 -11


RMAN>


RMAN> startup mount;


Oracle 实例已启动
数据库已装载


系统全局区域总计     285212672 字节


Fixed Size                     1218992 字节
Variable Size                150996560 字节
Database Buffers             130023424 字节
Redo Buffers                   2973696 字节


RMAN> run {
2>     allocate channel c1 type disk;
3>     allocate channel c2 type disk;
4>     allocate channel c3 type disk;
5>     set until time "to_date('2011-08-16:14:49:37','YYYY-MM-DD:HH24:MI:SS')";
6>     restore database;
7>     recover database;
8>     alter database open resetlogs;
9>   }



分配的通道: c1
通道 c1: sid=156 devtype=DISK


分配的通道: c2
通道 c2: sid=155 devtype=DISK


分配的通道: c3
通道 c3: sid=154 devtype=DISK


正在执行命令: SET until clause


启动 restore 于 16-8月 -11


通道 c1: 正在开始恢复数据文件备份集
通道 c1: 正在指定从备份集恢复的数据文件
正将数据文件00001恢复到/home/oracle/oradata/TS/system01.dbf
正将数据文件00002恢复到/home/oracle/oradata/TS/undotbs01.dbf
正将数据文件00003恢复到/home/oracle/oradata/TS/sysaux01.dbf
正将数据文件00004恢复到/home/oracle/oradata/TS/users01.dbf
正将数据文件00005恢复到/home/oracle/oradata/TS/example01.dbf
正将数据文件00006恢复到/home/oracle/oradata/TS/mytbs.dbf
正将数据文件00007恢复到/home/oracle/oradata/TS/autostrace01.dbf
正将数据文件00008恢复到/home/oracle/oradata/TS/app1_01.dbf
正将数据文件00009恢复到/home/oracle/oradata/TS/app02_01.dbf
通道 c1: 正在读取备份段 /u01/backup/rman_i_03mk52s3_1_1
通道 c1: 已恢复备份段 1
段句柄 = /u01/backup/rman_i_03mk52s3_1_1 标记 = TAG20110816T143648
通道 c1: 恢复完成, 用时: 00:01:38
完成 restore 于 16-8月 -11


启动 recover 于 16-8月 -11


正在开始介质的恢复
介质恢复完成, 用时: 00:00:08


完成 recover 于 16-8月 -11


数据库已打开
释放的通道: c1
释放的通道: c2
释放的通道: c3


RMAN>



3、UNTIL SEQUENCE Example


RMAN> run {

                set util sequence 120 thread 1;

                alter database mount;

                restore database;

                recover dababase;   --#recovers through log 119

                alter database open resetlogs;

          }


 





十六、RMAN Recovery Catalog Creation and Maintenance

1、Overview

oracle 笔记8(Fundamentals II)_第1张图片


2、Creating Recovery Catalog

oracle 笔记8(Fundamentals II)_第2张图片


3、


SQL> create tablespace cata datafile '/home/oracle/oradata/lin/catalog_01.dbf' size 1024M                  
  2  segment space management auto extent management local uniform;


Tablespace created.

SQL> create user cata identified by cata default tablespace cata quota unlimited on cata;

User created.

SQL> grant connect,resource to cata;

Grant succeeded.

SQL> grant recovery_catalog_owner to cata;

Grant succeeded.


[oracle@localhost ~]$ rman catalog cata/cata

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Aug 16 16:55:00 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to recovery catalog database

RMAN> create catalog tablespace cata; 

recovery catalog created

RMAN> 


[oracle@localhost ~]$ rman  target sys/sunlin


Recovery Manager: Release 10.2.0.1.0 - Production on Tue Aug 16 20:05:28 2011


Copyright (c) 1982, 2005, Oracle.  All rights reserved.


connected to target database: LIN (DBID=2243770666)


RMAN> connect catalog cata/cata@ST


connected to recovery catalog database


RMAN> register database;


database registered in recovery catalog
starting full resync of recovery catalog
full resync complete


RMAN>list incarnation;

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       7       LIN      2243770666       PARENT  1          15-JUL-11
1       2       LIN      2243770666       CURRENT 172218     16-AUG-11


RMAN> resync catalog;


starting full resync of recovery catalog
full resync complete

RMAN> list incarnation;

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       7       LIN      2243770666       PARENT  1          15-JUL-11
1       2       LIN      2243770666       CURRENT 172218     16-AUG-11

RMAN> reset database to incarnation 2;

database reset to incarnation 2

RMAN> list incarnation;

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       7       LIN      2243770666       PARENT  1          15-JUL-11
1       2       LIN      2243770666       CURRENT 172218     16-AUG-11

RMAN> 


3、Viewing the Catalog

      Data dictionary views

* RC_DATABASE

* RC_DATAFILE

* RC_STORE_SCRIPT

* RC_STORE_SCRIPT_LINE

* RC_TABLESPACE     




































































































































你可能感兴趣的:(oracle 笔记8(Fundamentals II))