Friday 6 April 2012

RMAN in catalog mode implemented on Oracle EBS

Target Database - Means the database need to Backed up.

Repository (Catalog) Database - Means the database where we will store all the information of the target database. Which need to be different database all about. This database need to be same version or less than the target database.



1. Modify TNSNAMES.ORA(Into Both database Target as well as Repository(catalog) )
--------------------------------------------------------------------------------------------------
catalog$ cd $ORACLE_HOME/network/admin
catalog$ vi tnsnames.ora

-- add the following:
REPOS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.119)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = master)
)
)
-- save change

catalog$ tnsping master
catalog$ ping 192.168.1.119

2. Put the Target Database(MASTER) into Archive Log Mode
---------------------------------------------------------------------
master$ sqlplus /nolog
SQL> conn / as sysdba
SQL> shutdown immediate;
SQL> startup mount exclusive;
SQL> alter database archivelog;
SQL> alter database open;
SQL> SELECT group#, thread#, sequence#, archived, status, first_time FROM v$log;
SQL> alter system switch logfile;
SQL> SELECT group#, thread#, sequence#, archived, status, first_time FROM v$log;
SQL> SELECT dbid, name FROM v$database;
SQL> select log_mode from v$database;
SQL> archive log list;
SQL> select DEST_NAME,STATUS,DESTINATION from V$ARCHIVE_DEST;

3. Create password file in Target database
-----------------------------------------------
$orapwd file=orapw entries= force=
After creating the password please check the view v$pwfile_users.

4. Create Repository Tablespace and Schema (Repository Database)
-----------------------------------------------------------------------------
SQL> conn sys@catalog AS SYSDBA
password: ************
SQL> SELECT file_name FROM dba_data_files;
SQL> SELECT name, value FROM gv$parameter WHERE name like '%block%';

-- Create tablepsace to hold repository
SQL> CREATE TABLESPACE "RMAN"
DATAFILE '/Path/RMAN.dbf' SIZE 50M
AUTOEXTEND ON
BLOCKSIZE 8192
FORCE LOGGING
DEFAULT NOCOMPRESS
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 64K
SEGMENT SPACE MANAGEMENT AUTO
ONLINE;

-- Create rman schema owner
SQL> CREATE USER rman
IDENTIFIED BY oracle1
DEFAULT TABLESPACE RMAN
TEMPORARY TABLESPACE temp
QUOTA UNLIMITED ON RMAN;


SQL> GRANT connect, resource, recovery_catalog_owner TO rman;
OR
SQL> GRANT CREATE session TO rman;
SQL> GRANT recovery_catalog_owner TO rman;
SQL> GRANT execute ON dbms_stats TO rman;

SQL> conn rman#/oracle1@catalog
SQL> SELECT COUNT(*) FROM user_objects;
SQL> exit;


5. Create RMAN Catalog (Repository Database)
-------------------------------------------------------
catalog$ rman target / catalog rman/oracle1@catalog
OR
catalog$ rman catalog=rman/oracle1@catalog

RMAN> create catalog; -- if the tablespace already exists
OR
RMAN> create catalog tablespace 'RMAN'; -- if rman is not the default tablespace
RMAN> exit;


6. Register Database (Repository Database)
-------------------------------------------------
catalog$ rman catalog=rman/oracle1@backup target=sys/password@master;
RMAN> register database;
RMAN> REPORT SCHEMA;  -- Make sure that the registration was successful



7. Configure the Parameters for this Instance.  (Repository Database)
-----------------------------------------------------------------------------
RMAN> show all;    -- For see the all Configure Backup Parameters.
RMAN> configure retention policy to recovery window of 7 days;
RMAN> CONFIGURE BACKUP OPTIMIZATION ON;   -- do not back up unchanged data files
RMAN> CONFIGURE MAXSETSIZE TO 2 G;                  -- make filesize <= 2GB
RMAN> configure default device type to disk;
RMAN> configure controlfile autobackup on;                         --Enable automatic controlfile backup after
each database or archivelog backup.
RMAN> configure channel device type disk format 'uo1\Oracle\Backup%d_DB_%u_%s_%p';




8. Full Resyncronization on a regular basis (Repository Database)
-------------------------------------------------------------------------
RMAN> resync catalog;
RMAN> report need backup;


9. Run Full Backup (Repository Database)
-----------------------------------------------
RMAN> RUN
{
ALLOCATE CHANNEL d1 DEVICE TYPE DISK FORMAT '/home/oracle/backup1/%U';
ALLOCATE CHANNEL d2 DEVICE TYPE DISK FORMAT '/home/oracle/backup2/%U';
BACKUP DATABASE PLUS ARCHIVELOG;
}


10. Report (Repository Database)
--------------------------------------
RMAN> list backup summary;
SQL> ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
SQL> desc v$rman_status
SQL> SELECT operation, status, mbytes_processed, start_time, end_time FROM v$rman_status;
RMAN> report need backup;

No comments:

Post a Comment