1.PURPOSE AND SCOPE
When using RMAN for taking backup, database records to backup informations to controlfile. Oracle suggest to use RMAN catalog option because of probability to losing controlfile.With help of RMAN catalog we can save rman informations at catalog database.Also it can use for saving rman scripts and information about rman backups.For to use this product we also need another database which act like a catalog database.
In this artichle i am going to explain how to install oracle RMAN catalog,how to register your database to catalog database and how to control backups.
2.PRACTICE
2.1. Information about database.
192.168.166.128 sourcesrv (Production database)
192.168.166.129 targetsrv (Oracle RMAN catalog database)
2.2. I am creating catalog user at targetsrv database and grant him some necessery privilages.
[oracle@targetsrv ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.2.0 Production on Thu Jun 28 14:10:05 2012 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> create user catalog identified by catalog; User created. SQL> grant recovery_catalog_owner to catalog; Grant succeeded. SQL> alter user catalog quota unlimited on users; User altered.
2.3. At targetsrv database we need to connect rman using catalog user.And we will create catalog.
[oracle@targetsrv ~]$ rman Recovery Manager: Release 11.2.0.2.0 - Production on Thu Jun 28 14:13:23 2012 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. RMAN> connect catalog catalog/catalog@TARGET connected to recovery catalog database RMAN> create catalog recovery catalog created
2.4. Now we need to register our source database to TARGET database using rman.
[oracle@sourcesrv ~]$ rman Recovery Manager: Release 11.2.0.2.0 - Production on Thu Jun 28 14:19:32 2012 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. RMAN> connect target sys/sys@SOURCE connected to target database: SOURCE (DBID=2888707862) RMAN> connect catalog catalog/catalog@TARGET connected to recovery catalog database RMAN> register database; database registered in recovery catalog starting full resync of recovery catalog full resync complete
2.5. We can use “report schema” command to check is registration of database succeed or not.
RMAN> report schema; Report of database schema for database with db_unique_name SOURCE List of Permanent Datafiles =========================== File Size(MB) Tablespace RB segs Datafile Name ---- -------- -------------------- ------- ------------------------ 1 700 SYSTEM YES /oracle/app/oradata/source/system01.dbf 2 510 SYSAUX NO /oracle/app/oradata/source/sysaux01.dbf 3 60 UNDOTBS1 YES /oracle/app/oradata/source/undotbs01.dbf 4 10 USERS NO /oracle/app/oradata/source/users01.dbf 5 313 EXAMPLE NO /oracle/app/oradata/source/example01.dbf List of Temporary Files ======================= File Size(MB) Tablespace Maxsize(MB) Tempfile Name ---- -------- -------------------- ----------- -------------------- 1 20 TEMP 32767 /oracle/app/oradata/source/temp01.dbf
2.6. I didnt take any backup at source database, lets go target database and check catalog.
[oracle@targetsrv ~]$ sqlplus catalog/catalog SQL*Plus: Release 11.2.0.2.0 Production on Thu Jun 28 14:40:06 2012 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production SQL> SELECT BS_KEY, BACKUP_TYPE, COMPLETION_TIME FROM RC_DATABASE_INCARNATION i, RC_BACKUP_SET b WHERE i.DB_KEY = 1 AND i.DB_KEY = b.DB_KEY AND i.CURRENT_INCARNATION = 'YES'; 2 3 4 5 no rows selected
2.7. Nice there is no record about backups so i am starting backup at source database.
[oracle@sourcesrv ~]$ rman Recovery Manager: Release 11.2.0.2.0 - Production on Thu Jun 28 14:19:32 2012 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. RMAN> connect target sys/sys@SOURCE connected to target database: SOURCE (DBID=2888707862) RMAN> connect catalog catalog/catalog@TARGET connected to recovery catalog database RMAN> backup database; Starting backup at 28-JUN-12 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=40 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/oracle/app/oradata/source/system01.dbf input datafile file number=00002 name=/oracle/app/oradata/source/sysaux01.dbf input datafile file number=00005 name=/oracle/app/oradata/source/example01.dbf input datafile file number=00003 name=/oracle/app/oradata/source/undotbs01.dbf input datafile file number=00004 name=/oracle/app/oradata/source/users01.dbf channel ORA_DISK_1: starting piece 1 at 28-JUN-12 channel ORA_DISK_1: finished piece 1 at 28-JUN-12 piece handle=/oracle/app/fast_recovery_area/SOURCE/backupset/2012_06_28/o1_mf_nnndf_TAG20120628T143335_7yrj8kg6_.bkp tag=TAG20120628T143335 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:37 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 28-JUN-12 channel ORA_DISK_1: finished piece 1 at 28-JUN-12 piece handle=/oracle/app/fast_recovery_area/SOURCE/backupset/2012_06_28/o1_mf_ncsnf_TAG20120628T143335_7yrjcnnz_.bkp tag=TAG20120628T143335 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 28-JUN-12
2.8. Lets execute same query at target database to see our backup at catalog.
[oracle@targetsrv ~]$ sqlplus catalog/catalog SQL*Plus: Release 11.2.0.2.0 Production on Thu Jun 28 14:40:06 2012 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production SQL> SELECT BS_KEY, BACKUP_TYPE, COMPLETION_TIME FROM RC_DATABASE_INCARNATION i, RC_BACKUP_SET b WHERE i.DB_KEY = 1 AND i.DB_KEY = b.DB_KEY AND i.CURRENT_INCARNATION = 'YES'; BS_KEY B COMPLETIO ---------- - --------- 33 D 28-JUN-12 34 D 28-JUN-12
2.9. It seems fine.If you need need to unregister your source db from target database these are the steps.
[oracle@sourcesrv ~]$ rman Recovery Manager: Release 11.2.0.2.0 - Production on Thu Jun 28 14:45:46 2012 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. RMAN> connect catalog catalog/catalog@TARGET connected to recovery catalog database RMAN> connect target sys/sys@SOURCE connected to target database: SOURCE (DBID=2888707862) RMAN> unregister database; database name is "SOURCE" and DBID is 2888707862 Do you really want to unregister the database (enter YES or NO)? yes database unregistered from the recovery catalog RMAN> report schema 2> ; RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of report command at 06/28/2012 14:46:46 RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog RMAN>
2.10. This step for deleting catalog at target database
[oracle@targetsrv ~]$ rman Recovery Manager: Release 11.2.0.2.0 - Production on Thu Jun 28 14:49:15 2012 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. RMAN> connect catalog catalog/catalog@TARGET connected to recovery catalog database RMAN> drop catalog; recovery catalog owner is CATALOG enter DROP CATALOG command again to confirm catalog removal RMAN> drop catalog; recovery catalog dropped
Volkan says
Anlatım güzel ama eksik konular var
Bugra Canbakal says
Merhaba Volkan bey eleştirileriniz için teşekkürler, eksik gördüğünüz kısımlar nereler
Volkan says
Merhaba Buğra Bey
2.7. Kayıt bulunamadı, SOURCE veritabanına gidip backup’ı başlatıyorum.
kısımda oraya geçişi kullanıcı girşini gibi bilgileri detaylandırsaydınız daha iyi olurdu diye düşünüyorum.
Bugra Canbakal says
Merhaba 2.7 yi biraz daha detaylandırdım Volkan bey
Volkan says
Teşekkürler Buğra Bey ellerinize sağlık 🙂