RMAN catalog恢复目录:
当没有恢复目录的时候,RMAN相关的备份信息,比如归档路径、备份集路径等均存在目标数据库的控制文件,但是控制文件并不能无限增长,而且控制文件也不仅仅是用来存储与备份相关的信息,因此RMAN也有一个专门存放备份信息的地方。当待备份的数据库注册到恢复目录之后,RMAN相关的信息除了保存在控制文件中外(只保存一部分),更加详细的信息就被存在恢复目录中。
注意:不要将恢复目录数据库放到目标数据库中。
1.创建恢复目录所有者默认表空间
SYS@ENMO> create tablespace ts_catalog datafile '/u01/app/oracle/oradata/ENMO/ts_catalog.dbf' size 15m;
Tablespace created.
2.创建恢复目录所有者
创建用户rcowner并授予RECOVERY_CATALOG_OWNER角色
SYS@ENMO> create user rcowner identified by oracle temporary tablespace temp default tablespace ts_catalog quota unlimited on ts_catalog;
User created.
SYS@ENMO> grant recovery_catalog_owner to rcowner;
Grant succeeded.
在源库主机配置目标库TNS
[oracle@host01 ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
[oracle@host01 admin]$ vi tnsnames.ora
ENMO =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.88)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ENMO)
)
)
[oracle@host01 admin]$ tnsping ENMO
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 31-DEC-2016 19:30:27
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.88)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ENMO)))
OK (10 msec)
3.创建恢复目录
登录恢复目录数据库
[oracle@host01 admin]$ rman catalog rcowner/oracle@ENMO
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Dec 31 19:40:34 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to recovery catalog database
创建恢复目录
RMAN> create catalog;
recovery catalog created
注 create catalog的动作是在rcowner用户下创建了恢复目录相关的表,表的默认表空间使用的就是用户的默认表空间,
如果相关表指定其他表空间,那么在执行创建的时候加上指定表空间名称create catalog tablespacets_name;
4.注册目标数据库
在恢复目录中注册目标数据库
[oracle@host01 admin]$ rman target / catalog rcowner/oracle@ENMO
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Dec 31 19:43:33 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD1 (DBID=2148633869)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
查看已注册的目标库
[oracle@host01 ~]$ sqlplus rcowner/oracle@ENMO
SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 31 19:45:35 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
RCOWNER@ENMO>select * from rc_database;
DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
1 2 2148633869 PROD1 1252285 31-DEC-16
从恢复目录中注销目标数据库
[oracle@host01 ~]$ rman target / catalog rcowner/oracle@ENMO
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Dec 31 19:47:11 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD1 (DBID=2148633869)
connected to recovery catalog database
RMAN> unregister database;
database name is "PROD1" and DBID is 2148633869
Do you really want to unregister the database (enter YES or NO)? yes
database unregistered from the recovery catalog
RMAN> exit
Recovery Manager complete.
再次查看已注册的目标数据库
[oracle@host01 ~]$ sqlplus rcowner/oracle@ENMO
SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 31 19:47:39 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
RCOWNER@ENMO>select * from rc_database;
no rows selected
(没有已注册的数据库信息)
5.手动重新同步恢复目录
[oracle@host01 ~]$ rman target / catalog rcowner/oracle@ENMO
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Dec 31 19:49:56 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD1 (DBID=2148633869)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
RMAN> exit
RCOWNER@ENMO>select * from rc_database;
DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
147 148 2148633869 PROD1 1252285 31-DEC-16
[oracle@host01 ~]$ rman target / catalog rcowner/oracle@ENMO
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Dec 31 19:51:13 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD1 (DBID=2148633869)
connected to recovery catalog database
RMAN> resync catalog;
starting full resync of recovery catalog
full resync complete
当没有恢复目录的时候,RMAN相关的备份信息,比如归档路径、备份集路径等均存在目标数据库的控制文件,但是控制文件并不能无限增长,而且控制文件也不仅仅是用来存储与备份相关的信息,因此RMAN也有一个专门存放备份信息的地方。当待备份的数据库注册到恢复目录之后,RMAN相关的信息除了保存在控制文件中外(只保存一部分),更加详细的信息就被存在恢复目录中。
注意:不要将恢复目录数据库放到目标数据库中。
1.创建恢复目录所有者默认表空间
SYS@ENMO> create tablespace ts_catalog datafile '/u01/app/oracle/oradata/ENMO/ts_catalog.dbf' size 15m;
Tablespace created.
2.创建恢复目录所有者
创建用户rcowner并授予RECOVERY_CATALOG_OWNER角色
SYS@ENMO> create user rcowner identified by oracle temporary tablespace temp default tablespace ts_catalog quota unlimited on ts_catalog;
User created.
SYS@ENMO> grant recovery_catalog_owner to rcowner;
Grant succeeded.
在源库主机配置目标库TNS
[oracle@host01 ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
[oracle@host01 admin]$ vi tnsnames.ora
ENMO =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.88)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ENMO)
)
)
[oracle@host01 admin]$ tnsping ENMO
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 31-DEC-2016 19:30:27
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.88)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ENMO)))
OK (10 msec)
3.创建恢复目录
登录恢复目录数据库
[oracle@host01 admin]$ rman catalog rcowner/oracle@ENMO
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Dec 31 19:40:34 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to recovery catalog database
创建恢复目录
RMAN> create catalog;
recovery catalog created
注 create catalog的动作是在rcowner用户下创建了恢复目录相关的表,表的默认表空间使用的就是用户的默认表空间,
如果相关表指定其他表空间,那么在执行创建的时候加上指定表空间名称create catalog tablespacets_name;
4.注册目标数据库
在恢复目录中注册目标数据库
[oracle@host01 admin]$ rman target / catalog rcowner/oracle@ENMO
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Dec 31 19:43:33 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD1 (DBID=2148633869)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
查看已注册的目标库
[oracle@host01 ~]$ sqlplus rcowner/oracle@ENMO
SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 31 19:45:35 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
RCOWNER@ENMO>select * from rc_database;
DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
1 2 2148633869 PROD1 1252285 31-DEC-16
从恢复目录中注销目标数据库
[oracle@host01 ~]$ rman target / catalog rcowner/oracle@ENMO
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Dec 31 19:47:11 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD1 (DBID=2148633869)
connected to recovery catalog database
RMAN> unregister database;
database name is "PROD1" and DBID is 2148633869
Do you really want to unregister the database (enter YES or NO)? yes
database unregistered from the recovery catalog
RMAN> exit
Recovery Manager complete.
再次查看已注册的目标数据库
[oracle@host01 ~]$ sqlplus rcowner/oracle@ENMO
SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 31 19:47:39 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
RCOWNER@ENMO>select * from rc_database;
no rows selected
(没有已注册的数据库信息)
5.手动重新同步恢复目录
[oracle@host01 ~]$ rman target / catalog rcowner/oracle@ENMO
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Dec 31 19:49:56 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD1 (DBID=2148633869)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
RMAN> exit
RCOWNER@ENMO>select * from rc_database;
DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
147 148 2148633869 PROD1 1252285 31-DEC-16
[oracle@host01 ~]$ rman target / catalog rcowner/oracle@ENMO
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Dec 31 19:51:13 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD1 (DBID=2148633869)
connected to recovery catalog database
RMAN> resync catalog;
starting full resync of recovery catalog
full resync complete
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31400681/viewspace-2131734/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31400681/viewspace-2131734/