建立恢復目錄catalog並註冊目標庫

skyin_1603發表於2016-10-26
建立恢復目錄,並註冊目標資料庫:
--目標庫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部落格 ” ,連結:http://blog.itpub.net/31392094/viewspace-2127106/,如需轉載,請註明出處,否則將追究法律責任。

相關文章