涂抹ORACLE试阅章节:第8章-Rman说,我能备份
===========================================================================
8.5.8 是否对备份集进行压缩
10g 版本的RMAN中的BACKUP命令新增了一个AS COMPRESSED BACKUPSET的选项。如果在执行BACKUP命令时指定了该选项,备份集在创建过程中就会应用压缩算法,通过这种方式使用倒是挺简单的,也不需要其他额外的操作。例如:
RMAN> BACKUP AS COMPRESSED BACKUPSET TABLESPACE SYSTEM;
Starting backup at 15-APR-09
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=F:\ORACLE\ORADATA\JSSBOOK\SYSTEM01.DBF
channel ORA_DISK_1: starting piece 1 at 15-APR-09
channel ORA_DISK_1: finished piece 1 at 15-APR-09
piece handle=F:\ORACLE\BACKUP\BAK_11KCIHRB_1_1 tag=TAG20090415T214059 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 15-APR-09
channel ORA_DISK_1: finished piece 1 at 15-APR-09
piece handle=F:\ORACLE\BACKUP\BAK_12KCIHRQ_1_1 tag=TAG20090415T214059 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 15-APR-09接着对相同表空间创建一个不压缩的备份集:
RMAN> BACKUP TABLESPACE SYSTEM;
Starting backup at 15-APR-09
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=F:\ORACLE\ORADATA\JSSBOOK\SYSTEM01.DBF
channel ORA_DISK_1: starting piece 1 at 15-APR-09
channel ORA_DISK_1: finished piece 1 at 15-APR-09
piece handle=F:\ORACLE\BACKUP\BAK_13KCIHS6_1_1 tag=TAG20090415T214126 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 15-APR-09
channel ORA_DISK_1: finished piece 1 at 15-APR-09
piece handle=F:\ORACLE\BACKUP\BAK_14KCIHSM_1_1 tag=TAG20090415T214126 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 15-APR-09列出两个备份集,对比看看:
RMAN> LIST BACKUP OF TABLESPACE SYSTEM;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
29 Full 27.60M DISK 00:00:09 15-APR-09
BP Key: 96 Status: AVAILABLE Compressed: YES Tag: TAG20090415T214059
Piece Name: F:\ORACLE\BACKUP\BAK_11KCIHRB_1_1
List of Datafiles in backup set 29
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 798005 15-APR-09 F:\ORACLE\ORADATA\JSSBOOK\SYSTEM01.DBF
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
31 Full 129.20M DISK 00:00:13 15-APR-09
BP Key: 98 Status: AVAILABLE Compressed: NO Tag: TAG20090415T214126
Piece Name: F:\ORACLE\BACKUP\BAK_13KCIHS6_1_1
List of Datafiles in backup set 31
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 798020 15-APR-09 F:\ORACLE\ORADATA\JSSBOOK\SYSTEM01.DBF从LIST BACKUP中的信息可以看出,压缩比还是比较理想。不过压缩备份集虽然能够节省一些存储空间,但肯定会降低备份和恢复时的速度,这中间如何取舍就取决于你的实际需求了。
提示:
这里显示创建不压缩的备份集反而费时更长,这是因为我们测试库较小,因此压缩所花费的时间,相比压缩后由于备份集缩小而节省出的写磁盘时间更短,更多的时间都是花在I/O而不是压缩备份集,因此不压缩的备份集花费时间更长了。8.5.9 是否启用加密备份
从10g R2版本开始,RMAN支持对备份集进行加密,括弧,俺说的是备份集哟,RMAN中创建的镜像复制并不支持加密。
对备份集进行加密主要是为了保护备份集的安全,启用了加密措施后,创建的备份集在恢复时也必须要有相应的密钥才能够进行恢复。
RMAN 提供三种加密的方式:透明模式、密码模式和双重模式。关于三种模式的特点的描述,请耐心等候,如果你很着急,想马上知道,往后翻到本章最后一节。
RMAN 提供了两种方式设置加密备份:
- CONFIGURE 命令。
- SET ENCRYPTION 命令。
两种方式都能够启用或禁用备份加密,其中CONFIGURE命令相当于进行预定义配置,设置之后除非显式修改,否则将持续有效。SET ENCRYPTION命令则是仅作用于当前会话,不过使用上更加灵活。SET ENCRYPTION优先级比较高,如果通过CONFIGURE命令进行配置后,又执行SET ENCRYPTION命令,则SET ENCRYPTION命令指定的配置将会覆盖CONFIGURE命令的配置。
用CONFIGURE命令启用备份加密的操作非常简单(前提是数据库端已经配置好了Oracle Encryption Wallet):
RMAN> CONFIGURE ENCRYPTION FOR DATABASE ON;
new RMAN configuration parameters:
CONFIGURE ENCRYPTION FOR DATABASE ON;
new RMAN configuration parameters are successfully stored然后再执行备份命令创建的备份集,就是加密备份集。
如果要禁止的话将ON改为OFF即可:
RMAN> CONFIGURE ENCRYPTION FOR DATABASE OFF;
old RMAN configuration parameters:
CONFIGURE ENCRYPTION FOR DATABASE ON;
new RMAN configuration parameters:
CONFIGURE ENCRYPTION FOR DATABASE OFF;
new RMAN configuration parameters are successfully storedCONFIGURE 命令不仅可以指定DATABASE级,还可以具体到表空间,例如:
RMAN> CONFIGURE ENCRYPTION FOR TABLESPACE USERS ON ;
tablespace USERS will be encrypted in future backup sets
new RMAN configuration parameters are successfully stored使用SET ENCRYPTION命令就灵活多了,随时随地都可以:
RMAN> SET ENCRYPTION ON IDENTIFIED BY encbak ONLY;
executing command: SET encryption上述命令设置了一个名为encbak的密钥(这也正是传说中的密码模式),紧接其后创建的备份集在进行恢复时,就必须使用该密钥才能够进行正常的恢复操作。
=================================================
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7607759/viewspace-627456/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7607759/viewspace-627456/