PeopleSoft

Register New Database in RMAN

May 11, 2008 · Leave a Comment

To register a new incarnation or register a database for the first time in RMAN:

  • Connect to RMAN and list the incarnation(s) of the database (to identify existing incarnations or to check if the database has been registered with RMAN already):

rman target <username>/<password>@TNSname rcvcat <rman userid>/<rman password>

To list the incarnations(s):

RMAN> list incarnation;

If the database has already been registered you will see output similar to the following:

RMAN> list incarnation;

List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time

——- ——- ——– —————- — ———- ———-
1 2 PSEHR83 2199643792 CURRENT 1 01-APR-08

Otherwise, you will not see anything. If you don’t see anything you will be registering the database for the first time. If you do see a list of Database Incarnations you need to decide if you want to register a new Incarnation or continue to work with the existing incarnation. To register a database issue the register database command as follows:

RMAN> register database;

To display a list of the default configuration parameters, enter the command show all; – as shown below (the semicolon instructs RMAN to execute the text preceding the semicolon):

RMAN> show all;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
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 ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘/opt/app/oracle/product/10.2.0/db_1/dbs/snapcf_PSEHR83.f’; # default

In the output above there are only two changes to the default parameters. I set the value of BACKUP OPTIMIZATION to ON and the value of CONTROLFILE AUTOBACK to ON by issuing the following two commands:

RMAN> configure backup optimization on;
RMAN> configure controlfile autobackup on;

Whenever you issue a command to change the value of one of the parameters RMAN will display the current value and the new value as follows:

RMAN> configure controlfile autobackup on;

old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN>

In RMAN 10g R2, RMAN remembers the changed parameters from one RMAN session to another. There is no need to issue the configuration commands in each RMAN session. However, I issue a set of RMAN configuration commands in the RMAN scripts I create to ensure that the parameters are set to the values I need for that RMAN execution.

In our environments we generate RMAN backupsets, controlfile copies, archivelog copies, etc. to disk and to be more specific to ASM disks. The following configuration parameters are examples of the parameters we set in some of our RMAN scripts:

RMAN> configure backup optimization on;
RMAN> configure controlfile autobackup on;
RMAN> configure controlfile autobackup format for device type disk to ‘+ps89fn_disk3/ps89hrrf/autobackup/%F’;
RMAN> configure device type disk backup type to backupset parallelism 2;

I choose a value of 2 for parallelism because this example is for RMAN running on a Itanium Blade that only has two processes and although my ASM storage consists of three logical volumes I only write RMAN backupsets and copies to two of the three ASM volumes.

The following is an example or an RMAN script that generates a level 0 incremental backupset:

[oracle@pdpfdb01:psprman:/opt/app/oracle/admin/scripts/psprman>more rman_full.rman
CONNECT target “<oracle userid>/<user password>@ps89fnp1″
CONNECT catalog <rman userid>/<rman password>
list backup;
configure channel 1 device type disk format ‘+ps89fn_disk1′ maxpiecesize 1750 M;
configure channel 2 device type disk format ‘+ps89fn_disk3′ maxpiecesize 1750 M;
backup incremental level 0 database tag=”prod_bkup” noexclude;
crosscheck backupset;
crosscheck copy;
delete obsolete;

The Oracle DB user account and password are in quotes because our passwords are required to contain alpha numeric characters and special characters. If a user account or password contains numeric characters and/or special characters it must be passed to Oracle program in quotes. The first CONNECT statement contains the user account and password for the Oracle Database to be backed up and the second CONNECT statement contains the user account and password for the RMAN Database.

To invoke an RMAN script you can use the following example as a guide:

rman @<script name>.rman

I create very very simple Korn shell scripts to invoke an RMAN script so I can run the RMAN task out of crontab. Here is a very simple example of a Korn shell script that invokes an RMAN backup script named rman_backup.rman:

[oracle@pdpfdb01:psprman:/opt/app/oracle/admin/dba/scripts/monitor>more rman.ksh
#!/bin/ksh -xv

echo “Start: `/bin/date`”
echo ” “
export ORACLE_HOME=/opt/app/oracle/product/10.2.0/db_1
export ORACLE_SID=psprman
export CURRENT_DIR=/opt/app/oracle/admin/dba/scripts/monitor
export PATH=$PATH:/usr/bin:/bin:${ORACLE_HOME}/bin:${CURRENT_DIR}

rman @/opt/app/oracle/admin/scripts/psprman/rman_backup.rman

echo ” “
echo “End: `/bin/date`”

The actual RMAN scripts I use contain shell commands to send an email out with the execution log and notify me of the success and/or failure of the RMAN task.

Categories: Oracle · RMAN