全部博文(78)
分类: Oracle
2008-11-19 18:04:34
1、 设置备份的并行度,使多个cpu同时,提高备份速度。
2、 搞明白expired
3、 搞明白obsolete
1、设置备份的并行度,使多个cpu同时工作,提高备份速度。
RMAN> show all;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 4;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
RMAN configuration has no stored or default parameters
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/oracle/porduct/
配置了并行度为4,也就是默认开4个通道进行备份,这在多cpu的情况下可以提高备份速度。
测试一下:
Recovery Manager: Release
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
RMAN> connect target /
2> run{
3> copy
4> datafile 4 to '/share/4.dbf',
5> datafile 5 to '/share/5.dbf',
6> datafile 6 to '/share/6.dbf',
7> datafile 7 to '/share/7.dbf';
8> }
9>
connected to target database: TEST (DBID=1862890406)
Starting copy at 16-SEP-05
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=12 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=16 devtype=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: sid=17 devtype=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: sid=18 devtype=DISK
channel ORA_DISK_2: copied datafile 5
output filename=/share/5.dbf recid=1 stamp=569158719
channel ORA_DISK_1: copied datafile 4
output filename=/share/4.dbf recid=3 stamp=569158740
channel ORA_DISK_3: copied datafile 6
output filename=/share/6.dbf recid=2 stamp=569158737
channel ORA_DISK_4: copied datafile 7
output filename=/share/7.dbf recid=4 stamp=569158755
Finished copy at 16-SEP-05
Starting Control File and SPFILE Autobackup at 16-SEP-05
piece handle=/u01/oracle/porduct/
Finished Control File and SPFILE Autobackup at 16-SEP-05
Recovery Manager complete.
确实是开了4个通道,而且每个文件的备份都占用了一个通道,可惜只有1个cpu,要是多个cpu,速度就能提高了。
改成2个并行度试试,
RMAN> configure device type disk parallelism 2;
old RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 4;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
new RMAN configuration parameters are successfully stored
Recovery Manager: Release
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
RMAN> connect target /
2> run{
3> copy
4> datafile 4 to '/share/4.dbf',
5> datafile 5 to '/share/5.dbf',
6> datafile 6 to '/share/6.dbf',
7> datafile 7 to '/share/7.dbf';
8> }
9>
connected to target database: TEST (DBID=1862890406)
Starting copy at 16-SEP-05
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=17 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=16 devtype=DISK
channel ORA_DISK_1: copied datafile 4
output filename=/share/4.dbf recid=6 stamp=569164154
channel ORA_DISK_2: copied datafile 5
output filename=/share/5.dbf recid=5 stamp=569164152
channel ORA_DISK_1: copied datafile 6
output filename=/share/6.dbf recid=7 stamp=569164183
channel ORA_DISK_2: copied datafile 7
output filename=/share/7.dbf recid=8 stamp=569164190
Finished copy at 16-SEP-05
Starting Control File and SPFILE Autobackup at 16-SEP-05
piece handle=/u01/oracle/porduct/
Finished Control File and SPFILE Autobackup at 16-SEP-05
Recovery Manager complete.
只开了2个通道,总结一下,如果在生产环境下,并行度于cpu的数量保持一致,备份速度会提高。
2、搞明白expired
一直弄不清obsolete和expired的区别,作几个实验试试。
RMAN> list backup
2> ;
List of Backup Sets
===================
BS Key Type
------- ---- -- ---------- ----------- ------------ ---------------
5 Full
BP Key: 5 Status: AVAILABLE Tag:
Piece Name: /u01/oracle/porduct/
SPFILE Included: Modification time: 16-SEP-05
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6 Full
BP Key: 6 Status: AVAILABLE Tag: TAG20050916T141929
Piece Name: /u01/oracle/porduct/
List of Datafiles in backup set 6
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
3 Full 350737 16-SEP-05 /u01/oracle/oradata/test/example01.dbf
BS Key Type
------- ---- -- ---------- ----------- ------------ ---------------
7 Full
BP Key: 7 Status: AVAILABLE Tag:
Piece Name: /u01/oracle/porduct/
SPFILE Included: Modification time: 16-SEP-05
先list看一下,有1个example01.dbf的备份和控制文件的自动备份。
然后删除数据文件的备份。
[oracle@vm1 dbs]$ rm -f 06gupkfh_1_1
然后用crosscheck检查备份的状态。
RMAN> crosscheck backup;
using channel ORA_DISK_1
using channel ORA_DISK_2
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/oracle/porduct/
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/oracle/porduct/9.2.0/dbs/c-1862890406-20050916-04 recid=7 stamp=569168397
Crosschecked 2 objects
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u01/oracle/porduct/
Crosschecked 1 objects
检查到 数据文件example01.dbf的备份是expired,再看看list bakcup的结果。
RMAN> list backup;
List of Backup Sets
===================
BS Key Type
------- ---- -- ---------- ----------- ------------ ---------------
5 Full
BP Key: 5 Status: AVAILABLE Tag:
Piece Name: /u01/oracle/porduct/
SPFILE Included: Modification time: 16-SEP-05
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6 Full
BP Key: 6 Status: EXPIRED Tag: TAG20050916T141929
Piece Name: /u01/oracle/porduct/
List of Datafiles in backup set 6
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
3 Full 350737 16-SEP-05 /u01/oracle/oradata/test/example01.dbf
BS Key Type
------- ---- -- ---------- ----------- ------------ ---------------
7 Full
BP Key: 7 Status: AVAILABLE Tag:
Piece Name: /u01/oracle/porduct/
SPFILE Included: Modification time: 16-SEP-05
发现备份集6还在,但status已经是EXPIRED的了。
作个测试看这个备份集还能不能用。
关闭数据库,move走example01.dbf,然后试着用rman恢复。
SQL> shutdow immediate
Database closed.
Database dismounted.
ORACLE instance shut down.管理员在2009年8月13日编辑了该文章文章。