这篇文章给大家分享的是有关Oracle中RMAN的BACKUP常用参数有哪些的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
成都创新互联公司长期为上千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为克拉玛依企业提供专业的成都做网站、成都网站制作、
成都外贸网站建设,
克拉玛依网站改版等技术服务。拥有十年丰富建站经验和众多成功案例,为您定制开发。
backup命令用来生成备份,可以在执行backup时为备份指定很多属性。官方文档上backup命令语法功能非常丰富,但是没有必要一一的掌握。先要了解一些基本用法,特殊的参数,用到的时候临时抱佛脚就行了。
下面我们挑一些常用的参数,做以说明。
BACKUP参数选项
full
| 服务器会话将所有块都复制到备份集中,只跳过从未使用过的数据文 件块。在备份归档重做日志或控制文件时,服务器会话不会跳过任何块。完全备份不是增量备份。 |
incremental level integer | 服务器会话复制自上次n 级增量备份以来更改过的数据块,其中n 是从1 到4 之间的任意整数。要执行大于0 级的增量备份时,服务器进程会在BACKUP 命令中检查每个数据文件的0 级备份或0 级副本是否存在。如果指定增量,则必须在备份说明中设置以下参数之一:DATA FILE、DATA FILECOPY、TABLESPACE 或DATABASE。恢复管理器不支持控制文件、归档重做日志或备份集的增量备份。 |
filesperset integer | 如果指定了FILESPERSET 参数,恢复管理器就会将FILESPERSET值与计算的值(备份的文件数与通道数的比值)进行比较,并采用两者中的较小值,从而确保使用所有的通道。如果不指定FILESPERSET,恢复管理器就会将计算的值(文件数与分配的通道数的比值)与缺省值64 进行比较并采用两者中的较小值。当通道多于要备份的文件时,多余的通道将保持空闲。输入文件不能在通道之间进行分割。 |
skip | 指定该参数可将某些数据文件或归档重做日志排除在备份集之外。该参数具有以下选项: offline:将脱机数据文件排除在备份集之外。 readonly:排除属于只读表空间的数据文件。 inaccessible:排除由于I/O 错误而无法读取的数据文件或归档重 做日志。 |
maxsetsize integer | 以字节(缺省)、千字节(K)、兆字节(M) 或千兆字节(G) 来指定备份集的大大小。恢复管理器会尽量将所有的备份集限制为指定的大小。 |
delete input | 在成功创建备份集后删除输入文件。仅当备份归档重做日志、数据文 件副本或备份集时才指定该选项。它相当于对所有输入文件执行 CHANGE . . . DELETE 命令。 |
include current controlfile | 创建当前控制文件的快照并将其放置在该子句生成的各备份集中。 |
Format | 输出名称的格式。可以单独使用或组合使用格式参数。 |
PLUS ARCHIVELOG | 连带ARCHIVELOG一起备份
|
COPIES integer | 多重备份,即备份集写多份。integer 取值(1-4),默认是1
|
下面演示一下skip、filesperset、maxsetsize、COPIES等用法
SQL> ALTER TABLESPACE IDX READ ONLY;
Tablespace altered.
RMAN> BACKUP DATABASE SKIP READONLY;
Starting backup at 2015/07/09 03:39:49
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK
skipping read-only file 6
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:39:49
channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:41:45
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T033949_bstz45xk_.bkp tag=TAG20150709T033949 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:56
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:41:46
channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:41:47
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_ncsnf_TAG20150709T033949_bstz7toh_.bkp tag=TAG20150709T033949 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2015/07/09 03:41:47
RMAN> BACKUP DATABASE filesperset 2;
Starting backup at 2015/07/09 03:45:11
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/devdb/idx01.dbf
channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:45:11
channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:45:46
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T034511_bstzg7tn_.bkp tag=TAG20150709T034511 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:45:46
channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:46:11
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T034511_bstzhc17_.bkp tag=TAG20150709T034511 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:26
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:46:12
channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:46:27
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T034511_bstzj460_.bkp tag=TAG20150709T034511 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:46:28
channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:46:29
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_ncsnf_TAG20150709T034511_bstzjnbx_.bkp tag=TAG20150709T034511 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2015/07/09 03:46:29
RMAN> backup database maxsetsize 200M;
Starting backup at 2015/07/09 03:52:02
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 07/09/2015 03:52:02
RMAN-06183: datafile or datafile copy /u01/app/oracle/oradata/devdb/system01.dbf (file number 1) larger than MAXSETSIZE
备份集的大大小不能小于任意一个数据文件的大小。
RMAN> backup database maxsetsize 1G;
Starting backup at 2015/07/09 03:58:47
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbf
channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:58:48
channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:59:23
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T035847_bsv07r5l_.bkp tag=TAG20150709T035847 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/devdb/idx01.dbf
channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:59:23
channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:59:58
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T035847_bsv08vcs_.bkp tag=TAG20150709T035847 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:59:59
channel ORA_DISK_1: finished piece 1 at 2015/07/09 04:00:00
piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_ncsnf_TAG20150709T035847_bsv09zlm_.bkp tag=TAG20150709T035847 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2015/07/09 04:00:00SQL> select name,bytes/1024/1024||'MB' from v$datafile;
NAME BYTES/1024/1024||'MB'
-------------------------------------------------- --------------------------------------
/u01/app/oracle/oradata/devdb/system01.dbf 770MB
/u01/app/oracle/oradata/devdb/sysaux01.dbf 580MB
/u01/app/oracle/oradata/devdb/undotbs01.dbf 95MB
/u01/app/oracle/oradata/devdb/users01.dbf 16.25MB
/u01/app/oracle/oradata/devdb/example01.dbf 345.625MB
/u01/app/oracle/oradata/devdb/idx01.dbf 10MB
RMAN> backup copies 2 database format '/backup/full_%U';
Starting backup at 2015/07/09 04:06:29
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/devdb/idx01.dbf
channel ORA_DISK_1: starting piece 1 at 2015/07/09 04:06:29
channel ORA_DISK_1: finished piece 1 at 2015/07/09 04:08:04 with 2 copies and tag TAG20150709T040629
piece handle=/backup/full_3bqbj5m5_1_1 comment=NONE
piece handle=/backup/full_3bqbj5m5_1_2 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:35
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2015/07/09 04:08:05
channel ORA_DISK_1: finished piece 1 at 2015/07/09 04:08:06 with 2 copies and tag TAG20150709T040629
piece handle=/backup/full_3cqbj5p4_1_1 comment=NONE
piece handle=/backup/full_3cqbj5p4_1_2 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2015/07/09 04:08:06
如果备份集放到默认的fast recovery area中,是不允许使用copies参数的
RMAN> backup copies 2 database;
Starting backup at 2015/07/09 04:11:37
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/devdb/idx01.dbf
channel ORA_DISK_1: starting piece 1 at 2015/07/09 04:11:37
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 07/09/2015 04:11:38
ORA-19806: cannot make duplex backups in recovery area
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2015/07/09 04:11:39
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 07/09/2015 04:11:40
ORA-19806: cannot make duplex backups in recovery area
感谢各位的阅读!关于“Oracle中RMAN的BACKUP常用参数有哪些”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
网站名称:Oracle中RMAN的BACKUP常用参数有哪些-创新互联
转载来于:
http://cqcxhl.com/article/dccgoi.html