ITPub博客

首页 > 数据库 > Oracle > [20141027]12c rman copy的分段备份.txt

[20141027]12c rman copy的分段备份.txt

原创 Oracle 作者:lfree 时间:2014-10-27 15:11:57 0 删除 编辑

[20141027]12c rman copy的分段备份.txt

--12G rman下可以实现copy的分段备份,而11G下可以仅仅支持备份集的分段备份.做一个测试看看.

--11G:
SCOTT@test> @ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.3.0     Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

RMAN> report schema ;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name TEST

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    770      SYSTEM               ***     /u01/app/oracle11g/oradata/test/system01.dbf
2    920      SYSAUX               ***     /u01/app/oracle11g/oradata/test/sysaux01.dbf
3    718      UNDOTBS1             ***     /u01/app/oracle11g/oradata/test/undotbs01.dbf
4    768      USERS                ***     /u01/app/oracle11g/oradata/test/users01.dbf
5    100      EXAMPLE              ***     /u01/app/oracle11g/oradata/test/example01.dbf
6    64       RMAN                 ***     /u01/app/oracle11g/oradata/test/rman01.dbf
7    64       TOOLS                ***     /u01/app/oracle11g/oradata/test/tools01.dbf
8    64       TEST                 ***     /u01/app/oracle11g/oradata/test/test01.dbf
9    64       TESTMSSM             ***     /u01/app/oracle11g/oradata/test/testmssm01.dbf
10   1        UNDOTBS2             ***     /u01/app/oracle11g/oradata/test/undotbs02.dbf
11   100      TEST16K              ***     /u01/app/oracle11g/oradata/test/test16k01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    250      TEMP                 32767       /u01/app/oracle11g/oradata/test/temp01.dbf

--example表空间占用100M.分成3段看看.

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;

new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored
released channel: ORA_DISK_1

RMAN> backup as backupset  section size 40M datafile 5 format "/data/testtest/example_%U";

Starting backup at 2014-10-27 10:33:08
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
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/oracle11g/oradata/test/example01.dbf
backing up blocks 1 through 5120
channel ORA_DISK_1: starting piece 1 at 2014-10-27 10:33:10
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/app/oracle11g/oradata/test/example01.dbf
backing up blocks 5121 through 10240
channel ORA_DISK_2: starting piece 2 at 2014-10-27 10:33:11
channel ORA_DISK_3: starting full datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/app/oracle11g/oradata/test/example01.dbf
backing up blocks 10241 through 12800
channel ORA_DISK_3: starting piece 3 at 2014-10-27 10:33:12
channel ORA_DISK_1: finished piece 1 at 2014-10-27 10:33:13
piece handle=/data/testtest/example_1upm3mf6_1_1 tag=TAG20141027T103309 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_2: finished piece 2 at 2014-10-27 10:33:13
piece handle=/data/testtest/example_1upm3mf6_2_1 tag=TAG20141027T103309 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_3: finished piece 3 at 2014-10-27 10:33:13
piece handle=/data/testtest/example_1upm3mf6_3_1 tag=TAG20141027T103309 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:02
Finished backup at 2014-10-27 10:33:14

$ ll -l /data/testtest/example_*
-rw-r-----  1 oracle11g oinstall 35528704 2014-10-27 10:33:11 /data/testtest/example_1upm3mf6_1_1
-rw-r-----  1 oracle11g oinstall 36077568 2014-10-27 10:33:12 /data/testtest/example_1upm3mf6_2_1
-rw-r-----  1 oracle11g oinstall  1474560 2014-10-27 10:33:13 /data/testtest/example_1upm3mf6_3_1

RMAN> backup as copy section size 40M datafile 5;
Starting backup at 2014-10-27 10:53:21
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=398 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=591 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=14 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 10/27/2014 10:53:25
RMAN-06580: the SECBYTES option cannot be used with AS COPY

--可以发现11G不支持backup as copy的section size.


--在12c测试看看.

SYS@ztest> @ver1
PORT_STRING                    VERSION        BANNER                                                                               CON_ID
------------------------------ -------------- -------------------------------------------------------------------------------- ----------
IBMPC/WIN_NT64-9.1.0           12.1.0.1.0     Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production              0

RMAN> report schema ;

Report of database schema for database with db_unique_name ZTEST

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    780      SYSTEM               ***     E:\APP\ADMINISTRATOR\ORADATA\ZTEST\SYSTEM01.DBF
2    64       TOOLS                ***     E:\APP\ADMINISTRATOR\ORADATA\ZTEST\TOOLS01.DBF
3    890      SYSAUX               ***     E:\APP\ADMINISTRATOR\ORADATA\ZTEST\SYSAUX01.DBF
5    725      UNDOTBS1             ***     E:\APP\ADMINISTRATOR\ORADATA\ZTEST\UNDOTBS01.DBF
6    337      USERS                ***     E:\APP\ADMINISTRATOR\ORADATA\ZTEST\USERS01.DBF

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    947      TEMP                 32767       E:\APP\ADMINISTRATOR\ORADATA\ZTEST\TEMP01.DBF

RMAN> backup as copy section size 150M datafile 6 format 'r:\user01_%U';
Starting backup at 2014-10-27 15:07:05
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=251 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=366 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=252 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=E:\APP\ADMINISTRATOR\ORADATA\ZTEST\USERS01.DBF
backing up blocks 1 through 19200
channel ORA_DISK_2: starting datafile copy
input datafile file number=00006 name=E:\APP\ADMINISTRATOR\ORADATA\ZTEST\USERS01.DBF
backing up blocks 19201 through 38400
channel ORA_DISK_3: starting datafile copy
input datafile file number=00006 name=E:\APP\ADMINISTRATOR\ORADATA\ZTEST\USERS01.DBF
backing up blocks 38401 through 43200
output file name=R:\USER01_DATA_D-ZTEST_I-2431369005_TS-USERS_FNO-6_02PM46GQ tag=TAG20141027T150706
channel ORA_DISK_3: datafile copy complete, elapsed time: 00:00:03
output file name=R:\USER01_DATA_D-ZTEST_I-2431369005_TS-USERS_FNO-6_02PM46GQ tag=TAG20141027T150706
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:10
output file name=R:\USER01_DATA_D-ZTEST_I-2431369005_TS-USERS_FNO-6_02PM46GQ tag=TAG20141027T150706
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:09
Finished backup at 2014-10-27 15:07:17

--可以发现文件被分成3个部分,看看备份结果.
RMAN> list copy ;

specification does not match any control file copy in the repository
specification does not match any archived log in the repository
List of Datafile Copies
=======================

Key     File S Completion Time     Ckp SCN    Ckp Time
------- ---- - ------------------- ---------- -------------------
1       6    A 2014-10-27 15:07:07 3236146    2014-10-27 15:07:06
        Name: R:\USER01_DATA_D-ZTEST_I-2431369005_TS-USERS_FNO-6_02PM46GQ
        Tag: TAG20141027T150706

d:\tools\sqltemp>ls -l R:\USER01*
ls -l R:\USER01*
-rw-rw-rw-   1 user     group    353902592 Oct 27 15:07 R:\USER01_DATA_D-ZTEST_I-2431369005_TS-USERS_FNO-6_02PM46GQ

--形成1个文件,通过这种方式可以加快backup as copy的备份.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-1310778/,如需转载,请注明出处,否则将追究法律责任。

全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    2698
  • 访问量
    6480300