A lesser known 11g New Feature is the option to backup and restore single large datafiles with multiple channels in parallel, which can speed up these processes dramatically. This posting is supposed to give an example for it.
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL> select file#,bytes/1024/1024 as mb from v$datafile;
FILE# MB
---------- ----------
1 300
2 200
3 179
4 2136
My demo system is on 11gR2, but the feature was there in 11gR1 already – it is easy to miss and just keep the old backup scripts in place like with 10g, though, where one channel could only read one datafile. bk is the same service that we have seen in a previous posting. I will now just backup & restore datafile 4 to show this can be done with two channels:
[oracle@uhesse1 ~]$ time rman target sys/oracle@uhesse1/bk cmdfile=backup_par.rmn
Recovery Manager: Release 11.2.0.3.0 - Production on Wed Dec 12 21:20:49 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PRIMA (DBID=2003897072)
RMAN> configure device type disk parallelism 2;
2> backup datafile 4 section size 1100m;
3>
using target database control file instead of recovery catalog
old RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored
Starting backup at 2012-12-12:21:20:50
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=9 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/home/oracle/prima/users01.dbf
backing up blocks 1 through 140800
channel ORA_DISK_1: starting piece 1 at 2012-12-12:21:20:51
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00004 name=/home/oracle/prima/users01.dbf
backing up blocks 140801 through 273408
channel ORA_DISK_2: starting piece 2 at 2012-12-12:21:20:51
channel ORA_DISK_2: finished piece 2 at 2012-12-12:21:21:46
piece handle=/home/oracle/flashback/PRIMA/backupset/2012_12_12/o1_mf_nnndf_TAG20121212T212051_8dkss3kr_.bkp tag=TAG20121212T212051 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:55
channel ORA_DISK_1: finished piece 1 at 2012-12-12:21:22:06
piece handle=/home/oracle/flashback/PRIMA/backupset/2012_12_12/o1_mf_nnndf_TAG20121212T212051_8dkss3bm_.bkp tag=TAG20121212T212051 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
Finished backup at 2012-12-12:21:22:06
Recovery Manager complete.
real 1m17.681s
user 0m1.356s
sys 0m0.129s
The script backup_par.rmn contains these lines:
[oracle@uhesse1 ~]$ cat backup_par.rmn
configure device type disk parallelism 2;
backup datafile 4 section size 1100m;
As you can see, the two channels were running in parallel, each taking about 1 minute to backup its section into a separate backupset. Also the restore can now be done in parallel for a single datafile:
[oracle@uhesse1 ~]$ time rman target sys/oracle@uhesse1/bk cmdfile=restore_par.rmn
Recovery Manager: Release 11.2.0.3.0 - Production on Wed Dec 12 21:23:28 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PRIMA (DBID=2003897072)
RMAN> configure device type disk parallelism 2;
2> sql "alter database datafile 4 offline";
3> restore datafile 4;
4> recover datafile 4;
5> sql "alter database datafile 4 online";
6>
7>
using target database control file instead of recovery catalog
old RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored
sql statement: alter database datafile 4 offline
Starting restore at 2012-12-12:21:23:30
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=9 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=24 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00004 to /home/oracle/prima/users01.dbf
channel ORA_DISK_1: restoring section 1 of 2
channel ORA_DISK_1: reading from backup piece /home/oracle/flashback/PRIMA/backupset/2012_12_12/o1_mf_nnndf_TAG20121212T212051_8dkss3bm_.bkp
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00004 to /home/oracle/prima/users01.dbf
channel ORA_DISK_2: restoring section 2 of 2
channel ORA_DISK_2: reading from backup piece /home/oracle/flashback/PRIMA/backupset/2012_12_12/o1_mf_nnndf_TAG20121212T212051_8dkss3kr_.bkp
channel ORA_DISK_2: piece handle=/home/oracle/flashback/PRIMA/backupset/2012_12_12/o1_mf_nnndf_TAG20121212T212051_8dkss3kr_.bkp tag=TAG20121212T212051
channel ORA_DISK_2: restored backup piece 2
channel ORA_DISK_2: restore complete, elapsed time: 00:02:05
channel ORA_DISK_1: piece handle=/home/oracle/flashback/PRIMA/backupset/2012_12_12/o1_mf_nnndf_TAG20121212T212051_8dkss3bm_.bkp tag=TAG20121212T212051
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:16
Finished restore at 2012-12-12:21:25:46
Starting recover at 2012-12-12:21:25:46
using channel ORA_DISK_1
using channel ORA_DISK_2
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 2012-12-12:21:25:48
sql statement: alter database datafile 4 online
Recovery Manager complete.
real 2m20.137s
user 0m1.229s
sys 0m0.187s
This is the script I have used for the restore:
[oracle@uhesse1 ~]$ cat restore_par.rmn
configure device type disk parallelism 2;
sql "alter database datafile 4 offline";
restore datafile 4;
recover datafile 4;
sql "alter database datafile 4 online";
Conclusion: Multisection backup & restore can be very useful for the processing of large (bigfile) datafiles with multiple channels in parallel. If you have not done it yet, you should definitely give it a try! As always: Don’t believe it, test it 🙂
Addendum: With 12c, this feature got enhanced to support also image copies.
#1 von bdrouvot am Dezember 13, 2012 - 10:01
Good idea Uwe to remind us about this feature.
#2 von Ahmet am Dezember 15, 2012 - 09:34
Thanks Uwe
#3 von Uwe Hesse am Dezember 19, 2012 - 09:35
Bertrand and Ahmet, you’re welcome 🙂 Thanks for leaving that nice feedback!
#4 von Naveen am Dezember 26, 2012 - 01:01
Thanks Uwe. Would it(parallelism) work with „backup copy“ too?
#5 von Uwe Hesse am Januar 6, 2013 - 11:17
Naveen, no, you get RMAN-06580: the SECBYTES option cannot be used with AS COPY
in this case (trying to combine SECTION SIZE and AS COPY). At least with 11.2.0.3 as I just tested 🙂
#6 von Shankar am November 24, 2014 - 16:48
It is possible to set same path for multiple channels and do a backup and recovery using rman in oracle 11.2.0.1
eg
Channel 1 – /ora/backup1
Channel 2 – /ora/backup1
#7 von Uwe Hesse am Dezember 3, 2014 - 09:53
Yes, that is possible – I do that in the posting, using the recovery area as the destination folder for both channels.