Chinaunix首页 | 论坛 | 博客
  • 博客访问: 566118
  • 博文数量: 78
  • 博客积分: 2043
  • 博客等级: 大尉
  • 技术积分: 733
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-26 11:52
文章分类

全部博文(78)

文章存档

2011年(5)

2009年(64)

2008年(9)

分类: 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/9.2.0/dbs/snapcf_test.f'; # default

配置了并行度为4,也就是默认开4个通道进行备份,这在多cpu的情况下可以提高备份速度。


测试一下:


Recovery Manager: Release 9.2.0.4.0 - Production

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/9.2.0/dbs/c-1862890406-20050916-01 comment=NONE
Finished Control File and SPFILE Autobackup at 16-SEP-05

Recovery Manager complete.

确实是开了4个通道,而且每个文件的备份都占用了一个通道,可惜只有1cpu,要是多个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 9.2.0.4.0 - Production

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
c
hannel 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/9.2.0/dbs/c-1862890406-20050916-02 comment=NONE
Finished Control File and SPFILE Autobackup at 16-SEP-05

Recovery Manager complete.

只开了2个通道,总结一下,如果在生产环境下,并行度于cpu的数量保持一致,备份速度会提高。

2、搞明白expired

 


一直弄不清obsoleteexpired的区别,作几个实验试试。

RMAN> list backup
2> ;


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

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5 Full 1M DISK 00:00:01 16-SEP-05
BP Key:
5 Status: AVAILABLE Tag:
Piece Name: /u01/oracle/porduct/9.2.0/dbs/c-1862890406-20050916-03
SPFILE Included: Modification time: 16-SEP-05

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6 Full 1M DISK 00:00:21 16-SEP-05
BP Key: 6
Status: AVAILABLE Tag: TAG20050916T141929
Piece Name: /u01/oracle/porduct/9.2.0/dbs/06gupkfh_1_1
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 LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7 Full 1M DISK 00:00:02 16-SEP-05
BP Key: 7
Status: AVAILABLE Tag:
Piece Name: /u01/oracle/porduct/9.2.0/dbs/c-1862890406-20050916-04
SPFILE Included: Modification time: 16-SEP-05

list看一下,有1example01.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/9.2.0/dbs/c-1862890406-20050916-03 recid=5 stamp=569167415
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/9.2.0/dbs/
06gupkfh_1_1 recid=6 stamp=569168369
Crosschecked 1 objects

检查到 数据文件example01.dbf的备份是expired,再看看list bakcup的结果

RMAN> list backup;


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

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5 Full 1M DISK 00:00:01 16-SEP-05
BP Key: 5
Status: AVAILABLE Tag:
Piece Name: /u01/oracle/porduct/9.2.0/dbs/c-1862890406-20050916-03
SPFILE Included: Modification time: 16-SEP-05

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6 Full 1M DISK 00:00:21 16-SEP-05
BP Key: 6
Status: EXPIRED Tag: TAG20050916T141929
Piece Name:
/u01/oracle/porduct/9.2.0/dbs/06gupkfh_1_1
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 LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7 Full 1M DISK 00:00:02 16-SEP-05
BP Key: 7
Status: AVAILABLE Tag:
Piece Name: /u01/oracle/porduct/9.2.0/dbs/c-1862890406-20050916-04
SPFILE Included: Modification time: 16-SEP-05

发现备份集6还在,但status已经是EXPIRED的了。

作个测试看这个备份集还能不能用。
关闭数据库,moveexample01.dbf,然后试着用rman恢复。

SQL> shutdow immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
管理员在2009年8月13日编辑了该文章文章。

-->
阅读(2368) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~