描述:
在B库创建恢复目录,用户名/密码,rcadmin/oracle,创建成功后,注册A库至恢复目录
答:
B库:192.168.10.3
A库:192.168.10.2
B库操作:
1.创建恢复目录所有者默认表空间:
[oracle@bing dbs]$ echo $ORACLE_SID
OCMU
[oracle@bing dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Oct 10 15:26:02 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> create tablespace ts_catalog datafile '/u01/app/oracle/oradata/OCMU/ts_catalog.dbf' size 15m;
Tablespace created.
2.创建恢复目录所有者,并授予RECOVERY_CATALOG_OWNER角色
SQL> create user rcadmin identified by oracle temporary tablespace temp default tablespace ts_catalog quota unlimited on ts_catalog;
User created.
SQL> grant recovery_catalog_owner to rcadmin;
Grant succeeded.
3.配置本库自己的tnsnames.ora及别名:(已配置好了)
[oracle@bing ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
[oracle@bing admin]$ ls
listener.ora samples shrept.lst tnsnames.ora
[oracle@bing admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
12 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.3)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORA11GR2 )
)
)
[oracle@bing admin]$
——验证:
[oracle@bing admin]$ tnsping 12
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 10-OCT-2016 15:36:02
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.3)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORA11GR2)))
OK (10 msec)
4.创建恢复目录:
[oracle@bing admin]$ rman catalog rcadmin/oracle@12
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Oct 10 15:48:55 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的动作是在rcadmin用户下创建了恢复目录相关的表,表的默认表空间使用的就是用户的默认表空间,如果,相关表指定其他表空间,那么在执行创建的时候加上指定表空间名称
create catalogtablespacets_name;
5.注册目标数据库(在B库上操作):
——创建对于A库的tns
[oracle@bing admin]$ vi tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
12 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.3)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORA11GR2)
)
)
110 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORA11GR2)
)
)
~
"tnsnames.ora" 21L, 517C written
[oracle@bing admin]$
——测试;
[oracle@bing admin]$ tnsping 110
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 10-OCT-2016 16:08:19
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.2)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORA11GR2)))
OK (10 msec)
——在B库的恢复目录中注册A库
[oracle@bing admin]$ rman target sys/oracle@110 catalog rcadmin/oracle@12
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Oct 10 16:10:15 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA11GR2 (DBID=237843809)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
6.查看已注册的目标库(B库操作):
[oracle@bing admin]$ sqlplus rcadmin/oracle@12
SQL*Plus: Release 11.2.0.4.0 Production on Mon Oct 10 16:12:20 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 237843809 ORA11GR2 1238936 10-OCT-16
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31397003/viewspace-2126515/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31397003/viewspace-2126515/