Friday, February 28, 2014

Parallel Backup of the Same Datafile In Oracle 11g Release 2 (Using RMAN)



You probably already know that you can parallelize the backup by declaring more than one channel so that each channel becomes a RMAN session. However, very few realize that each channel can back up only one datafile at a time. So even through there are several channels, each datafile is backed by only one channel, somewhat contrary to the perception that the backup is truly parallel.

In Oracle Database 11g RMAN, the channels can break the datafiles into chunks known as "sections." You can specify the size of each section. Here's an example:

[oracle@dg1 ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Fri Feb 28 01:38:21 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: OCP (DBID=2733899832)

RMAN> run {
2> allocate channel c1 type disk format '/tmp/backup/%U';
3> allocate channel c2 type disk format '/tmp/backup/%U';
4> backup section size 100M datafile 1;
5> release channel c1;
6> release channel c2;
7> }

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=19 device type=DISK

allocated channel: c2
channel c2: SID=36 device type=DISK

Starting backup at 28-FEB-14
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/OCP/system01.dbf
backing up blocks 1 through 12800
channel c1: starting piece 1 at 28-FEB-14
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
including current control file in backup set
channel c2: starting piece 1 at 28-FEB-14
channel c2: finished piece 1 at 28-FEB-14
piece handle=/tmp/backup/0ep1nejf_1_1 tag=TAG20140228T013958 comment=NONE
..........
channel c2: finished piece 1 at 28-FEB-14
piece handle=/tmp/backup/0mp1nekn_1_1 tag=TAG20140228T013958 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:01
channel c1: finished piece 8 at 28-FEB-14
piece handle=/tmp/backup/0dp1nejf_8_1 tag=TAG20140228T013958 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:04
Finished backup at 28-FEB-14

released channel: c1

released channel: c2

This RMAN command allocates two channels and backs up the SYSTEM' tablespace in parallel on two channels. Each channel takes a 100MB section of the datafile and backs it up in parallel. This makes backup of large files faster.

When backed up this way, the backups show up as sections as well.
RMAN> list backup of datafile 1;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
10      Full    1.55G      DISK        00:02:27     27-FEB-14
        BP Key: 10   Status: AVAILABLE  Compressed: NO  Tag: TAG20140227T232051
        Piece Name: /tmp/backup/OCP/backupset/2014_02_27/o1_mf_nnndf_TAG20140227T232051_9jz0j5nv_.bkp
  List of Datafiles in backup set 10
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 6611490    27-FEB-14 /u01/app/oracle/oradata/OCP/system01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
13      Full    653.19M    DISK        00:00:41     28-FEB-14
  List of Datafiles in backup set 13
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 6664196    28-FEB-14 /u01/app/oracle/oradata/OCP/system01.dbf

  Backup Set Copy #1 of backup set 13
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:00:41     28-FEB-14       NO         TAG20140228T013958

    List of Backup Pieces for backup set 13 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    13      1   AVAILABLE   /tmp/backup/0dp1nejf_1_1
    14      2   AVAILABLE   /tmp/backup/0dp1nejf_2_1
    15      3   AVAILABLE   /tmp/backup/0dp1nejf_3_1
    16      4   AVAILABLE   /tmp/backup/0dp1nejf_4_1
    17      5   AVAILABLE   /tmp/backup/0dp1nejf_5_1
    19      6   AVAILABLE   /tmp/backup/0dp1nejf_6_1
    18      7   AVAILABLE   /tmp/backup/0dp1nejf_7_1
    21      8   AVAILABLE   /tmp/backup/0dp1nejf_8_1

Note how the pieces of the backup show up as sections of the file. As each section goes to a different channel, you can define them as different mount points (such as /tmp/backup and /tmp/backup), you can back them to tape in parallel as well.

However, if the large file #1 resides on only one disk, there is no advantage to using parallel backups. If you section this file, the disk head has to move constantly to address different sections of the file, outweighing the benefits of sectioning.

Note:  For more details contact dbaclass4u@gmail.com


No comments:

Post a Comment

Share your knowledge it really improves, don't show off...