Chinaunix首页 | 论坛 | 博客
  • 博客访问: 11680325
  • 博文数量: 8065
  • 博客积分: 10002
  • 博客等级: 中将
  • 技术积分: 96708
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-16 17:06
文章分类

全部博文(8065)

文章存档

2008年(8065)

分类: 服务器与存储

2008-07-16 09:51:24

11g以前,Oracle并行备份的前提之一是存在多个需要备份的对象。也就是说对于一个大的表空间而言,即使分配了多个CHANNEL也无法并行备份。

11g改变了这种情况,Rman可以通过设置SECTION SIZE的方式来并行执行备份。

$ rman target /

Recovery Manager: Release 11.1.0.6.0 - Production on Fri Nov 23 16:13:41 2007

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: TEST11G (DBID=790993044)

RMAN> run
2> {
3> allocate channel c1 device type disk format '/data/backup/%U';
4> allocate channel c2 device type disk format '/data/backup/%U';
5> allocate channel c3 device type disk format '/data/backup/%U';
6> backup tablespace system;
7> }

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

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

allocated channel: c3
channel c3: SID=158 device type=DISK

Starting backup at 23-NOV-07
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/data/oracle/oradata/test11g/system01.dbf
channel c1: starting piece 1 at 23-NOV-07
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
channel c3: starting full datafile backup set
channel c3: specifying datafile(s) in backup set
including current SPFILE in backup set
channel c3: starting piece 1 at 23-NOV-07
channel c1: finished piece 1 at 23-NOV-07
piece handle=/data/backup/19j1pg3v_1_1 tag=TAG20071123T161454 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:55
including current control file in backup set
channel c2: starting piece 1 at 23-NOV-07
channel c2: finished piece 1 at 23-NOV-07
piece handle=/data/backup/1aj1pg4h_1_1 tag=TAG20071123T161454 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:02
channel c3: finished piece 1 at 23-NOV-07
piece handle=/data/backup/1bj1pg59_1_1 tag=TAG20071123T161454 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:02
Finished backup at 23-NOV-07
released channel: c1
released channel: c2
released channel: c3

RMAN> list backup of tablespace system;


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


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
41 Full 737.63M DISK 00:01:05 23-NOV-07
BP Key: 41 Status: AVAILABLE Compressed: NO Tag: TAG20071123T161454
Piece Name: /data/backup/19j1pg3v_1_1
List of Datafiles in backup set 41
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1120295 23-NOV-07 /data/oracle/oradata/test11g/system01.dbf

RMAN> run
2> {
3> allocate channel c1 device type disk format '/data/backup/%U';
4> allocate channel c2 device type disk format '/data/backup/%U';
5> allocate channel c3 device type disk format '/data/backup/%U';
6> backup section size 300m tablespace system;
7> }

allocated channel: c1
channel c1: SID=151 device type=DISK

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

allocated channel: c3
channel c3: SID=158 device type=DISK

Starting backup at 23-NOV-07
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/data/oracle/oradata/test11g/system01.dbf
backing up blocks 1 through 9600
channel c1: starting piece 1 at 23-NOV-07
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
channel c3: starting full datafile backup set
channel c3: specifying datafile(s) in backup set
including current SPFILE in backup set
channel c3: starting piece 1 at 23-NOV-07
channel c1: finished piece 1 at 23-NOV-07
piece handle=/data/backup/1cj1pgjq_1_1 tag=TAG20071123T162321 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:39
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/data/oracle/oradata/test11g/system01.dbf
backing up blocks 9601 through 19200
channel c1: starting piece 2 at 23-NOV-07
including current control file in backup set
channel c2: starting piece 1 at 23-NOV-07
channel c3: finished piece 1 at 23-NOV-07
piece handle=/data/backup/1ej1pgl1_1_1 tag=TAG20071123T162321 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:18
channel c3: starting full datafile backup set
channel c3: specifying datafile(s) in backup set
input datafile file number=00001 name=/data/oracle/oradata/test11g/system01.dbf
backing up blocks 19201 through 28800
channel c3: starting piece 3 at 23-NOV-07
channel c1: finished piece 2 at 23-NOV-07
piece handle=/data/backup/1cj1pgjq_2_1 tag=TAG20071123T162321 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:25
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/data/oracle/oradata/test11g/system01.dbf
backing up blocks 28801 through 32768
channel c1: starting piece 4 at 23-NOV-07
channel c2: finished piece 1 at 23-NOV-07
piece handle=/data/backup/1dj1pgkc_1_1 tag=TAG20071123T162321 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:46
channel c3: finished piece 3 at 23-NOV-07
piece handle=/data/backup/1cj1pgjq_3_1 tag=TAG20071123T162321 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:22
channel c1: finished piece 4 at 23-NOV-07
piece handle=/data/backup/1cj1pgjq_4_1 tag=TAG20071123T162321 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 23-NOV-07
released channel: c1
released channel: c2
released channel: c3

RMAN> list backup of tablespace system;


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


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
41 Full 737.63M DISK 00:01:05 23-NOV-07
BP Key: 41 Status: AVAILABLE Compressed: NO Tag: TAG20071123T161454
Piece Name: /data/backup/19j1pg3v_1_1
List of Datafiles in backup set 41
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1120295 23-NOV-07 /data/oracle/oradata/test11g/system01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
44 Full 738.09M DISK 00:02:01 23-NOV-07
List of Datafiles in backup set 44
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1120885 23-NOV-07 /data/oracle/oradata/test11g/system01.dbf

Backup Set Copy #1 of backup set 44
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ --------------- ---------- ---
DISK 00:02:01 23-NOV-07 NO TAG20071123T162321

List of Backup Pieces for backup set 44 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
44 1 AVAILABLE /data/backup/1cj1pgjq_1_1
47 2 AVAILABLE /data/backup/1cj1pgjq_2_1
48 3 AVAILABLE /data/backup/1cj1pgjq_3_1
49 4 AVAILABLE /data/backup/1cj1pgjq_4_1

RMAN> run
2> {
3> allocate channel c1 device type disk format '/data/backup/%U';
4> allocate channel c2 device type disk format '/data/backup/%U';
5> allocate channel c3 device type disk format '/data/backup/%U';
6> backup section size 400m tablespace system;
7> }

allocated channel: c1
channel c1: SID=151 device type=DISK

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

allocated channel: c3
channel c3: SID=158 device type=DISK

Starting backup at 23-NOV-07
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/data/oracle/oradata/test11g/system01.dbf
backing up blocks 1 through 12800
channel c1: starting piece 1 at 23-NOV-07
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
channel c3: starting full datafile backup set
channel c3: specifying datafile(s) in backup set
including current SPFILE in backup set
channel c3: starting piece 1 at 23-NOV-07
channel c1: finished piece 1 at 23-NOV-07
piece handle=/data/backup/1ij1ph60_1_1 tag=TAG20071123T163303 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:39
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/data/oracle/oradata/test11g/system01.dbf
backing up blocks 12801 through 25600
channel c1: starting piece 2 at 23-NOV-07
including current control file in backup set
channel c2: starting piece 1 at 23-NOV-07
channel c3: finished piece 1 at 23-NOV-07
piece handle=/data/backup/1kj1ph78_1_1 tag=TAG20071123T163303 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:19
channel c3: starting full datafile backup set
channel c3: specifying datafile(s) in backup set
input datafile file number=00001 name=/data/oracle/oradata/test11g/system01.dbf
backing up blocks 25601 through 32768
channel c3: starting piece 3 at 23-NOV-07
channel c1: finished piece 2 at 23-NOV-07
piece handle=/data/backup/1ij1ph60_2_1 tag=TAG20071123T163303 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:29
channel c2: finished piece 1 at 23-NOV-07
piece handle=/data/backup/1jj1ph6i_1_1 tag=TAG20071123T163303 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:29
channel c3: finished piece 3 at 23-NOV-07
piece handle=/data/backup/1ij1ph60_3_1 tag=TAG20071123T163303 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:03
Finished backup at 23-NOV-07
released channel: c1
released channel: c2
released channel: c3

RMAN> list backup of tablespace system;


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


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
41 Full 737.63M DISK 00:01:05 23-NOV-07
BP Key: 41 Status: AVAILABLE Compressed: NO Tag: TAG20071123T161454
Piece Name: /data/backup/19j1pg3v_1_1
List of Datafiles in backup set 41
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1120295 23-NOV-07 /data/oracle/oradata/test11g/system01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
44 Full 738.09M DISK 00:02:01 23-NOV-07
List of Datafiles in backup set 44
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1120885 23-NOV-07 /data/oracle/oradata/test11g/system01.dbf

Backup Set Copy #1 of backup set 44
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ --------------- ---------- ---
DISK 00:02:01 23-NOV-07 NO TAG20071123T162321

List of Backup Pieces for backup set 44 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
44 1 AVAILABLE /data/backup/1cj1pgjq_1_1
47 2 AVAILABLE /data/backup/1cj1pgjq_2_1
48 3 AVAILABLE /data/backup/1cj1pgjq_3_1
49 4 AVAILABLE /data/backup/1cj1pgjq_4_1

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
47 Full 737.88M DISK 00:01:47 23-NOV-07
List of Datafiles in backup set 47
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1121581 23-NOV-07 /data/oracle/oradata/test11g/system01.dbf

Backup Set Copy #1 of backup set 47
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ --------------- ---------- ---
DISK 00:01:47 23-NOV-07 NO TAG20071123T163303

List of Backup Pieces for backup set 47 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
50 1 AVAILABLE /data/backup/1ij1ph60_1_1
53 2 AVAILABLE /data/backup/1ij1ph60_2_1
54 3 AVAILABLE /data/backup/1ij1ph60_3_1

默认情况单个文件是无法并行备份的,11g以前的数据库都是这种情况。在11g中可以指定SECTION SIZE来实现单个数据文件的并行备份。

但是值得注意的是,如果SECTION SIZE设置的不合适,SECTION数量比CHANNEL的数量大很多,并行备份带来的负荷会造成性能的下降。如上面例子中第二次备份的情况。

另外,并行备份不一定可以提高备份的性能,上面的三个例子中,直接备份的速度反而最快。这是由于三个CHANNEL备份到相同的磁盘上,会导致IO竞争,而且并行备份本身也会带来一定的开销,这个从最终备份集的大小就可以看出来。如果可以将CHANNEL的目的地分散到不同磁盘,或者不同的CHANNEL使用带库不同的备份驱动器,那么并行备份就有可能带来一定的性能提升。之所以说有可能是因为,并行备份的速度和数据文件中数据的分布也是有关系的。而且以两个CHANNEL并行备份为例,由于第二个CHANNEL首先要定位开始位置,这个就需要消耗一定的时间,因此将SECTION大小设置大于数据文件的一半可以减少备份所需的时间。希望并行备份体现性能优势的另外一个条件就是数据文件足够大,使得并行备份的开销可以忽略掉。

如果备份采用并行备份,那么恢复会自动并行完成。VALIDATE命令也是可以通过同样的方法实现并行。
阅读(431) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~