【備份恢復】之RMAN 恢復目錄庫(客戶端備份資訊註冊到目標庫恢復目錄中)

不一樣的天空w發表於2016-10-16

描述:

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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章