11g新特性之rman
1.同一数据文件的并行备份
您或许已经知道您可以并行备份,方法是,声明多个通道使每个通道成为一个 RMAN 会话。但是,很少有
人意识到每个通道一次只能备份一个数据文件。因此,即使有多个通道,但是每个数据文件只通过一个通
道进行备份,这与备份真正并行的概念有些相反。
在 Oracle 数据库 11g RMAN 中,通道可以将数据文件拆分为块,这些块被称为“段”。您可以指定每个段
的大小。下面就是一个例子:
run {
allocate channel c1 type disk format '/dsg/%U';
allocate channel c2 type disk format '/dsg/%U';
backup
section size 500m
datafile 1;
}
released channel: ORA_DISK_1
allocated channel: c1
channel c1: SID=75 instance=db111 device type=DISK
allocated channel: c2
channel c2: SID=71 instance=db111 device type=DISK
Starting backup at 23-JAN-14
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA1/db11/datafile/system.259.824234047
backing up blocks 1 through 64000
channel c1: starting piece 1 at 23-JAN-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 23-JAN-14
channel c1: finished piece 1 at 23-JAN-14
piece handle=/dsg/0goupml3_1_1 tag=TAG20140123T122051 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:29
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA1/db11/datafile/system.259.824234047
backing up blocks 64001 through 108800
channel c1: starting piece 2 at 23-JAN-14
channel c2: finished piece 1 at 23-JAN-14
piece handle=/dsg/0houpml3_1_1 tag=TAG20140123T122051 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:04
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
including current SPFILE in backup set
channel c2: starting piece 1 at 23-JAN-14
channel c1: finished piece 2 at 23-JAN-14
piece handle=/dsg/0goupml3_2_1 tag=TAG20140123T122051 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:27
channel c2: finished piece 1 at 23-JAN-14
piece handle=/dsg/0joupmm1_1_1 tag=TAG20140123T122051 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:25
Finished backup at 23-JAN-14
released channel: c1
released channel: c2
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
9 Full 738.68M DISK 00:00:48 23-JAN-14
List of Datafiles in backup set 9
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1971767107 23-JAN-14 +DATA1/db11/datafile/system.259.824234047
Backup Set Copy #1 of backup set 9
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ --------------- ---------- ---
DISK 00:00:48 23-JAN-14 NO TAG20140123T122051
List of Backup Pieces for backup set 9 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
11 1 AVAILABLE /dsg/0goupml3_1_1
14 2 AVAILABLE /dsg/0goupml3_2_1
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
10 Full 35.02M DISK 00:00:29 23-JAN-14
BP Key: 12 Status: AVAILABLE Compressed: NO Tag: TAG20140123T122051
Piece Name: /dsg/0houpml3_1_1
Control File Included: Ckp SCN: 1971767110 Ckp time: 23-JAN-14
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11 Full 80.00K DISK 00:00:18 23-JAN-14
BP Key: 13 Status: AVAILABLE Compressed: NO Tag: TAG20140123T122051
Piece Name: /dsg/0joupmm1_1_1
SPFILE Included: Modification time: 16-JAN-14
SPFILE db_unique_name: DB11
--查看rman 会话
LOGON_TIME SQL_ID EVENT USERNAME OSUSER MACHINE PROGRAM MODULE OWNER OBJECT_NAME LAST_C SID SQL_ LAST_LOAD_TIME OBJECT_TYPE PGA_ALLOC_ KILLSTR P1 P2 P3
-------------------- --------------- ---------------------------------------- --------------- ---------- --------------- ------------------------------ ------------------------------ --------------- ------------------------------ ------ ------ ---- ------------------------- --------------- ---------- --------------- ---------- ---------- ----------
2014-01-23 12:05 control file parallel write SYS oracle dbrac1 rman@dbrac1 (TNS V1-V3) backup full datafile 37 205 16497088 kill -9 14066 2 39 2
2014-01-23 12:05 enq: CF - contention SYS oracle dbrac1 rman@dbrac1 (TNS V1-V3) backup full datafile 35 75 27031328 kill -9 14069 1128660997 0 0
该 RMAN 命令分配两个通道并在两个通道上并行备份用户的表空间。每个通道占用数据文件的一个
500MB 的段并以并行方式备份该文件。这加快了大型文件的备份速度。
注意,备份段是如何显示为文件段的。由于每个段去往不同的通道,因此您可以将它们定义为不同的挂载
点(如 /backup1 和 /backup2),您还可以并行方式将它们备份到磁带。
但是,如果 6 号大型文件只位于一个磁盘上,则使用并行备份就没有优势了。如果您对该文件进行分段,
磁头需要不断移动来处理该文件的不同段,其缺点胜过分段的优点。
ZLIB 压缩
RMAN 在 Oracle 数据库 10g 中提供了备份片断压缩功能以节省网络带宽,但是许多人都不轻易使用它。
为什么?因为第三方压缩工具提供的方法比 RMAN 自身的更快。但是,RMAN 10g 压缩有一些第三方压
缩工具没有提供的好用功能。例如,当 RMAN 10g 恢复数据文件时,它不需要首先解压缩这些文件(如
果以前被压缩过)。该方法在还原期间可以显著节省带宽。
在 Oracle 数据库 11g 中,RMAN 提供了另一种算法 ZLIB,而以前使用的是 BZIP2。ZLIB 算法要快得
多,但是不能压缩太多内容。另一方面,它也很节省 CPU。因此,如果您的 CPU 不多,最好使用 ZLIB 压
缩。(注意,版本 11.1 中的默认选项是 BZIP2;您需要许可一个新选项 Advanced Compression Option
才能使用 ZLIB。)
要使用 ZLIB 压缩,只需将 RMAN 配置参数设置为:
RMAN> configure compression algorithm 'ZLIB' ;
如果您以前更改过该参数,需要发出上述命令。要将其更改为 BZIP2,发出以下命令:
RMAN> configure compression algorithm 'bzip2';
现在,所有压缩备份都将使用新的算法。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24577884/viewspace-1074594/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24577884/viewspace-1074594/