Thursday, January 7, 2016

RMAN backup scripts

RMAN cold backup
================
run{
allocate channel d1 type disk FORMAT   '/u01/xx/xxxxx//%d_db_%u_%s_%p' MAXPIECESIZE 10G;
allocate channel d2 type disk FORMAT   '/u01/xx/xxxxx//%d_db_%u_%s_%p' MAXPIECESIZE 10G;
allocate channel d3 type disk FORMAT   '/u01/xx/xxxxx//%d_db_%u_%s_%p' MAXPIECESIZE 10G;
allocate channel d4 type disk FORMAT   '/u01/xx/xxxxx//%d_db_%u_%s_%p' MAXPIECESIZE 10G;
shutdown immediate;
startup mount;
backup tag FYR_database_cold as compressed backupset database ;
release channel d1;
release channel d2;
release channel d3;
release channel d4;
allocate channel ar1 type disk format '/u01/xxxxx/rman_cn_%T_%U.rman';
sql "alter database backup controlfile to ''/u01/xxxxx/rman_control.rman'' reuse";
release channel ar1 ;
alter database open;
}


RMAN Hot Backup
===============
run{
allocate channel d1 type disk FORMAT   '/u01/xxxxxx/%d_db_%u_%s_%p' MAXPIECESIZE 10G;
allocate channel d2 type disk FORMAT   '/u01/xxxxxx/%d_db_%u_%s_%p' MAXPIECESIZE 10G;
backup tag whole_database_cold as compressed backupset database ;
release channel d1;
release channel d2;
release channel d3;
release channel d4;
allocate channel ar1 type disk format '/u01/xxxx/rman_arc_%T_%U.rman';
BACKUP ARCHIVELOG from time 'sysdate - 2' ;
sql "alter database backup controlfile to ''/u01/xxxx/rman_control.rman'' reuse";
release channel ar1 ;
}

RESTORE (Duplicate)
===================
rman auxiliary /
RUN
{
ALLOCATE AUXILIARY CHANNEL c1 xxxICE TYPE disk ;
ALLOCATE AUXILIARY CHANNEL c2 xxxICE TYPE disk ;
ALLOCATE AUXILIARY CHANNEL c3 xxxICE TYPE disk ;
SET NEWNAME FOR DATABASE TO '/u01/xxx/oracle/data/%b';
duplicate database PROD to 'xxx' BACKUP LOCATION '/xxxxx/DB_Restore_xxx'
duplicate database PROD to 'xxx' BACKUP LOCATION '/xxxxx/DB_Restore_xxx'
LOGFILE GROUP 1 ('/u01/xxx/oracle/data/redo01.rdo') SIZE 1G REUSE, GROUP 2 ('/u01/xxx/oracle/data/redo02.rdo') SIZE 1G REUSE, GROUP 3 ('/u01/xxx/oracle/data/redo03.rdo') SIZE 1G REUSE;}


Use this in init file for RAC database "_no_recovery_through_resetlogs=TRUE"

No comments:

Post a Comment

Oracle E-business suite logs clean up

 Oracle E-business suite logs clean up #!/bin/bash cd $EBS_DOMAIN_HOME find $EBS_DOMAIN_HOME -type f -path "*/logs/*.log?*" -mtime...