3
Below are my scripts: ------------------------ 1)run_TESTDB.txt: --------------------- run_PRODDB.txt is for the setting I'm going to configure for RMAN.We have to create this file first than the actual shell script for taking rman backup. -- RMAN Configured run{ shutdown immediate; startup mount; allocate channel ch1 device type disk format '/u02/DB_BACKUP_PRODDB/RMAN_COLDBACKUP_WEEKLY/PRODDB_BK_SET1_%U_%T' maxpiecesize 5G; allocate channel ch2 device type disk format '/u02/DB_BACKUP_PRODDB/RMAN_COLDBACKUP_WEEKLY/PRODDB_BK_SET2_%U_%T'; backup database TAG='PRODDB_BACKUP_WEEKLY'; allocate channel c1 type disk; copy current controlfile to '/u02/DB_BACKUP_PRODDB/RMAN_COLDBACKUP_WEEKLY/PRODDB_ctrl_%U_%T'; Release channel c1; configure retention policy to recovery window of 7 days; CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u02/DB_BACKUP_PRODDB/RMAN_COLDBACKUP_WEEKLY/snapcf_PRODDB.f'; CROSSCHECK BACKUP;

Rman Coldbkp

Embed Size (px)

DESCRIPTION

RMAN_COLDBKP

Citation preview

Page 1: Rman Coldbkp

Below are my scripts:

------------------------

1)run_TESTDB.txt:

---------------------

run_PRODDB.txt is for the setting I'm going to configure for RMAN.We have to create this file first than the actual shell script for taking rman backup.

-- RMAN Configured

run{

shutdown immediate;

startup mount;

allocate channel ch1 device type disk format '/u02/DB_BACKUP_PRODDB/RMAN_COLDBACKUP_WEEKLY/PRODDB_BK_SET1_%U_%T' maxpiecesize 5G;

allocate channel ch2 device type disk format '/u02/DB_BACKUP_PRODDB/RMAN_COLDBACKUP_WEEKLY/PRODDB_BK_SET2_%U_%T';

backup database TAG='PRODDB_BACKUP_WEEKLY';

allocate channel c1 type disk;

copy current controlfile to '/u02/DB_BACKUP_PRODDB/RMAN_COLDBACKUP_WEEKLY/PRODDB_ctrl_%U_%T';

Release channel c1;

configure retention policy to recovery window of 7 days;

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u02/DB_BACKUP_PRODDB/RMAN_COLDBACKUP_WEEKLY/snapcf_PRODDB.f';

CROSSCHECK BACKUP;

release channel ch1;

release channel ch2;

alter database open;

Page 2: Rman Coldbkp

}

2)rman_TESTDB.sh:

--------------------

rman_PRODDB.sh consist of setting Oracle Environment Variables and calling the run_PRODDB.txt file for taking the rman cold backup.

-- PRODDB RMAN COLD BACKUP

export ORACLE_SID=PRODDB

export ORACLE_HOME=/u01/oracle11g/product/11.2.0/dbhome_1

export ORACLE_BASE=/u01/oracle11g

PATH=$ORACLE_HOME/bin:$PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib

rman target sys/PRODDBdba @/u02/DB_BACKUP_PRODDB/Backup_Scipts/run_PRODDB.txt log=/u02/DB_BACKUP_PRODDB/logs/rman_cold_weekly_backup_logs/rman_PRODDB.log

Scheduling RMAN Backup job:

-------------------------------

If I want to schedule this backup every sunday at 9pm.The cronjob script will be:

$vi crontab.oracle

#Script for RMAN COLD BACKUP WEEKLY TESTDB DATABASE

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

00 21 * * 0 /u02/DB_BACKUP_PRODDB/SCRIPTS/rman_PRODDB.sh 2>&1 >/u02/DB_BACKUP_PRODDB/logs/CRONJOBS_LOGS/proddb_rman_cron.log

$crontab crontab.oracle =>scheduling job using 'crontab' command at 9pm every sundays.

Page 3: Rman Coldbkp

Verifying cronjob:

-----------------------

$crontab -l =>List the jobs that are scheduled using Cronjob.Verify the rman job also if we have schedule as above.