Wednesday, July 16, 2014

Catalog Server setup in dataguard environment

To setup RMAN using catalog database follow these steps :



Here i am using prim as primary database and CATDB as catalog database.


Step1: Enable the archive log in primary prim database.


Step2: Create the tablespace and user in catalog database to hold backup information.

SQL> CONNECT sys/password@catdb AS SYSDBA
Connected.

SQL> CREATE TABLESPACE cattbs datafile '/u01/app/oracle/catdb/cattbs01.DBF' SIZE 30G;

Tablespace created.

SQL> CREATE USER rcat IDENTIFIED BY rcat  TEMPORARY TABLESPACE temp  DEFAULT TABLESPACE cattbs  QUOTA UNLIMITED ON cattbs;

User created.

SQL> GRANT connect, resource, recovery_catalog_owner TO rcat;

Grant succeeded.

The role RECOVERY_CATALOG_OWNER has all of the privileges need to query and maintain the recovery catalog.

   
SQL> select privilege from dba_sys_privs where grantee = 'RECOVERY_CATALOG_OWNER';

PRIVILEGE
----------------------------------------
CREATE SYNONYM
CREATE CLUSTER
ALTER SESSION
CREATE DATABASE LINK
CREATE PROCEDURE
CREATE SEQUENCE
CREATE TABLE
CREATE SESSION
CREATE TYPE
CREATE VIEW
CREATE TRIGGER

11 rows selected.


Step 3: Create the recovery catalog in catalog database.

$ rman catalog rcat/rcat@catdb

Recovery Manager: Release 11.2.0.3.0 - Production on Thu May 21 09:59:26 2009

Copyright (c) 1982, 2009, Oracle. All rights reserved.

connected to recovery catalog database

RMAN> create catalog tablespace cattbs;

recovery catalog created


Step 4: Make Sure to ping the tns connections from target database to catalog and catalog database to target database.


Configure the Listener @Target Side and @Catalog Side.
   
SID_LIST_LISTENER =
 
(SID_LIST =
   
(SID_DESC =
     
(GLOBAL_DBNAME = prim)
     
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
     
(SID_NAME = prim)
    )
  )



LISTENER =
 
(DESCRIPTION =
   
(ADDRESS =
(PROTOCOL = TCP)(HOST = 192.168.0.74)(PORT = 1521))
 
)



ADR_BASE_LISTENER = /u01/app/oracle



SID_LIST_LISTENER =
 
(SID_LIST =
   
(SID_DESC =
     
(GLOBAL_DBNAME = catdb)
     
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
     
(SID_NAME = catdb)
    )
  )



LISTENER =
 
(DESCRIPTION =
   
(ADDRESS =
(PROTOCOL = TCP)(HOST = 192.168.0.75)(PORT = 1521))
 
)



ADR_BASE_LISTENER = /u01/app/oracle


Step 5: Add tns entries into target database and Catalog side database:

   
prim =
 
(DESCRIPTION =
   
(ADDRESS =
(PROTOCOL = TCP)(HOST = 192.168.0.74)(PORT = 1521))
   
(CONNECT_DATA =
     
(SERVER = DEDICATED)
     
(SERVICE_NAME = prim)
   
 )
 
   )


CATDB =
 
(DESCRIPTION =
   
(ADDRESS =
(PROTOCOL = TCP)(HOST = 192.168.0.74)(PORT = 1521))
   
(CONNECT_DATA =
     
(SERVER = DEDICATED)
     
(SERVICE_NAME = CATDB)
   
 )
 
   )


Step 6 : Register the database with Catalog database. Each database should be registered to catalog database to run RMAN backup.


$ rman catalog rcat/rcat@catdb target sys/sys123@prim

Recovery Manager: Release 10.2.0.1.0 - Production on Thu May 21 10:02:01 2009

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: PRIM (DBID=1215124933)
connected to recovery catalog database

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete


Step 7: Check the target database is registered into the catalog database.

SQL> select * from rc_database;

DB_KEY  DBINC_KEY       DBID NAME     RESETLOGS_CHANGE# RESETLOGS
———- ———- ———- ——– —————– ———
1          2  701459141 prim                  1 02-JUN-11


RMAN> list db_unique_name all;


List of Databases
DB Key  DB Name  DB ID            Database Role    Db_unique_name
------- ------- ----------------- ---------------  ------------------
2       PRIM  2502578563       PRIMARY          PRIM


Step 8 : Check the RMAN configuration Parameters.

RMAN> Show all;

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/d01/mydb/RMANB
KPS/DEV_%D%M%Y_%s_%p_%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/d01/mydb/RMANBKPS/DEV_%D%M%Y_%s_%p';
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BZIP2'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/d02/DEV/tech_st/11.1.0/dbs/snapcf_DEV.f'; # default


Step 9 : Take database full backup. The full database backup should be taken first time. Afterwards, archivelog backup will be taken.

$ rman catalog rman/rman@catdb target sys/password@prim

Recovery Manager: Release 11.3.0.1.0 - Production on Thu May 21 10:16:09 2009

Copyright (c) 1982, 2009, Oracle. All rights reserved.

connected to target database: prim(DBID=1215124933)
connected to recovery catalog database

RMAN> run{
     backup database plus archivelog;
     delete noprompt obsolete;
     }


Step 10 : Now the full backup is taken. Every day, the below script should run and backup the new archive log files.

$ rman catalog rman/rman@catdb target sys/password@prim

Recovery Manager: Release 11.2.0.1.0 - Production on Thu May 21 10:25:40 2013

Copyright (c) 1982, 2009, Oracle. All rights reserved.

connected to target database: prim(DBID=1215124933)
connected to recovery catalog database

RMAN> run{
2> delete noprompt obsolete;
3> backup archivelog all;
4> }

RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 2 days
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=133 devtype=DISK
no obsolete backups found

Finished backup at 21-MAY-13

Starting Control File and SPFILE Autobackup at 21-MAY-13
piece handle=C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\C-1215124933-20090521-01 com
ment=NONE
Finished Control File and SPFILE Autobackup at 21-MAY-13

Step 10 : Lists the RMAN Backups:


RMAN> list backup;

No comments:

Post a Comment