This example assumes that the target database is not configured with and will not be using any configured defaults (i.e. automatic channels). The following will perform an offline backup. Notice that you can use RMAN to shutdown and startup the database (which is required for performing an offline backup):% rman target / RMAN> shutdown RMAN> startup mount RMAN> run { 2> allocate channel c1 device type disk format '/orabackup/rman/TARGDB/backup_db_%d_S_%s_P_%p_T_%t'; 3> allocate channel c2 device type disk format '/orabackup/rman/TARGDB/backup_db_%d_S_%s_P_%p_T_%t'; 4> setlimit channel c1 maxpiecesize 25m; 5> set maxcorrupt for datafile 1 to 0; 6> backup full 7> skip inaccessible 8> tag rman_backup_hot_full 9> filesperset 4 10> (database include current controlfile); 11> # backup current controlfile; 12> } allocated channel: c1 channel c1: sid=13 devtype=DISK allocated channel: c2 channel c2: sid=14 devtype=DISK executing command: SET MAX CORRUPT Starting backup at 22-DEC-04 channel c1: starting full datafile backupset channel c1: specifying datafile(s) in backupset input datafile fno=00011 name=/u06/app/oradata/TARGDB/perfstat01.dbf input datafile fno=00007 name=/u06/app/oradata/TARGDB/example01.dbf input datafile fno=00004 name=/u06/app/oradata/TARGDB/drsys01.dbf input datafile fno=00006 name=/u06/app/oradata/TARGDB/xdb01.dbf channel c1: starting piece 1 at 22-DEC-04 channel c2: starting full datafile backupset channel c2: specifying datafile(s) in backupset input datafile fno=00002 name=/u06/app/oradata/TARGDB/undotbs01.dbf input datafile fno=00003 name=/u06/app/oradata/TARGDB/cwmlite01.dbf input datafile fno=00005 name=/u06/app/oradata/TARGDB/odm01.dbf input datafile fno=00008 name=/u06/app/oradata/TARGDB/indx01.dbf channel c2: starting piece 1 at 22-DEC-04 channel c1: finished piece 1 at 22-DEC-04 piece handle=/orabackup/rman/TARGDB/backup_db_TARGDB_S_18_P_1_T_545604600 comment=NONE channel c1: starting piece 2 at 22-DEC-04 channel c1: finished piece 2 at 22-DEC-04 piece handle=/orabackup/rman/TARGDB/backup_db_TARGDB_S_18_P_2_T_545604600 comment=NONE channel c1: starting piece 3 at 22-DEC-04 channel c1: finished piece 3 at 22-DEC-04 piece handle=/orabackup/rman/TARGDB/backup_db_TARGDB_S_18_P_3_T_545604600 comment=NONE channel c1: starting piece 4 at 22-DEC-04 channel c1: finished piece 4 at 22-DEC-04 piece handle=/orabackup/rman/TARGDB/backup_db_TARGDB_S_18_P_4_T_545604600 comment=NONE channel c1: starting piece 5 at 22-DEC-04 channel c1: finished piece 5 at 22-DEC-04 piece handle=/orabackup/rman/TARGDB/backup_db_TARGDB_S_18_P_5_T_545604600 comment=NONE channel c1: starting piece 6 at 22-DEC-04 channel c2: finished piece 1 at 22-DEC-04 piece handle=/orabackup/rman/TARGDB/backup_db_TARGDB_S_19_P_1_T_545604600 comment=NONE channel c2: backup set complete, elapsed time: 00:02:11 channel c2: starting full datafile backupset channel c2: specifying datafile(s) in backupset including current controlfile in backupset input datafile fno=00001 name=/u06/app/oradata/TARGDB/system01.dbf input datafile fno=00009 name=/u06/app/oradata/TARGDB/tools01.dbf input datafile fno=00010 name=/u06/app/oradata/TARGDB/users01.dbf channel c2: starting piece 1 at 22-DEC-04 channel c1: finished piece 6 at 22-DEC-04 piece handle=/orabackup/rman/TARGDB/backup_db_TARGDB_S_18_P_6_T_545604600 comment=NONE channel c1: backup set complete, elapsed time: 00:02:14 channel c2: finished piece 1 at 22-DEC-04 piece handle=/orabackup/rman/TARGDB/backup_db_TARGDB_S_20_P_1_T_545604731 comment=NONE channel c2: backup set complete, elapsed time: 00:01:58 Finished backup at 22-DEC-04 Starting Control File and SPFILE Autobackup at 22-DEC-04 piece handle=/orabackup/rman/TARGDB/c-2528050866-20041222-04 comment=NONE Finished Control File and SPFILE Autobackup at 22-DEC-04 released channel: c2 released channel: c1 RMAN> exit; % ls -l /orabackup/rman/TARGDB/* -rw-r----- 1 oracle dba 26214400 Dec 22 20:50 backup_db_TARGDB_S_18_P_1_T_545604600 -rw-r----- 1 oracle dba 26214400 Dec 22 20:50 backup_db_TARGDB_S_18_P_2_T_545604600 -rw-r----- 1 oracle dba 26214400 Dec 22 20:51 backup_db_TARGDB_S_18_P_3_T_545604600 -rw-r----- 1 oracle dba 26214400 Dec 22 20:51 backup_db_TARGDB_S_18_P_4_T_545604600 -rw-r----- 1 oracle dba 26214400 Dec 22 20:51 backup_db_TARGDB_S_18_P_5_T_545604600 -rw-r----- 1 oracle dba 19333120 Dec 22 20:52 backup_db_TARGDB_S_18_P_6_T_545604600 -rw-r----- 1 oracle dba 343392256 Dec 22 20:52 backup_db_TARGDB_S_19_P_1_T_545604600 -rw-r----- 1 oracle dba 331636736 Dec 22 20:54 backup_db_TARGDB_S_20_P_1_T_545604731 -rw-r----- 1 oracle dba 7946240 Dec 22 20:54 c-2528050866-20041222-04Observations
- Notice first, that like all offline backups, we need to first shutdown and startup (mount) the database. This can all be done within the RMAN session.
- Next, we have a run block, which will contain one or more statements contained within the braces and all will execute as one block. Oracle will not run any of the commands within the braces of the run block until all statements have been entered. The run block is completed with the closing brace, at which time Oracle will be compiled and executed.
- Then we see the allocate channel statements. In this example, we have two channels allocated. Each time a you create a channel, Oracle will create one or more backup sets for that one channel. In most cases, each channel will create one backup set - but it is possible to have a channel create more than one backup set. In this example, I will show that my configuration will be the exception to the rule and it will create multiple backup sets for one channel. You show also notice that with each channel, I can define the format it will use for each backup piece.
- Now that I created two channels, RMAN will automatically try to parallelize the backup stream amoung those channels.
- When using multiple channels, you can configure and control the maximum piece size, read rate, rate, and maximum open files for each backup piece by using the channel name you assigned to it. In my example, I have two defined channels - c1 and c2.
- I put no limits on the second channel c2.
- You will notice that I did define limits on the first channel c1. In this example, I am asking RMAN to limit each backup piece to 25MB. This can be seen with the listing that I do after the backup has completed. Notice that each backup piece in backup set 18 is a maximum of 25MB in size. When writting to the backup piece, once it hit 25MB, RMAN will start another backup piece. In the listing you can see that all together, that channel c1 created 6 backup pieces.
- Notice that with the backup command, I am including many options and that it spans several lines. One of the key options I would like to point out is filesperset 4. This is the exception to the rule "one channel will create one backup set" that I talked about earlier. With the filesperset option, I am telling RMAN that I only want a maximum of 4 Oracle datafiles to be backed in each backup set. Looking at the listing I performed (and the output of the RMAN run), you will see that RMAN created two backup sets for channel c2 to store a total of 7 Oracle datafiles:
Also note that the filesperset 4 option I provided in the backup command applies to all channels in the backup. As a note, notice that channel c1 creates one backup set with 4 Oracle datafiles.
- Backup Set 19
- /u06/app/oradata/TARGDB/undotbs01.dbf
- /u06/app/oradata/TARGDB/cwmlite01.dbf
- /u06/app/oradata/TARGDB/odm01.dbf
- /u06/app/oradata/TARGDB/indx01.dbf
- Backup Set 20
- /u06/app/oradata/TARGDB/system01.dbf
- /u06/app/oradata/TARGDB/tools01.dbf
- /u06/app/oradata/TARGDB/users01.dbf
- Backup Set 18
- /u06/app/oradata/TARGDB/perfstat01.dbf
- /u06/app/oradata/TARGDB/example01.dbf
- /u06/app/oradata/TARGDB/drsys01.dbf
- /u06/app/oradata/TARGDB/xdb01.dbf
Monday, 26 November 2012
RMAN Offline Backup - (without using configured defaults)
Subscribe to:
Post Comments (Atom)
1 comment:
ReplyDelete