Thursday, March 27, 2014

SCRIPT FOR RMAN BACKUP

Must be set control file autobackup on

//full incremental level 0  backup

DELETE OBSOLETE;
DELETE EXPIRED ARCHIVELOG ALL;
crosscheck archivelog all;
run
{
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
allocate channel c1 type disk
maxpiecesize=500m;
backup incremental level 0 database tag='weekly_level0';
backup archivelog from time 'sysdate-1' until time 'sysdate';
release channel c1;
}

backup current controlfile;
backup spfile;


//////////////full backup specified directory


run {
     allocate channel ch1 type Disk maxpiecesize = 1900M;
     backup full database noexclude
     include current controlfile
     format '/opt/oracle/backup/datafile_%s_%p.bak'
     tag 'datafile_daily';
   }

run {
     allocate channel ch1 type Disk maxpiecesize = 1900M;
     backup archivelog all
     format '/opt/oracle/backup/archivelog_%s_%p.bak'
     tag 'archivelog_daily';
   }

run {
   allocate channel ch1 type Disk maxpiecesize = 1900M;
   backup format '/opt/oracle/backup/controlfile_%s.bak'
   current controlfile;
   }

No comments:

Post a Comment

About the Author : Anurag Pandey | Database cloud Architect | Oracle | SQL Server | PostgreSQL | AI and Data Platform Enthusiast

Anurag Pandey is a Database Architect with expertise in Oracle, PostgreSQL, SQL Server, Linux, and enterprise database platforms and specializes in database architecture, performance tuning, high availability, disaster recovery, cloud modernization, and operational excellence. With extensive experience in enterprise-scale environments, Anurag is passionate about leveraging AI, automation, and modern data platforms to improve reliability, scalability, and business outcomes. He actively contributes to technical communities through knowledge sharing, architecture guidance, and thought leadership in database and data engineering domains.

Follow more articles at

Visit Blog

Oracle 19c to PostgreSQL 15 Migration: Step-by-Step Production Guide (Ora2Pg + DMS)

Production-oriented migration approach for a complex Oracle 19c to PostgreSQL 15 workload , covering assessment, schema and code conversion,...