SKIP Option
Excludes datafiles or archived redo logs from the backup set according to the criteria specified by the following keywords.
Note: You can also specify this option in the backupSpec clause.
OFFLINE
Specifies that offline datafiles shocould be excluded from the backup set.
READONLY
Specifies that read-only datafiles shocould be excluded from the backup set.
INACCESSIBLE
Specifies that datafiles or archived redo logs that cannot be read due to I/O errors shocould be excluded from the backup set.
A datafile is only considered inaccessible if it cannot be read. Some offline datafiles can be still be read because they still exist on disk. Others have been deleted or moved and
So cannot be read, making them inaccessible.
FILESPERSET = integer
Specifies the maximum number of input files in each backup set. If you set FILESPERSET = n, then RMAN never than DES more than n files in a backup set. The default
FILESPERSET is the lesser of these two values: 64, number of input files divided by the number of channels. For example, if you back up 100 datafiles by using two channels, RMAN
Sets FILESPERSET to 50.
RMAN always attempts to create enough backup sets so that all allocated channels have work to do. an exception to the rule occurs when there are more channels than files to back up. for example, if RMAN backs up two datafiles when three channels are allocated and FILESPERSET = 1, then one channel is necessarily idle.
Example:
The average number of files refers to the number of files/channels.
Allocate channel provides backup concurrency. If the average number of files <filesperset, backup is performed based on the average number of files/backup sets. If the number of files exceeds the limit, backup sets are generated based on the number of filesperset. For example:
1. run {
Allocate channel category type disk;
Allocate channel ch2 type disk;
Backup datafile 3, 4, 5, 6 filesperset 3;
Release channel identifier;
Release channel ch2;
}
The average value is 4 (number of files)/2 (number of channels) = 2. If the value is smaller than filesperset 3, two backup sets are generated. Each backup set contains two data files.
2. run {
Allocate channel category type disk;
Allocate channel ch2 type disk;
Backup datafile 3, 4, 5, 6 filesperset 1;
Release channel identifier;
Release channel ch2;
}
Generates four backup sets, each containing one data file
Rman nocatalog target sys/Oracle msglog rmanLog. out append -- append the command execution log to the rmanLog. out file. If no append exists, the existing rmanLog. out file is overwritten.
Backup script:
- ######################################## #################################
- # T_database_backup.sh ##
- # Created by Tianlesoftware ##
- #2010-7-16 ##
- ######################################## #################################
- #! /Bin/bash
- #---------------------------------------------------------------------------
- # Determine the user which is executing this script.
- #---------------------------------------------------------------------------
- CUSER = 'id | cut-d "("-f2 | cut-d ")"-f1'
- #---------------------------------------------------------------------------
- # Put output in <this file name>. out. Change as desired.
- # Note: output directory requires write permission.
- #---------------------------------------------------------------------------
- RMAN_LOG_FILE =$ {0}. out
- #---------------------------------------------------------------------------
- # You may want to delete the output file so that backup information does
- # Not accumulate. If not, delete the following lines.
- #---------------------------------------------------------------------------
- If [-f "$ RMAN_LOG_FILE"]
- Then
- Rm-f "$ RMAN_LOG_FILE"
- Fi
- #-----------------------------------------------------------------
- # Initialize the log file.
- #-----------------------------------------------------------------
- Echo> $ RMAN_LOG_FILE
- Chmod 666 $ RMAN_LOG_FILE
- #---------------------------------------------------------------------------
- # Log the start of this script.
- #---------------------------------------------------------------------------
- Echo Script {1 }>>$ RMAN_LOG_FILE
- Echo === started on 'date' ==>> $ RMAN_LOG_FILE
- Echo> $ RMAN_LOG_FILE
- #---------------------------------------------------------------------------
- # Oracle home path.
- #---------------------------------------------------------------------------
- ORACLE_HOME =/home/oracle/product/10.2.0/db_1
- Export ORACLE_HOME
- #---------------------------------------------------------------------------
- # The Oracle SID of the target database.
- #---------------------------------------------------------------------------
- ORACLE_SID = oralife
- Export ORACLE_SID
- #---------------------------------------------------------------------------
- # The Oracle DBA user id (account ).
- #---------------------------------------------------------------------------
- ORACLE_USER = oracle
- Export ORACLE_USER
- #---------------------------------------------------------------------------
- # Set the Oracle Recovery Manager name.
- #---------------------------------------------------------------------------
- RMAN = $ ORACLE_HOME/bin/rman
- #---------------------------------------------------------------------------
- # Print out the value of the variables set by this script.
- #---------------------------------------------------------------------------
- Echo> $ RMAN_LOG_FILE
- Echo "RMAN: $ RMAN" >>$ RMAN_LOG_FILE
- Echo "ORACLE_SID: $ ORACLE_SID" >>$ RMAN_LOG_FILE
- Echo "ORACLE_USER: $ ORACLE_USER" >>$ RMAN_LOG_FILE
- Echo "ORACLE_HOME: $ ORACLE_HOME" >>$ RMAN_LOG_FILE
- #---------------------------------------------------------------------------
- # Print out the value of the variables set by bphdb.
- #---------------------------------------------------------------------------
- # Echo> $ RMAN_LOG_FILE
- # Echo "NB_ORA_FULL: $ NB_ORA_FULL"> $ RMAN_LOG_FILE
- # Echo "NB_ORA_INCR: $ NB_ORA_INCR"> $ RMAN_LOG_FILE
- # Echo "NB_ORA_CINC: $ NB_ORA_CINC"> $ RMAN_LOG_FILE
- # Echo "NB_ORA_SERV: $ NB_ORA_SERV"> $ RMAN_LOG_FILE
- # Echo "NB_ORA_POLICY: $ NB_ORA_POLICY"> $ RMAN_LOG_FILE
- #---------------------------------------------------------------------------
- # NOTE: This script assumes that the database is properly opened. If desired,
- # This wocould be the place to verify that.
- #---------------------------------------------------------------------------
- Echo> $ RMAN_LOG_FILE
- #---------------------------------------------------------------------------
- #---------------------------------------------------------------------------
- # Call Recovery Manager to initiate the backup.
- #---------------------------------------------------------------------------
- Pai_str ="
- ORACLE_HOME = $ ORACLE_HOME
- Export ORACLE_HOME
- ORACLE_SID = $ ORACLE_SID
- Export ORACLE_SID
- $ RMAN nocatalog target sys/admin msglog $ RMAN_LOG_FILE append <EOF
- RUN {
- Allocate channel c1 type disk;
- Allocate channel c2 type disk;
- Backup format '/home/oracle/backup/oralife _ % U _ % t' skip inaccessible filesperset 5 database tag oralife_hot_db_bk;
- SQL 'alter system archive log current ';
- BACKUP format'/home/oracle/backup/arch _ % U _ % t' skip inaccessible filesperset 5 archivelog all delete input;
- Backup current controlfile tag = 'bak _ ctlfile 'format ='/home/oracle/backup/ctl_file _ % U _ % T ';
- Backup spfile tag = 'spfile' format = '/home/oracle/backup/oralife_spfile _ % U _ % T ';
- Release channel c2;
- Release channel c1;
- }
- Report obsolete;
- Delete noprompt obsolete;
- Crosscheck backup;
- Delete noprompt expired backup;
- List backup summary;
- # EOF
- "
- # Initiate the command string
- If ["$ CUSER" = "root"]
- Then
- Echo "Root Command String: $ CMD_STR" >>$ RMAN_LOG_FILE
- Su-$ ORACLE_USER-c "$ pai_str"> $ RMAN_LOG_FILE
- RSTAT = $?
- Else
- Echo "User Command String: $ pai_str" >>$ RMAN_LOG_FILE
- /Bin/sh-c "$ CMD_STR"> $ RMAN_LOG_FILE
- RSTAT = $?
- Fi
- #---------------------------------------------------------------------------
- # Log the completion of this script.
- #---------------------------------------------------------------------------
- If ["$ RSTAT" = "0"]
- Then
- LOGMSG = "ended successfully"
- Else
- LOGMSG = "ended in error"
- Fi
- Echo> $ RMAN_LOG_FILE
- Echo Script {1 }>>$ RMAN_LOG_FILE
- Echo ===$ LOGMSG on 'date' ====>> $ RMAN_LOG_FILE
- Echo> $ RMAN_LOG_FILE
- #/Bin/mailx-s "RMAN Backup SID" daimm@sf-express.com <$ RMAN_LOG_FILE
- Exit $ RSTAT
Email configuration...
Refer: