{"id":71,"date":"2011-07-08T15:30:41","date_gmt":"2011-07-08T15:30:41","guid":{"rendered":"http:\/\/selectsysdatefromdual.gnusystems.net\/?p=71"},"modified":"2011-07-08T15:30:41","modified_gmt":"2011-07-08T15:30:41","slug":"create-your-own-rman-backup-scripts-from-the-scratch","status":"publish","type":"post","link":"https:\/\/selectsysdatefromdual.gnusystems.net\/?p=71","title":{"rendered":"Create your own RMAN backup scripts from the scratch"},"content":{"rendered":"<p>This guide is intended for Oracle Database medium\/high level administrators to have a reference for creating RMAN scripts from the scratch, based on retention policies for physical backups on databases in archive log mode.<\/p>\n<p>[note]If we&#8217;re planning to backup an Oracle RAC database, we&#8217;d like to have the scripts we&#8217;ll create replicated in all the RAC nodes and set the backup storage location to a shared ocfs2\/ASMFS disk so we can have \u201cHigh Availability Oracle RAC RMAN Backups\u201d.[\/note]<\/p>\n<p>First of all, if not already, we&#8217;ll \u201cchange the database into archive log mode\u201d.<\/p>\n<p>Then, we connect using RMAN to the Oracle database instance that we are going to use for the backup:<br \/>\n&nbsp;<\/p>\n<pre>\r\n[oracle@rac1 ~]$ rman target \/ nocatalog \r\n\r\nRecovery Manager: Release 11.2.0.1.0 - Production on Tue Jul 5 13:35:50 2011 \r\n\r\nCopyright (c) 1982, 2009, Oracle and\/or its affiliates.  All rights reserved. \r\n\r\nconnected to target database: RACORA (DBID=4104435745) \r\nusing target database control file instead of recovery catalog \r\n\r\nRMAN> \r\n\r\nRMAN> show all; \r\n\r\nRMAN configuration parameters for database with db_unique_name RACORA are: \r\n\r\nCONFIGURE BACKUP OPTIMIZATION OFF; # default \r\nCONFIGURE DEFAULT DEVICE TYPE TO DISK; # default \r\nCONFIGURE CONTROLFILE AUTOBACKUP OFF; # default \r\nCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default \r\nCONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default \r\nCONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default \r\nCONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default \r\nCONFIGURE MAXSETSIZE TO UNLIMITED; # default \r\nCONFIGURE ENCRYPTION FOR DATABASE OFF; # default \r\nCONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default \r\nCONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default \r\nCONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default \r\nCONFIGURE SNAPSHOT CONTROLFILE NAME TO '\/u01\/app\/oracle\/product\/11.2.0\/db_1\/dbs\/snapcf_RACORA1.f'; # default \r\n<\/pre>\n<p>From which we&#8217;ll keep the following lines for making our scripts configuration file:<br \/>\n&nbsp;<\/p>\n<pre>\r\n# how many days we want to keep backups on disk before RMAN deletes them\r\nCONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default \r\n\r\n# enable\/disable automatic backup of spfile and controlfile\r\nCONFIGURE CONTROLFILE AUTOBACKUP OFF; # default \r\n\r\n# string with the destination of the automatic backup of the spfile and controlfile\r\nCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default \r\n\r\n# Define parallelism degree by an integer.(Only usable on Enterprise Edition)\r\nCONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default \r\n\r\n# Set the compression program. (Why not to use bz2 for compression? ;-)\r\nCONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default \r\n\r\n# Set the destination of the snapshot control file to be kept on the backups. \r\nCONFIGURE SNAPSHOT CONTROLFILE NAME TO '\/u01\/app\/oracle\/product\/11.2.0\/db_1\/dbs\/snapcf_RACORA1.f'; # default <\/pre>\n<p>Now we&#8217;ll choose a backup destination for datafile backups, archived logs backups and the scripts and configuration file.<\/p>\n<p>We really want the backup script outside our $ORACLE_HOME for if we need to reinstall our Oracle binaries (aka. In case of a downgrade needed) won&#8217;t have to worry or remember about them.<\/p>\n<p>But it really can be a directory on our $ORACLE_BASE, so we&#8217;ll choose \u201c$ORACLE_BASE\/backups\/\u201d for the backup root path.<\/p>\n<p>[warning]The paths as well the scripts themselves have to be owned by the system&#8217;s oracle user.[\/warning]<\/p>\n<pre>\r\n[oracle@rac1 ~]$ mkdir $ORACLE_BASE\/backups\r\n[oracle@rac1 ~]$ mkdir \/u01\/app\/oracle\/backups\/\r\n[oracle@rac1 ~]$ mkdir $ORACLE_BASE\/backups\/archivelogs\r\n[oracle@rac1 ~]$ mkdir $ORACLE_BASE\/backups\/datafiles\r\n[oracle@rac1 ~]$ mkdir $ORACLE_BASE\/backups\/controlspfile<\/pre>\n<p>On the other hand, we really want the backup scripts to be placed on or near our backup destination, and that&#8217;s cause the disk filesystem backup will keep the copy to tape of the backup sets as well as the copy of the version of the scripts on the moment the backup is launched. This can be very useful to revert failures on the scripts after a backups fail cause of unwanted changes on the backup scripts.<br \/>\n&nbsp;<\/p>\n<pre>\r\n[oracle@rac1 ~]$ mkdir $ORACLE_BASE\/backups\/scripts\r\n[oracle@rac1 ~]$ mkdir $ORACLE_BASE\/backups\/scripts\/conf<\/pre>\n<p>Then, we create a configuration file for the script pasting the rman parameters as we collected them before, but changing the parameters with the information we already know or have decided:<br \/>\n&nbsp;<\/p>\n<pre>\r\n[oracle@rac1 ~]$ vi \/u01\/app\/oracle\/backups\/scripts\/conf\/rmanbackup.cfg\r\n\r\n# how many days we want to keep backups on disk before RMAN deletes them\r\nCONFIGURE RETENTION POLICY TO REDUNDANCY 1; \r\n\r\n# enable\/disable automatic backup of spfile and controlfile\r\nCONFIGURE CONTROLFILE AUTOBACKUP ON; \r\n\r\n# string with the destination of the automatic backup of the spfile and controlfile\r\nCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$ORACLE_BASE\/backups\/controlspfile\r\n\/%F'; \r\n\r\n# Define parallelism degree by an integer (only usable on Enterprise Edition), and if the backupset is going to be compressed.\r\nCONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET; \r\n\r\n# Set the compression program. (Why not to use bz2 for compression? ;-)\r\nCONFIGURE COMPRESSION ALGORITHM 'BASIC'; \r\n# Set the destination of the snapshot control file to be kept on the backups. \r\nCONFIGURE SNAPSHOT CONTROLFILE NAME TO '$ORACLE_BASE\/backups\/controlspfile\r\n\/snapcf_RACORA1.f'; <\/pre>\n<p>Now, we need to add some extra parameters to the configuration file to add the destination of the backupsets for which RMAN will launch the channels we set up and the maximum size of each backup piece on the backupset, which we&#8217;ll set to 4GB, as it&#8217;s a handy file size for a decent system:<br \/>\n&nbsp;<\/p>\n<pre>\r\nCONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '$ORACLE_BASE\/backups\/datafiles\r\n\/%d_%T_s%s_s%p' MAXPIECESIZE 4G;<\/pre>\n<p>[warning]If your backup destination is a vfat(fat32) partition (WindowsXP-Windows95) the MAXPIECESIZE should be set to 2GB or the backup pieces will get corrupted.[\/warning]<\/p>\n<p>Where the parameter strings in the format stands for:<br \/>\n&nbsp;<\/p>\n<pre>\r\n%d  The name of the database. \r\n%T  The year, month, and day (YYYYMMDD)\r\n%s  The backup set number.\r\n%p  The piece number within the backup set.<\/pre>\n<p>Now we have our configuration file ready, but it contains RMAN commands, that set the options once running the RMAN tool, and we don&#8217;t really want commands running on our configuration file, do we? So we&#8217;ll save the \u201cCONFIGURE\u201d lines on the backup script and change them to fancy fashion variable names and their values.<br \/>\n&nbsp;<\/p>\n<pre>\r\n[oracle@rac1 ~]$ cat \/u01\/app\/oracle\/backups\/scripts\/conf\/rmanbackup.cfg > \/u01\/app\/oracle\/backups\/scripts\/rmanbackup.sh<\/pre>\n<p>The result would be something like this:<br \/>\n&nbsp;<\/p>\n<pre>\r\n# how many days we want to keep backups on disk before RMAN deletes them\r\nREDUNDANCY=1\r\n\r\n# enable\/disable automatic backup of spfile and controlfile\r\nCONTROLFILE_AUTOBACKUP=\"ON\"\r\n\r\n# string with the destination of the automatic backup of the spfile and controlfile\r\nCONTROLFILE_AUTOBACKUP_FORMAT=\"$ORACLE_BASE\/backups\/controlspfile\/%F\"\r\n\r\n# Define parallelism degree by an integer (only usable on Enterprise Edition)\r\nPARALLELISM=1 \r\n\r\n# and if the backupset is going to be compressed.\r\nBACKUPSET_TYPE=\"COMPRESSED BACKUPSET\"\r\n\r\n# Set the compression program. (Why not to use bz2 for compression? ;-)\r\nCOMPRESSION_ALGORITHM=\"BASIC\"\r\n\r\n# Set the destination of the snapshot control file to be kept on the backups. \r\nSNAPSHOT_CONTROLFILE=\"$ORACLE_BASE\/backups\/controlspfile\/snapcf_RACORA1.f\"\r\n\r\nDATAFILES_DEST=\"$ORACLE_BASE\/backups\/datafiles\/%d_%T_s%s_s%p\" \r\nARCHIVELOGS_DEST=\"$ORACLE_BASE\/backups\/archivelogs\/%d_%T_s%s_s%p\" \r\n\r\nMAXPIECESIZE=\"4G\"<\/pre>\n<p>Now, we open the script we just saved before with the \u201cCONFIGURE\u201d lines and swap the parameter with the variable names in the configuration file:<br \/>\n&nbsp;<\/p>\n<pre>\r\nCONFIGURE RETENTION POLICY TO REDUNDANCY $REDUNDANCY;\r\nCONFIGURE CONTROLFILE AUTOBACKUP $CONTROLFILE_AUTOBACKUP;\r\nCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$CONTROLFILE_AUTOBACKUP_FORMAT';       \r\nCONFIGURE DEVICE TYPE DISK PARALLELISM $PARALLELISM BACKUP TYPE TO $BACKUPSET_TYPE;\r\nCONFIGURE COMPRESSION ALGORITHM '$COMPRESSION_ALGORITHM';\r\nCONFIGURE SNAPSHOT CONTROLFILE NAME TO '$SNAPSHOT_CONTROLFILE';\r\nCONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '$DATAFILES_DEST' MAXPIECESIZE $MAXPIECESIZE;<\/pre>\n<p>We test the script and configuration file. To do that, first we need to complete the script loading the configuration file and connecting to RMAN so we add the following at the beginning of the script:<br \/>\n&nbsp;<\/p>\n<pre>\r\n#!\/bin\/bash\r\n\r\nsource ~\/.bash_profile # $ORACLE_HOME and $ORACLE_SID should be exported here \r\n\r\nsource $ORACLE_BASE\/backups\/scripts\/conf\/rmanbackup.cfg\r\n\r\nrman target \/ nocatalog &lt;&lt;EOF\r\n\r\n...\r\nEOF<\/pre>\n<p>Notice that new parameters have appeared, so we&#8217;ll need to add them to our configuration file and substitute them as needed.<\/p>\n<p>Now we&#8217;ve got the script and configuration file ready to test them. This is how they look as they are:<br \/>\n&nbsp;<\/p>\n<pre>\r\n[oracle@rac1 ~]$ cat \/u01\/app\/oracle\/backups\/scripts\/conf\/rmanbackup.cfg\r\n# how many days we want to keep backups on disk before RMAN deletes them\r\nREDUNDANCY=1\r\n\r\n# enable\/disable automatic backup of spfile and controlfile\r\nCONTROLFILE_AUTOBACKUP=\"ON\"\r\n\r\n# string with the destination of the automatic backup of the spfile and controlfile\r\nCONTROLFILE_AUTOBACKUP_FORMAT=\"$ORACLE_BASE\/backups\/controlspfile\/%F\"\r\n\r\n# Define parallelism degree by an integer (only usable on Enterprise Edition)\r\nPARALLELISM=1 \r\n\r\n# and if the backupset is going to be compressed.\r\nBACKUPSET_TYPE=\"COMPRESSED BACKUPSET\"\r\n\r\n# Set the compression program. (Why not to use bz2 for compression? ;-)\r\nCOMPRESSION_ALGORITHM=\"BASIC\"\r\n\r\n# Set the destination of the snapshot control file to be kept on the backups. \r\nSNAPSHOT_CONTROLFILE=\"$ORACLE_BASE\/backups\/controlspfile\/snapcf_RACORA1.f\"\r\n\r\nDATAFILES_DEST=\"$ORACLE_BASE\/backups\/datafiles\/%d_%T_s%s_s%p\" \r\nARCHIVELOGS_DEST=\"$ORACLE_BASE\/backups\/archivelogs\/%d_%T_s%s_s%p\" \r\n\r\nMAXPIECESIZE=\"4G\"\r\n\r\n[oracle@rac1 ~]$ cat \/u01\/app\/oracle\/backups\/scripts\/rmanbackup.sh\r\n#!\/bin\/bash\r\n\r\nsource ~\/.bash_profile # $ORACLE_HOME and $ORACLE_SID should be exported here\r\n\r\nsource $ORACLE_BASE\/backups\/scripts\/conf\/rmanbackup.cfg\r\n\r\nrman target \/ nocatalog &lt;&lt;EOF\r\nCONFIGURE RETENTION POLICY TO REDUNDANCY $REDUNDANCY; \r\nCONFIGURE CONTROLFILE AUTOBACKUP $CONTROLFILE_AUTOBACKUP; \r\nCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$CONTROLFILE_AUTOBACKUP_FORMAT'; \r\nCONFIGURE DEVICE TYPE DISK PARALLELISM $PARALLELISM BACKUP TYPE TO $BACKUPSET_TYPE; \r\nCONFIGURE COMPRESSION ALGORITHM '$COMPRESSION_ALGORITHM'; \r\nCONFIGURE SNAPSHOT CONTROLFILE NAME TO '$SNAPSHOT_CONTROLFILE'; \r\nCONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '$DATAFILES_DEST' MAXPIECESIZE $MAXPIECESIZE;\r\nexit;\r\nEOF\r\nexit<\/pre>\n<p>We set the script as executable and launch the script to test it:<br \/>\n&nbsp;<\/p>\n<pre>\r\n[oracle@rac1 ~]$ chmod +x \/u01\/app\/oracle\/backups\/scripts\/rmanbackup.sh\r\n[oracle@rac1 ~]$ \/u01\/app\/oracle\/backups\/scripts\/rmanbackup.sh\r\n\r\n\r\nRecovery Manager: Release 11.2.0.1.0 - Production on Fri Jul 8 14:24:24 2011\r\n\r\nCopyright (c) 1982, 2009, Oracle and\/or its affiliates.  All rights reserved.\r\n\r\nconnected to target database: RACORA (DBID=4104435745)\r\nusing target database control file instead of recovery catalog\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE RETENTION POLICY TO REDUNDANCY 1;\r\nnew RMAN configuration parameters:\r\nCONFIGURE RETENTION POLICY TO REDUNDANCY 1;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE CONTROLFILE AUTOBACKUP ON;\r\nnew RMAN configuration parameters:\r\nCONFIGURE CONTROLFILE AUTOBACKUP ON;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '\/u01\/app\/oracle\/backups\/controlspfile\/%F';\r\nnew RMAN configuration parameters:\r\nCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '\/u01\/app\/oracle\/backups\/controlspfile\/%F';\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\n\r\nold RMAN configuration parameters:\r\nCONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;\r\nnew RMAN configuration parameters:\r\nCONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nnew RMAN configuration parameters:\r\nCONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE SNAPSHOT CONTROLFILE NAME TO '\/u01\/app\/oracle\/backups\/controlspfile\/snapcf_RACORA1.f';\r\nnew RMAN configuration parameters:\r\nCONFIGURE SNAPSHOT CONTROLFILE NAME TO '\/u01\/app\/oracle\/backups\/controlspfile\/snapcf_RACORA1.f';\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '\/u01\/app\/oracle\/backups\/datafiles\/%d_%T_s%s_s%p' MAXPIECESIZE 4 G;\r\nnew RMAN configuration parameters:\r\nCONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '\/u01\/app\/oracle\/backups\/datafiles\/%d_%T_s%s_s%p' MAXPIECESIZE 4 G;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\n\r\nRecovery Manager complete.<\/pre>\n<p>Then, we can add the backup commands, one for the full backup. The backup commands are, as shown on \u201cmy Oracle Cookbook\u201d:<br \/>\n&nbsp;<\/p>\n<pre>\r\nbackup database plus archivelog;\r\nbackup archivelog all delete input;<\/pre>\n<p>But we want to decide on the same script if we&#8217;re going to backup the full database (and the archivelogs to recover the datafiles up to the backup&#8217;s SCN) or just the archivelogs. So we&#8217;ll have to parse the option to the script as an argument. <\/p>\n<p>The final resulting script will be:<br \/>\n&nbsp;<\/p>\n<pre>\r\n#!\/bin\/bash\r\n\r\nsource ~\/.bash_profile # $ORACLE_HOME and $ORACLE_SID should be exported here\r\n\r\nsource $ORACLE_BASE\/backups\/scripts\/conf\/rmanbackup.cfg\r\n\r\nusage() {\r\n        echo `basename $0`: ERROR: $* 1>&2\r\n        echo usage: `basename $0` '[-[af]]' 1>&2\r\n        exit 1\r\n}\r\n\r\ncase \"$1\" in\r\n        -a) BACKUP_TYPE=\"archivelog all format '$ARCHIVELOGS_DEST' delete input\";;\r\n        -f) BACKUP_TYPE=\"database plus archivelog\";;\r\n        *) usage ;; \r\nesac\r\n\r\nrman target \/ nocatalog &lt;&lt;EOF\r\nCONFIGURE RETENTION POLICY TO REDUNDANCY $REDUNDANCY; \r\nCONFIGURE CONTROLFILE AUTOBACKUP $CONTROLFILE_AUTOBACKUP; \r\nCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$CONTROLFILE_AUTOBACKUP_FORMAT'; \r\nCONFIGURE DEVICE TYPE DISK PARALLELISM $PARALLELISM BACKUP TYPE TO $BACKUPSET_TYPE; \r\nCONFIGURE COMPRESSION ALGORITHM '$COMPRESSION_ALGORITHM'; \r\nCONFIGURE SNAPSHOT CONTROLFILE NAME TO '$SNAPSHOT_CONTROLFILE'; \r\nCONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '$DATAFILES_DEST' MAXPIECESIZE $MAXPIECESIZE;\r\nbackup $BACKUP_TYPE;\r\nexit;\r\nEOF\r\nexit<\/pre>\n<p>With the configuration file as follows:<br \/>\n&nbsp;<\/p>\n<pre>\r\n[oracle@rac1 ~]$ cat \/u01\/app\/oracle\/backups\/scripts\/conf\/rmanbackup.cfg\r\n# how many days we want to keep backups on disk before RMAN deletes them\r\nREDUNDANCY=1\r\n\r\n# enable\/disable automatic backup of spfile and controlfile\r\nCONTROLFILE_AUTOBACKUP=\"ON\"\r\n\r\n# string with the destination of the automatic backup of the spfile and controlfile\r\nCONTROLFILE_AUTOBACKUP_FORMAT=\"$ORACLE_BASE\/backups\/controlspfile\/%F\"\r\n\r\n# Define parallelism degree by an integer (only usable on Enterprise Edition)\r\nPARALLELISM=1 \r\n\r\n# and if the backupset is going to be compressed.\r\nBACKUPSET_TYPE=\"COMPRESSED BACKUPSET\"\r\n\r\n# Set the compression program. (Why not to use bz2 for compression? ;-)\r\nCOMPRESSION_ALGORITHM=\"BASIC\"\r\n\r\n# Set the destination of the snapshot control file to be kept on the backups. \r\nSNAPSHOT_CONTROLFILE=\"$ORACLE_BASE\/backups\/controlspfile\/snapcf_RACORA1.f\"\r\n\r\nDATAFILES_DEST=\"$ORACLE_BASE\/backups\/datafiles\/%d_%T_s%s_s%p\" \r\nARCHIVELOGS_DEST=\"$ORACLE_BASE\/backups\/archivelogs\/%d_%T_s%s_s%p\" \r\n\r\nMAXPIECESIZE=\"4G\"<\/pre>\n<p>And it&#8217;s done! If you have a multi-instance RAC, you&#8217;d need to add the paramaters $ORACLE_HOME and $ORACLE_SID to the logic of the script as well for configuring RMAN to connect to a catalog database, but we&#8217;ll keep that for another posts ^_^.<\/p>\n<p>Let&#8217;s test the scripts:<br \/>\n&nbsp;<\/p>\n<pre>\r\n[oracle@rac1 ~]$ \/u01\/app\/oracle\/backups\/scripts\/rmanbackup.sh\r\nrmanbackup.sh: ERROR:\r\nusage: rmanbackup.sh [-[af]]<\/pre>\n<p>With \u201c-a\u201d for archivelog backup:<br \/>\n&nbsp;<\/p>\n<pre>\r\n[oracle@rac1 ~]$ \/u01\/app\/oracle\/backups\/scripts\/rmanbackup.sh -a\r\n\r\nRecovery Manager: Release 11.2.0.1.0 - Production on Fri Jul 8 16:36:42 2011\r\n\r\nCopyright (c) 1982, 2009, Oracle and\/or its affiliates.  All rights reserved.\r\n\r\nconnected to target database: RACORA (DBID=4104435745)\r\nusing target database control file instead of recovery catalog\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE RETENTION POLICY TO REDUNDANCY 1;\r\nnew RMAN configuration parameters:\r\nCONFIGURE RETENTION POLICY TO REDUNDANCY 1;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE CONTROLFILE AUTOBACKUP ON;\r\nnew RMAN configuration parameters:\r\nCONFIGURE CONTROLFILE AUTOBACKUP ON;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '\/u01\/app\/oracle\/backups\/controlspfile\/%F';\r\nnew RMAN configuration parameters:\r\nCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '\/u01\/app\/oracle\/backups\/controlspfile\/%F';\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;\r\nnew RMAN configuration parameters:\r\nCONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;\r\nnew RMAN configuration parameters:\r\nCONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE SNAPSHOT CONTROLFILE NAME TO '\/u01\/app\/oracle\/backups\/controlspfile\/snapcf_RACORA1.f';\r\nnew RMAN configuration parameters:\r\nCONFIGURE SNAPSHOT CONTROLFILE NAME TO '\/u01\/app\/oracle\/backups\/controlspfile\/snapcf_RACORA1.f';\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '\/u01\/app\/oracle\/backups\/datafiles\/%d_%T_s%s_s%p' MAXPIECESIZE 4 G;\r\nnew RMAN configuration parameters:\r\nCONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '\/u01\/app\/oracle\/backups\/datafiles\/%d_%T_s%s_s%p' MAXPIECESIZE 4 G;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nStarting backup at 08-JUL-11\r\ncurrent log archived\r\nallocated channel: ORA_DISK_1\r\nchannel ORA_DISK_1: SID=35 instance=RACORA1 device type=DISK\r\nchannel ORA_DISK_1: starting compressed archived log backup set\r\nchannel ORA_DISK_1: specifying archived log(s) in backup set\r\ninput archived log thread=1 sequence=27 RECID=2 STAMP=755700601\r\ninput archived log thread=2 sequence=13 RECID=1 STAMP=755696179\r\ninput archived log thread=1 sequence=28 RECID=3 STAMP=755780576\r\ninput archived log thread=1 sequence=29 RECID=4 STAMP=755955454\r\ninput archived log thread=1 sequence=30 RECID=5 STAMP=755973413\r\nchannel ORA_DISK_1: starting piece 1 at 08-JUL-11\r\nchannel ORA_DISK_1: finished piece 1 at 08-JUL-11\r\npiece handle=\/u01\/app\/oracle\/backups\/archivelogs\/RACORA_20110708_s1_s1 tag=TAG20110708T163654 comment=NONE\r\nchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:08\r\nchannel ORA_DISK_1: deleting archived log(s)\r\narchived log file name=+DATA\/racora\/archivelog\/1_27_729858920.dbf RECID=2 STAMP=755700601\r\narchived log file name=\/u01\/app\/oracle\/product\/11.2.0\/db_1\/dbs\/arch2_13_729858920.dbf RECID=1 STAMP=755696179\r\narchived log file name=+DATA\/racora\/archivelog\/1_28_729858920.dbf RECID=3 STAMP=755780576\r\narchived log file name=+DATA\/racora\/archivelog\/1_29_729858920.dbf RECID=4 STAMP=755955454\r\narchived log file name=+DATA\/racora\/archivelog\/1_30_729858920.dbf RECID=5 STAMP=755973413\r\nFinished backup at 08-JUL-11\r\n\r\nStarting Control File and SPFILE Autobackup at 08-JUL-11\r\npiece handle=\/u01\/app\/oracle\/backups\/controlspfile\/c-4104435745-20110708-00 comment=NONE\r\nFinished Control File and SPFILE Autobackup at 08-JUL-11\r\n\r\nRMAN> \r\nRMAN> \r\n\r\nRecovery Manager complete.<\/pre>\n<p>And with \u201c-f\u201d for full database backup:<br \/>\n&nbsp;<\/p>\n<pre>\r\n[oracle@rac1 ~]$ \/u01\/app\/oracle\/backups\/scripts\/rmanbackup.sh -f\r\n\r\nRecovery Manager: Release 11.2.0.1.0 - Production on Fri Jul 8 16:40:05 2011\r\n\r\nCopyright (c) 1982, 2009, Oracle and\/or its affiliates.  All rights reserved.\r\n\r\nconnected to target database: RACORA (DBID=4104435745)\r\nusing target database control file instead of recovery catalog\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE RETENTION POLICY TO REDUNDANCY 1;\r\nnew RMAN configuration parameters:\r\nCONFIGURE RETENTION POLICY TO REDUNDANCY 1;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE CONTROLFILE AUTOBACKUP ON;\r\nnew RMAN configuration parameters:\r\nCONFIGURE CONTROLFILE AUTOBACKUP ON;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '\/u01\/app\/oracle\/backups\/controlspfile\/%F';\r\nnew RMAN configuration parameters:\r\nCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '\/u01\/app\/oracle\/backups\/controlspfile\/%F';\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;\r\nnew RMAN configuration parameters:\r\nCONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;\r\nnew RMAN configuration parameters:\r\nCONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE SNAPSHOT CONTROLFILE NAME TO '\/u01\/app\/oracle\/backups\/controlspfile\/snapcf_RACORA1.f';\r\nnew RMAN configuration parameters:\r\nCONFIGURE SNAPSHOT CONTROLFILE NAME TO '\/u01\/app\/oracle\/backups\/controlspfile\/snapcf_RACORA1.f';\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\nold RMAN configuration parameters:\r\nCONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '\/u01\/app\/oracle\/backups\/datafiles\/%d_%T_s%s_s%p' MAXPIECESIZE 4 G;\r\nnew RMAN configuration parameters:\r\nCONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '\/u01\/app\/oracle\/backups\/datafiles\/%d_%T_s%s_s%p' MAXPIECESIZE 4 G;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN> \r\n\r\nStarting backup at 08-JUL-11\r\ncurrent log archived\r\nallocated channel: ORA_DISK_1\r\nchannel ORA_DISK_1: SID=35 instance=RACORA1 device type=DISK\r\nchannel ORA_DISK_1: starting compressed archived log backup set\r\nchannel ORA_DISK_1: specifying archived log(s) in backup set\r\ninput archived log thread=1 sequence=31 RECID=6 STAMP=755973614\r\nchannel ORA_DISK_1: starting piece 1 at 08-JUL-11\r\nchannel ORA_DISK_1: finished piece 1 at 08-JUL-11\r\npiece handle=\/u01\/app\/oracle\/backups\/datafiles\/RACORA_20110708_s3_s1 tag=TAG20110708T164015 comment=NONE\r\nchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01\r\nFinished backup at 08-JUL-11\r\n\r\nStarting backup at 08-JUL-11\r\nusing channel ORA_DISK_1\r\nchannel ORA_DISK_1: starting compressed full datafile backup set\r\nchannel ORA_DISK_1: specifying datafile(s) in backup set\r\ninput datafile file number=00001 name=+DATA\/racora\/datafile\/system.260.729858643\r\ninput datafile file number=00002 name=+DATA\/racora\/datafile\/sysaux.261.729858653\r\ninput datafile file number=00003 name=+DATA\/racora\/datafile\/undotbs1.269.729858657\r\ninput datafile file number=00005 name=+DATA\/racora\/datafile\/example.263.729858985\r\ninput datafile file number=00006 name=+DATA\/racora\/datafile\/undotbs2.262.729859525\r\ninput datafile file number=00004 name=+DATA\/racora\/datafile\/users.268.729858659\r\nchannel ORA_DISK_1: starting piece 1 at 08-JUL-11\r\nchannel ORA_DISK_1: finished piece 1 at 08-JUL-11\r\npiece handle=\/u01\/app\/oracle\/backups\/datafiles\/RACORA_20110708_s4_s1 tag=TAG20110708T164017 comment=NONE\r\nchannel ORA_DISK_1: backup set complete, elapsed time: 00:02:07\r\nFinished backup at 08-JUL-11\r\n\r\nStarting backup at 08-JUL-11\r\ncurrent log archived\r\nusing channel ORA_DISK_1\r\nchannel ORA_DISK_1: starting compressed archived log backup set\r\nchannel ORA_DISK_1: specifying archived log(s) in backup set\r\ninput archived log thread=1 sequence=32 RECID=7 STAMP=755973746\r\nchannel ORA_DISK_1: starting piece 1 at 08-JUL-11\r\nchannel ORA_DISK_1: finished piece 1 at 08-JUL-11\r\npiece handle=\/u01\/app\/oracle\/backups\/datafiles\/RACORA_20110708_s5_s1 tag=TAG20110708T164226 comment=NONE\r\nchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01\r\nFinished backup at 08-JUL-11\r\n\r\nStarting Control File and SPFILE Autobackup at 08-JUL-11\r\npiece handle=\/u01\/app\/oracle\/backups\/controlspfile\/c-4104435745-20110708-01 comment=NONE\r\nFinished Control File and SPFILE Autobackup at 08-JUL-11\r\n\r\nRMAN> \r\nRMAN> \r\n\r\nRecovery Manager complete.<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This guide is intended for Oracle Database medium\/high level administrators to have a reference for creating RMAN scripts from the scratch, based on retention policies for physical backups on databases in archive log mode. [note]If we&#8217;re planning to backup an Oracle RAC database, we&#8217;d like to have the scripts we&#8217;ll create replicated in all the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/selectsysdatefromdual.gnusystems.net\/index.php?rest_route=\/wp\/v2\/posts\/71"}],"collection":[{"href":"https:\/\/selectsysdatefromdual.gnusystems.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/selectsysdatefromdual.gnusystems.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/selectsysdatefromdual.gnusystems.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/selectsysdatefromdual.gnusystems.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=71"}],"version-history":[{"count":26,"href":"https:\/\/selectsysdatefromdual.gnusystems.net\/index.php?rest_route=\/wp\/v2\/posts\/71\/revisions"}],"predecessor-version":[{"id":97,"href":"https:\/\/selectsysdatefromdual.gnusystems.net\/index.php?rest_route=\/wp\/v2\/posts\/71\/revisions\/97"}],"wp:attachment":[{"href":"https:\/\/selectsysdatefromdual.gnusystems.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=71"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/selectsysdatefromdual.gnusystems.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=71"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/selectsysdatefromdual.gnusystems.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=71"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}