创建恢复目录,并注册目标数据库:
--目标库A库:ORA11GR2:target database: ORA11GR2 (DBID=238796283) ----目标数据库
--客户端B库:OCMU: target database: ORA11GR2 (DBID=238796283) ----恢复目录所有者
--创建表空间:
SQL> create tablespace tscatalog datafile '/u01/app/oracle/oradata/ORCL/tscatalog.dbf' size 15m;
Tablespace created.
--创建恢复目录所有者并授权:
SQL> CREATE USER rcowner IDENTIFIED BY oracle
2 TEMPORARY TABLESPACE temp
3 DEFAULT TABLESPACE tscatalog
4 QUOTA UNLIMITED ON tscatalog;
User created.
SQL> GRANT recovery_catalog_owner TO rcowner;
Grant succeeded.
--配置指向本库(目录所有者所在)的tns文件:
13 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.6)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORA11GR2)
)
)
--恢复目录所有者连接本库,创建恢复目录:
[oracle@enmo ~]$ rman catalog rcowner/oracle@13
Recovery Manager: Release 11.2.0.4.0 - Production on Sun Oct 16 15:50:54 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to recovery catalog database
RMAN> create catalog;
recovery catalog created
恢复目录创建成功。
--在恢复目录中注册目标数据库(oracle虚拟机上的ORA11GR2库 ,ORA11GR2:target database: ORA11GR2 (DBID=238796283))
rman target sys/skysky@11 catalog rcowner/oracle@13
[oracle@enmo ~]$
[oracle@enmo ~]$ rman target sys/skysky@11 catalog rcowner/oracle@13
Recovery Manager: Release 11.2.0.4.0 - Production on Sun Oct 16 15:57:58 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA11GR2 (DBID=238796283)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
目标库A库注册成功。
--查看注册了的目标数据库:
[oracle@enmo ~]$ sqlplus rcowner/oracle@13
SQL*Plus: Release 11.2.0.4.0 Production on Sun Oct 16 16:01: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
SQL> select * from RC_DATABASE;
DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
1 2 238796283 ORA11GR2 925702 10-SEP-16
--取消注册目标库:
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@enmo ~]$
[oracle@enmo ~]$
[oracle@enmo ~]$
[oracle@enmo ~]$ rman target sys/skysky@11 catalog rcowner/oracle@13
Recovery Manager: Release 11.2.0.4.0 - Production on Sun Oct 16 16:04:59 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA11GR2 (DBID=238796283)
connected to recovery catalog database
RMAN> unregister database;
database name is "ORA11GR2" and DBID is 238796283
Do you really want to unregister the database (enter YES or NO)? y
database unregistered from the recovery catalog
SQL> select * from RC_DATABASE;
no rows selected
注销成功。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31392094/viewspace-2127106/
,如需转载,请注明出处,否则将追究法律责任。