Oracle的RMAN配置信息默认存放在target数据库的控制文件中,也可以配置一个recovery catalog服务器来存储这些信息,下面是控制文件和恢复的特性比较
Control file:
– Simpler administration
– Default
Recovery catalog:
– Replicates control file data
– Has room for more data
– Can service many targets
– Can store RMAN scripts
RMAN repository data is always stored in the control file of the target database. But it can also be stored in a separate database, called a recovery catalog.
A recovery catalog preserves backup information in a separate database, which is useful in the event of a lost control file. This allows you to store a longer history of backups than what is possible with a control file–based repository. A single recovery catalog is able to store information for multiple target databases. The recovery catalog can also hold RMAN stored scripts, which are sequences of RMAN commands for common backup tasks. Centralized storage of scripts in the recovery catalog can be more convenient than working with command files.
Usage of a separate recovery catalog database is not recommended for small installations where administration of a separate recovery catalog database would be burdenso
下面来演示下恢复目录的配置,其中jy为catalog数据库,test数据库为测试数据库
1.创建用户/表空间与授权(我这里使用users表空间没有新建表空间)
SQL> create user rman identified by "rman"
2 default tablespace users
3 temporary tablespace temp
4 quota unlimited on users;
User created.
SQL> grant recovery_catalog_owner to rman;
Grant succeeded.
SQL> conn rman/rman
Connected.
SQL> select count (*) from user_objects;
COUNT(*)
----------
0
2:创建恢复目录
[oracle@jingyong1 admin]$ rman catalog rman/rman@jy
Recovery Manager: Release 10.2.0.5.0 - Production on Sun Feb 1 21:22:31 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to recovery catalog database
RMAN> create catalog;
recovery catalog created
SQL> conn rman/rman
Connected.
SQL> select count (*) from user_objects;
COUNT(*)
----------
194
可以看出在rman用户下的对象个数为194个
3:增加tns服务名
[oracle@oracle11g admin]$ vi tnsnames.ora
jy =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.56.11)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = jy)
)
)
4:注册目标数据库,同步catalog和控制文件
[oracle@oracle11g admin]$ rman target sys/zzh_2046@test catalog rman/rman@jy
Recovery Manager: Release 10.2.0.5.0 - Production on Sun Feb 1 21:25:25 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: TEST (DBID=2155613261)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
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 10 TEST 2155613261 PARENT 1 30-JUN-05
1 11 TEST 2155613261 PARENT 446075 05-SEP-14
1 12 TEST 2155613261 PARENT 2849317 27-JAN-15
1 13 TEST 2155613261 PARENT 2880152 27-JAN-15
1 2 TEST 2155613261 CURRENT 3017109 01-FEB-15
--------------------------------------推荐阅读 --------------------------------------
--------------------------------------分割线 --------------------------------------