Saturday, 4 February 2023

RMAN Configuration

Target DB :eee 
Hostname : amusalpwtsdb02.gesm.ge.com

Catalog DB: RMAN1
Hostname : wasdb117.gesm.ge.com


Target DB Side
###############

1T.Check acrhive log mode if required Enable it.

SQL> select name,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
EEE       READ WRITE

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /archive/eee
Oldest online log sequence     14633
Next log sequence to archive   14635
Current log sequence           14635

Ø Changing database to archive log mode

SQL>startup mount;
SQL>alter database archivelog;


2T. create the Rman backup directory structure.

backup location : /backup/rmanbackup

3T. Give new TNS entry of catalog database and verify it.

RMAN1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = wasdb107.gesm.ge.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rman1)
    )
  )


tnsping RMAN1




CATALOG DB:
###########


1C.Configure the Tnsnames.ora to connect to target DB


Take the backup of exisiting tnsname.ora file and Edit the below TNS Entry on catalog DB.
EEE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = amusalpwtsdb02.gesm.ge.com)(PORT = 1521))
    (CONNECT_DATA =
      (SID = eee)
    )
  )

check the given TNS entry is working on not?

oracle@wasdb117[/u01/app/oracle/product/11.2.0/db_1/network/admin]: tnsping eee
TNS Ping Utility for Solaris: Version 11.2.0.1.0 - Production on 07-APR-2014 01:00:34
Copyright (c) 1997, 2009, Oracle.  All rights reserved.
Used parameter files:
/u01/app/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = amusalpwtsdb02.gesm.ge.com)(PORT = 1521)) (CONNECT_DATA = (SID = eee)))

OK (330 msec)



2C.Create a tablespace to store rman catalog database objects.

SQL> create tablespace RMANCATALOG datafile '/u01/oradata/rman/RMANCATALOG.dbf' size 5000m;


3C.Create a user,assign rman tablespace & grant extra recovery_catalog_owner privs to rman user as a default.

SQL>create user RMAN identified by rman default tablespace RMANCATALOG temporary tablespace TEMP quota unlimited on RMANCATALOG;

Grant one extra privilege to rman user.

SQL> grant connect,resource , recovery_catalog_owner to rman;


4C.Connect to RMAN prompt.

$rman catalog rman/rman

RMAN>
#############################################################################################################

oracle@wasdb117[/u01/app/oracle/product/11.2.0/db_1/network/admin]: rman catalog rman/rman

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Apr 7 01:12:21 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to recovery catalog database
#############################################################################################################


5C*****.Create the catalog in RMAN prompt;

RMAN> create catalog

(NOTE: check in rman user all objects are created or not)


on Target:
==========

5T*****.Connect catalog Database on Target Database and register it.

rman catalog rman/rman@rman1 target /

eee:oracle>rman catalog rman/rman@rman1 target /

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Apr 7 01:28:12 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: EEE (DBID=344813118)
connected to recovery catalog database

RMAN>  register database;


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


On Catalog DB:
==============

6C.check target database registered or not in rman user with rc_database view)

SQL> select name,open_mode from v$database;
NAME      OPEN_MODE
--------- --------------------
RMAN1     READ WRITE

SQL> conn rman/rman
Connected.
SQL> Select * from rc_database;

    DB_KEY  DBINC_KEY       DBID NAME     RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
     83473      83474 3683565891 DEVDIREP            564341 30-JUL-10
    476705     476706 3117822577 RMDPRD              945184 02-MAR-13
      4767       4768 2508018483 WATERRMD            945184 22-FEB-12
     19815      19816 1005276884 MSDGEN60                 1 20-APR-12
     23774      23775 3413783041 GESM                945184 28-AUG-12
   1573270    1573271  344813118 EEE                      1 10-FEB-06  #######This is the one DB we are looking for########
         2          4  253819996 WEBQA               525876 20-OCT-11

7 rows selected.


ON Target :
===========
6T.Check  & Configure the show all Parameters.

eee:oracle>rman catalog rman/rman@rman1 target /

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Apr 7 01:52:24 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: EEE (DBID=344813118)
connected to recovery catalog database

RMAN>  show all;

RMAN configuration parameters for database with db_unique_name EEE are:
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 '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
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 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_eee.f'; # default

##########changed the below parameters as per our requirement#####################

CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/backup/rmanbackup/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET; 
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/backup/rmanbackup/snapcf_eee.f'; 
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
----------------------------------------------------------------------------
After changed:

RMAN> show all;

RMAN configuration parameters for database with db_unique_name EEE are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/backup/rmanbackup/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
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 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/backup/rmanbackup/snapcf_eee.f';

4T.Check Backup info & Take the fresh Backup of the target Database.


RMAN>  list backup  summary ;
specification does not match any backup in the repository

RMAN>  backup database;

you can see more command in the below

#############################################################################################################################


************************************unregister database from rman catalog 11g***************************************************

In recovery catalog schema -

The syntax for the procedure is:
– dbms_rcvcat.unregisterdatabase(db_key,db_id);


SQL> select name,open_mode from v$database;

NAME      OPEN_MODE
--------- ----------
RMAN      READ WRITE

SQL> conn rman/rman
Connected.


Before :
---------

SQL> Select * from rc_database;

    DB_KEY  DBINC_KEY       DBID NAME     RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
     83473      83474 3683565891 DEVDIREP            564341 30-JUL-10
    476705     476706 3117822577 RMDPRD              945184 02-MAR-13
      4767       4768 2508018483 WATERRMD            945184 22-FEB-12
     19815      19816 1005276884 MSDGEN60                 1 20-APR-12
     23774      23775 3413783041 GESM                945184 28-AUG-12
   1573270    1573271  344813118 EEE                      1 10-FEB-06  #######This is the one DB we are looking for########
         2          4  253819996 WEBQA               525876 20-OCT-11

7 rows selected.


SQL> exec dbms_rcvcat.unregisterdatabase(1573270,344813118);

PL/SQL procedure successfully completed.


After:
------

SQL> Select * from rc_database;

    DB_KEY  DBINC_KEY       DBID NAME     RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
     83473      83474 3683565891 DEVDIREP            564341 30-JUL-10
    476705     476706 3117822577 RMDPRD              945184 02-MAR-13
      4767       4768 2508018483 WATERRMD            945184 22-FEB-12
     19815      19816 1005276884 MSDGEN60                 1 20-APR-12
     23774      23775 3413783041 GESM                945184 28-AUG-12
         2          4  253819996 WEBQA               525876 20-OCT-11

6 rows selected.





===========================================================================================================================
===========================================================================================================================


Detailed Steps:
-----------------
RMAN Configuration Steps 

Target DB Side

Check & Enable the archive log
Configure the listener.ora.
Create the password file.
Create Rman Backup location directory structure


Catalog DB Side

žConfigure the Tnsnames.ora for target Database.
Create the tablespace to store rman catalog database objects.
Create a user and grant one extra privilege called (recovery_catalog_owner).
Assign rman tablespace to rmanusr as a default.
Connect to RMAN prompt and Create the recovery catalog in catalog database
Connect catalog with target DB and register it.
Change RMAN backup policies.
Take database full backup
================================================
Target DB Side

ž

Check & Enable the archive log

Ø Check the database in Archive log mode or not.

SQL> archive log list

Ø Changing database to archive log mode

SQL>startup mount;

SQL>alter database archivelog;

Configure the Listener.ora

Create the password file in $ORACLE_HOME/dbs

$ orapwd file=orapw$ORACLE_SID password=abcd force=y

create the Rman backup directory structure.

$ mkdir -p /db/u01/rmanbkp

=======================================================

Catalog DB Side

Configure the Tnsnames.ora to connect to target DB

Create a tablespace to store rman catalog database objects.

SQL> create tablespace RMAN_CAT_TS datafile '/u01/oradata/
rman/RMAN_CAT_TS.dbf' size 500m;

Create a user & assign rman tablespace to rman user as a default.

SQL> create user RMAN_USER identified by rman_user
default tablespace RMAN_CAT_TS
temporary tablespace TEMP
quota unlimited on RMAN_CAT_TS;
ž

Grant one extra privilege to rman user.

SQL> grant connect,resource , recovery_catalog_owner to
rman_user;

ž

Connect to RMAN prompt.

~]$rman catalog rman_user/rman_user

RMAN>

ž

Create the catalog in RMAN prompt;

RMAN> create catalog

(NOTE: check in rman user all objects are created or not)

ž

After finishing the catalog database creation connect with target database and register it.

~]$ rman catalog rmanusr/rmanusr target sys/abcd@targetdb_alias;
or
on target DB :rman catalog rman/rman@rman1 target /

RMAN> register database;

(NOTE : check target database registered or not in rman user with
rc_database view)

SQL>Conn rman_user/rman_user
SQL>Select * from rc_database;

Configure RMAN backup policies

RMAN>spool log to show.log
RMAN> show all ;
RMAN>exit

$vi show.log
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
Configure controlfile autobackup format for device type disk to ‘/db/u01/rmanbkp/%F.ctl’;
Configure device type disk parallelism 2 ;
configure channel device type disk format ‘/db/u01/rmanbkp/%U.bkp’;
Configure backup optimization on;
Configure snapshot controlfile name to ‘/db/u01/rmanbkp/snapcf_ssp.f’;
:wq



Note: Configuring an ASM Disk Location
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '+dgroup1';

ž

~]$ rman catalog rmanusr/rmanusr target sys/abcd@targetdb_alias cmdfile=show.log
or
on target DB :rman catalog rman/rman@rman1 target / cmdfile=show.log
================================================================
ž


rman> report need backup;    #report of files with less than 2 redundant backups

rman> backup database ; #If tag not given takes default tag


$ rman catalog  rman/rman  target  sys/abcd@myalias cmdfile = show.log

on target DB :rman catalog rman/rman@rman1 target / cmdfile=show.log


rman> list backup ;  #gives in detail list
rman> list backup  summary ;

rman> backup database tag 'TUE8PM' ;

rman> list backup  summary ;

rman> report need backup;

rman> report obsolete;

rman> delete obsolete;

rman> backup as compressed backupset database tag 'COMP' ;

rman> backup incremental level 0 database tag 'INC0';




0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home