暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

limit backup filesize with rman maxpiecesize (限制备份文件大小相关参数)

原创 Anbob 2011-09-08
1134
今天检查服务器上的rman 备份发现新上线的系统备份单文件已经到了11G大小,记的在shell脚本中限制了看来没起作用,才发现maxpiecesize的位置不同效果也不同,而且MAXSETSIZE还有这样的限制
看我的实验,转载请声明出处http://www.anbob.com/?p=1093
实验1

[oracle@orazhang ~]$ vi rmanfullbak.sh
#!/bin/bash
### every day backup full database#####
source /home/oracle/.bash_profile
cd $ORACLE_HOME/bin
./rman target / msglog=/home/oracle/rman_bk_L0_`date '+%Y%m%d%H%M%S'`.log <<EOF
run {
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS;
allocate channel c1 type disk maxpiecesize=200M;
backup  format '/u01/app/oracle/backfile/whole_%d_%T_%s_%p.bak' database;
release channel c1;
}
CROSSCHECK backup;
delete noprompt expired backupset of database ;
delete noprompt obsolete ;
exit;
EOF
篇幅原因不再贴备份过程
RMAN> list backup of database;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
74      Full    245.46M    DISK        00:02:36     2011-09-08 17:15:34
List of Datafiles in backup set 74
File LV Type Ckp SCN    Ckp Time            Name
---- -- ---- ---------- ------------------- ----
1       Full 1340530630 2011-09-08 17:12:58 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_6cgckx95_.dbf
2       Full 1340530630 2011-09-08 17:12:58 /u01/app/oracle/oradata/ORCL/datafile/test.dbf
3       Full 1340530630 2011-09-08 17:12:58 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_71wv5vkw_.dbf
4       Full 1340530630 2011-09-08 17:12:58 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_6cgckxds_.dbf
5       Full 1340530630 2011-09-08 17:12:58 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_6cgckxc7_.dbf
6       Full 1340530630 2011-09-08 17:12:58 /u01/app/oracle/oradata/ORCL/datafile/tt.dbf
7       Full 1340530630 2011-09-08 17:12:58 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbslogmn_6vdjocp1_.dbf
8       Full 1340530630 2011-09-08 17:12:58 /u01/app/oracle/oradata/ORCL/datafile/smailtbs.dbf
9       Full 1340530630 2011-09-08 17:12:58 /u01/app/oracle/oradata/ORCL/datafile/tt1.dbf
10      Full 1340530630 2011-09-08 17:12:58 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_indextbs_729vx06v_.dbf
12      Full 1340530630 2011-09-08 17:12:58 /u01/app/oracle/oradata/ORCL/datafile/undotbs2.dbf
Backup Set Copy #1 of backup set 74
Device Type Elapsed Time Completion Time     Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK        00:02:36     2011-09-08 17:15:34 YES        TAG20110908T171258
List of Backup Pieces for backup set 74 Copy #1
BP Key  Pc# Status      Piece Name
------- --- ----------- ----------
74      1   AVAILABLE   /u01/app/oracle/backfile/whole_ORCL_20110908_84_1.bak
75      2   AVAILABLE   /u01/app/oracle/backfile/whole_ORCL_20110908_84_2.bak
[oracle@orazhang backfile]$ ll -h
total 253M
-rw-r----- 1 oracle oinstall 7.2M Sep  8 17:15 c-1246063822-20110908-00
-rw-r----- 1 oracle oinstall 199M Sep  8 17:15 whole_ORCL_20110908_84_1.bak
-rw-r----- 1 oracle oinstall  48M Sep  8 17:15 whole_ORCL_20110908_84_2.bak

限制成功,分成了2个备份集
实验2

修改shell
run {
CONFIGURE CONTROLFILE AUTOBACKUP ON;
configure channel device type disk maxpiecesize=200M;
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS;
allocate channel c1 type disk;
backup  format '/u01/app/oracle/backfile/whole_%d_%T_%s_%p.bak' database;
release channel c1;
}
--备份成功
RMAN> list backup of database;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
76      Full    244.66M    DISK        00:02:29     2011-09-08 17:31:31
BP Key: 77   Status: AVAILABLE  Compressed: YES  Tag: TAG20110908T172902
Piece Name: /u01/app/oracle/backfile/whole_ORCL_20110908_86_1.bak
List of Datafiles in backup set 76
File LV Type Ckp SCN    Ckp Time            Name
---- -- ---- ---------- ------------------- ----
1       Full 1340531077 2011-09-08 17:29:02 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_6cgckx95_.dbf
2       Full 1340531077 2011-09-08 17:29:02 /u01/app/oracle/oradata/ORCL/datafile/test.dbf
3       Full 1340531077 2011-09-08 17:29:02 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_71wv5vkw_.dbf
4       Full 1340531077 2011-09-08 17:29:02 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_6cgckxds_.dbf
5       Full 1340531077 2011-09-08 17:29:02 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_6cgckxc7_.dbf
6       Full 1340531077 2011-09-08 17:29:02 /u01/app/oracle/oradata/ORCL/datafile/tt.dbf
7       Full 1340531077 2011-09-08 17:29:02 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbslogmn_6vdjocp1_.dbf
8       Full 1340531077 2011-09-08 17:29:02 /u01/app/oracle/oradata/ORCL/datafile/smailtbs.dbf
9       Full 1340531077 2011-09-08 17:29:02 /u01/app/oracle/oradata/ORCL/datafile/tt1.dbf
10      Full 1340531077 2011-09-08 17:29:02 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_indextbs_729vx06v_.dbf
12      Full 1340531077 2011-09-08 17:29:02 /u01/app/oracle/oradata/ORCL/datafile/undotbs2.dbf
[oracle@orazhang backfile]$ ll -h
total 253M
-rw-r----- 1 oracle oinstall 7.2M Sep  8 17:31 c-1246063822-20110908-01
-rw-r----- 1 oracle oinstall 245M Sep  8 17:31 whole_ORCL_20110908_86_1.bak

并非全局限制,限制没起作用
实验3

RMAN> configure channel device type disk maxpiecesize=200M;
old RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 200 M;
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 200 M;
new RMAN configuration parameters are successfully stored
released channel: ORA_DISK_1
RMAN> backup  format '/u01/app/oracle/backfile/whole_%d_%T_%s_%p.bak' database;
Starting backup at 2011-09-08 17:36:01
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=143 devtype=DISK
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_6cgckx95_.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_71wv5vkw_.dbf
input datafile fno=00006 name=/u01/app/oracle/oradata/ORCL/datafile/tt.dbf
input datafile fno=00012 name=/u01/app/oracle/oradata/ORCL/datafile/undotbs2.dbf
input datafile fno=00010 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_indextbs_729vx06v_.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/ORCL/datafile/test.dbf
input datafile fno=00005 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_6cgckxc7_.dbf
input datafile fno=00007 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbslogmn_6vdjocp1_.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_6cgckxds_.dbf
input datafile fno=00008 name=/u01/app/oracle/oradata/ORCL/datafile/smailtbs.dbf
input datafile fno=00009 name=/u01/app/oracle/oradata/ORCL/datafile/tt1.dbf
channel ORA_DISK_1: starting piece 1 at 2011-09-08 17:36:02
channel ORA_DISK_1: finished piece 1 at 2011-09-08 17:38:17
piece handle=/u01/app/oracle/backfile/whole_ORCL_20110908_88_1.bak tag=TAG20110908T173601 comment=NONE
channel ORA_DISK_1: starting piece 2 at 2011-09-08 17:38:17
channel ORA_DISK_1: finished piece 2 at 2011-09-08 17:38:42
piece handle=/u01/app/oracle/backfile/whole_ORCL_20110908_88_2.bak tag=TAG20110908T173601 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:40
Finished backup at 2011-09-08 17:38:42
Starting Control File and SPFILE Autobackup at 2011-09-08 17:38:42
piece handle=/u01/app/oracle/backfile/c-1246063822-20110908-02 comment=NONE
Finished Control File and SPFILE Autobackup at 2011-09-08 17:38:43
[oracle@orazhang backfile]$ ll -h
total 253M
-rw-r----- 1 oracle oinstall 7.2M Sep  8 17:38 c-1246063822-20110908-02
-rw-r----- 1 oracle oinstall 199M Sep  8 17:38 whole_ORCL_20110908_88_1.bak
-rw-r----- 1 oracle oinstall  48M Sep  8 17:38 whole_ORCL_20110908_88_2.bak

在交互式中rman 中同实验一,生成了两个文件,限制成功
实验4

RMAN> backup MAXSETSIZE 200m database;
Starting backup at 2011-09-08 17:52:19
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 09/08/2011 17:52:19
RMAN-06183: datafile or datafile copy larger than MAXSETSIZE: file# 1 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_6cgckx95_.dbf
RMAN> report schema;
Report of database schema
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    540      SYSTEM               ***     /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_6cgckx95_.dbf
2    100      TEST                 ***     /u01/app/oracle/oradata/ORCL/datafile/test.dbf
3    460      SYSAUX               ***     /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_71wv5vkw_.dbf
4    60       USERS                ***     /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_6cgckxds_.dbf
5    100      EXAMPLE              ***     /u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_6cgckxc7_.dbf
6    406      TT                   ***     /u01/app/oracle/oradata/ORCL/datafile/tt.dbf
7    100      TBSLOGMNR            ***     /u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbslogmn_6vdjocp1_.dbf
8    20       SMAILTBS             ***     /u01/app/oracle/oradata/ORCL/datafile/smailtbs.dbf
9    10       TT                   ***     /u01/app/oracle/oradata/ORCL/datafile/tt1.dbf
10   300      INDEXTBS             ***     /u01/app/oracle/oradata/ORCL/datafile/o1_mf_indextbs_729vx06v_.dbf
12   398      UNDOTBS2             ***     /u01/app/oracle/oradata/ORCL/datafile/undotbs2.dbf
RMAN> backup MAXSETSIZE 550m database;
Starting backup at 2011-09-08 17:53:27
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=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_6cgckx95_.dbf
channel ORA_DISK_1: starting piece 1 at 2011-09-08 17:53:27
channel ORA_DISK_1: finished piece 1 at 2011-09-08 17:54:02
piece handle=/u01/app/oracle/product/10.2.0/db_1/dbs/2qmm230n_1_1 tag=TAG20110908T175327 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00010 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_indextbs_729vx06v_.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/ORCL/datafile/test.dbf
input datafile fno=00007 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbslogmn_6vdjocp1_.dbf
channel ORA_DISK_1: starting piece 1 at 2011-09-08 17:54:02
channel ORA_DISK_1: finished piece 1 at 2011-09-08 17:54:17
piece handle=/u01/app/oracle/product/10.2.0/db_1/dbs/2rmm231q_1_1 tag=TAG20110908T175327 comment=NONE
--此处省略N个字(恩格斯?no)
[oracle@orazhang backfile]$ cd /u01/app/oracle/product/10.2.0/db_1/dbs
[oracle@orazhang dbs]$ ll -h
total 643M
-rw-r----- 1 oracle oinstall  91M Sep  8 17:53 2qmm230n_1_1
-rw-r----- 1 oracle oinstall 3.9M Sep  8 17:54 2rmm231q_1_1
-rw-r----- 1 oracle oinstall  85M Sep  8 17:54 2smm2329_1_1
-rw-r----- 1 oracle oinstall  42M Sep  8 17:55 2tmm233c_1_1
-rw-r----- 1 oracle oinstall  17M Sep  8 17:55 2umm2345_1_1
这指定的最大backupset 大小不能小于数据库中存在的最大文件大小,且生成N个备份片文件
Configuring Backup Piece Sizes for RMAN Backups to a Media Manager
Some media managers have limits on the maximum size of files that they can back up or restore. You must ensure that RMAN does not produce backup sets larger than limits imposed by your media manager.
The CONFIGURE MAXSETSIZE command limits the size of backup sets created on a channel. This CONFIGURE setting applies to any channel, whether manually allocated or configured, when the BACKUP command is used to create backup sets.
The value set by the CONFIGURE MAXSETSIZE command is a default for the given channel. You can override the configured MAXSETSIZE value by specifying a MAXSETSIZE option for an individual BACKUP command.
note:
shell脚本调用rman限制大小需要在分配通道时指写,RMAN单行命令模式可以配置configure channel device type disk maxpiecesize=nK/M/G
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论