博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[20161028]rman与filesperset=1.txt
阅读量:6367 次
发布时间:2019-06-23

本文共 18060 字,大约阅读时间需要 60 分钟。

[20161028]rman与filesperset=1.txt

--rman备份数据库,我喜欢设置filesperset=1.这样每个备份集仅仅1个数据文件,我个人一直认为这样恢复时会快一些。

--我同事总嫌这样备份文件太多修改为filesperset=4.我通过例子说明我的看法:

1.环境:

SCOTT@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

CREATE TABLESPACE SUGAR DATAFILE

  '/mnt/ramdisk/book/sugar01.dbf' SIZE 30M AUTOEXTEND ON NEXT 16M MAXSIZE UNLIMITED
NOLOGGING
ONLINE
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT AUTO
FLASHBACK ON;

CREATE TABLESPACE TEA DATAFILE

  '/mnt/ramdisk/book/tea01.dbf' SIZE 30M AUTOEXTEND ON NEXT 16M MAXSIZE UNLIMITED
NOLOGGING
ONLINE
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT AUTO
FLASHBACK ON;

SCOTT@book> create table t1 tablespace sugar as select rownum id ,lpad('A',32,'A') name from dual connect by level<=2e5;

Table created.

SCOTT@book> create table t2 tablespace tea as select rownum id ,lpad('B',32,'B') name from dual connect by level<=2e5;

Table created.

SCOTT@book> alter system checkpoint ;

System altered.

--//分别建立2个表在不同的表空间。内容1个是AAAA...,另外一个是BBBB..。

2.备份测试:

RMAN> report schema ;
using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name BOOK
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    750      SYSTEM               ***     /mnt/ramdisk/book/system01.dbf
2    760      SYSAUX               ***     /mnt/ramdisk/book/sysaux01.dbf
3    85       UNDOTBS1             ***     /mnt/ramdisk/book/undotbs01.dbf
4    50       USERS                ***     /mnt/ramdisk/book/users01.dbf
5    313      EXAMPLE              ***     /mnt/ramdisk/book/example01.dbf
6    30       SUGAR                ***     /mnt/ramdisk/book/sugar01.dbf
7    30       TEA                  ***     /mnt/ramdisk/book/tea01.dbf
List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    29       TEMP                 32767       /mnt/ramdisk/book/temp01.dbf

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

new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored

--//仅仅打开1个并行。这样测试可以实现备份在一个备份集中。

RMAN> backup datafile 6,7 format '/u01/backup/datafile6_7_%U' ;

Starting backup at 2016-10-28 09:13:33
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=00006 name=/mnt/ramdisk/book/sugar01.dbf
input datafile file number=00007 name=/mnt/ramdisk/book/tea01.dbf
channel ORA_DISK_1: starting piece 1 at 2016-10-28 09:13:33
channel ORA_DISK_1: finished piece 1 at 2016-10-28 09:13:34
piece handle=/u01/backup/datafile6_7_0crjft5t_1_1 tag=TAG20161028T091333 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2016-10-28 09:13:34

--检查备份:

$ strings /u01/backup/datafile6_7_0crjft5t_1_1 | less
...
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
d AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
cd AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
cc AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
cb AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
ca AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
c` AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
c_ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
c^ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
c] AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
c\ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        d       <
K BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
J BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
I BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
H BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
G BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
...
ca BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
c` BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
c_ BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
c^ BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
c] BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
c\ BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
    g   >
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,

--你可以发现AAAA,BBBB字符串出现的顺序是交替进行的,也就是rman备份是2个文件同时读取写入备份集,而不是先备份数据文件6,再备

--份数据文件7.

3.这样在恢复整个数据库估计问题不大。

--实际上如果你IO不好,估计恢复也很慢,假设选择filesperset=4,如果又打开并行,这样同时写入的数据文件数量会很多。当然这仅仅是
--我的猜测.

但是如果你恢复时如果仅仅恢复数据文件6,读取备份集的量就是整个备份集,这样恢复相对就慢了。

--//恢复1个数据文件看看。

SCOTT@book> alter tablespace sugar offline ;
Tablespace altered.

$ strace -f -o /tmp/aa.txt rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Oct 28 09:30:28 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: BOOK (DBID=1337401710)

RMAN> restore tablespace sugar ;

Starting restore at 2016-10-28 09:30:47
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=56 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00006 to /mnt/ramdisk/book/sugar01.dbf
channel ORA_DISK_1: reading from backup piece /u01/backup/datafile6_7_0crjft5t_1_1
channel ORA_DISK_1: piece handle=/u01/backup/datafile6_7_0crjft5t_1_1 tag=TAG20161028T091333
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 2016-10-28 09:30:50

RMAN> quit

Recovery Manager complete.

$ ls -l /u01/backup/datafile6_7_0crjft5t_1_1

-rw-r----- 1 oracle oinstall 22118400 2016-10-28 09:13:33 /u01/backup/datafile6_7_0crjft5t_1_1
--注意文件大小22118400。

$ egrep 'pread\(258,|pwrite\(259,' /tmp/aa.txt >| /tmp/a2.txt

47653 pread(258, "\v\242\0\0\1\0\200\1\0\0\0\0\0\0\1\4\34b\0\0\0\0\0\0\0\4 \vn!\267O"..., 8192, 8192) = 8192

47656 pread(258, "\23\242\0\0\1\0\0\0\307\247#\0\0\0\1\4\200Z\0\0\0\4 \v\0\4 \vn!\267O"..., 1040384, 8192) = 1040384
47656 pread(258, "\36\242\0\0\200\0\200\1\26\242#\0\0\0\1\4\5B\1\0\6\0\0\0\200\0\301\3\0\0\0\0"..., 1048576, 1048576) = 1048576
47656 pread(258, "!\242\0\0\200\0\200\1\202\246#\0\0\0\32\4B\335\1\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 2097152) = 1048576
47656 pread(258, "!\242\0\0\200\0\300\1\310\246#\0\0\0\32\4~\335\2\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 3145728) = 1048576
47656 pread(258, " \242\0\0\200\1\200\1\202\246#\0\0\0\2\4\326\363\1\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 4194304) = 1048576
47656 pwrite(259, "\0\242\0\0\1\0\200\1\0\0\0\0\0\0\1\5\201\246\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1040384, 8192) = 1040384
47656 pread(258, " \242\0\0\200\1\300\1\310\246#\0\0\0\2\4-\376\2\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 5242880) = 1048576
47656 pwrite(259, " \242\0\0\200\0\200\1\202\246#\0\0\0\4\4]\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 1048576) = 1048576
47656 pread(258, " \242\0\0\200\1\200\1\202\246#\0\0\0\2\4\324\363\1\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 6291456) = 1048576
47656 pread(258, " \242\0\0\200\1\300\1\310\246#\0\0\0\2\4/\376\2\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 7340032) = 1048576
47656 pwrite(259, " \242\0\0\0\1\200\1\202\246#\0\0\0\2\4\27\363\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 2097152) = 1048576
47656 pread(258, " \242\0\0\200\2\200\1\202\246#\0\0\0\2\4\322\363\1\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 8388608) = 1048576
47656 pread(258, " \242\0\0\200\2\300\1\310\246#\0\0\0\2\4)\376\2\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 9437184) = 1048576
47656 pwrite(259, " \242\0\0\200\1\200\1\202\246#\0\0\0\2\4\25\363\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 3145728) = 1048576
47656 pread(258, " \242\0\0\200\2\200\1\202\246#\0\0\0\2\4\320\363\1\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 10485760) = 1048576
47656 pread(258, " \242\0\0\200\2\300\1\310\246#\0\0\0\2\4+\376\2\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 11534336) = 1048576
47656 pwrite(259, " \242\0\0\0\2\200\1\202\246#\0\0\0\2\4\23\363\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 4194304) = 1048576
47656 pread(258, " \242\0\0\200\3\200\1\202\246#\0\0\0\2\4\316\363\1\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 12582912) = 1048576
47656 pread(258, " \242\0\0\200\3\300\1\310\246#\0\0\0\2\0045\376\2\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 13631488) = 1048576
47656 pwrite(259, " \242\0\0\200\2\200\1\202\246#\0\0\0\2\4\21\363\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 5242880) = 1048576
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47656 pread(258, " \242\0\0\200\3\200\1\202\246#\0\0\0\2\4\314\363\1\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 14680064) = 1048576
47656 pread(258, " \242\0\0\200\3\300\1\310\246#\0\0\0\2\0047\376\2\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 15728640) = 1048576
47656 pwrite(259, " \242\0\0\0\3\200\1\202\246#\0\0\0\2\4\17\363\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 6291456) = 1048576
47656 pread(258, " \242\0\0\200\4\200\1\202\246#\0\0\0\2\4\312\363\1\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 16777216) = 1048576
47656 pread(258, " \242\0\0\200\4\300\1\310\246#\0\0\0\2\0041\376\2\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 17825792) = 1048576
47656 pwrite(259, " \242\0\0\200\3\200\1\202\246#\0\0\0\2\4\r\363\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 7340032) = 1048576
47656 pread(258, " \242\0\0\200\4\200\1\202\246#\0\0\0\2\4\310\363\1\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 18874368) = 1048576
47656 pread(258, " \242\0\0\200\4\300\1\310\246#\0\0\0\2\0043\376\2\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 19922944) = 1048576
47656 pwrite(259, " \242\0\0\0\4\200\1\202\246#\0\0\0\2\4\v\363\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 8388608) = 1048576
47656 pread(258, " \242\0\0\200\5\200\1\202\246#\0\0\0\3\4i\363\1\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 20971520) = 1048576
47656 pread(258, "\6\242\0\0\200\5\300\1\300\247#\0\0\0\1\6\223\213\2\0\1\0\0\0\340Z\1\0\225\246#\0"..., 98304, 22020096) = 98304
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47656 pwrite(259, " \242\0\0\200\4\200\1\202\246#\0\0\0\2\4\t\363\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 9437184) = 1048576
47656 pwrite(259, " \242\0\0\0\5\200\1\202\246#\0\0\0\2\4\7\363\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 10485760) = 1048576
47656 pwrite(259, ":\242\0\0\200\5\200\1\10 \16\0\0\0\1\0044\230\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 11534336) = 1048576
47656 pwrite(259, ":\242\0\0\0\6\200\1\10 \16\0\0\0\1\4\264\233\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 12582912) = 1048576
47656 pwrite(259, ":\242\0\0\200\6\200\1\10 \16\0\0\0\1\0044\233\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 13631488) = 1048576
47656 pwrite(259, ":\242\0\0\0\7\200\1\10 \16\0\0\0\1\4\264\232\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 14680064) = 1048576
47656 pwrite(259, ":\242\0\0\200\7\200\1\10 \16\0\0\0\1\0044\232\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 15728640) = 1048576
47656 pwrite(259, ":\242\0\0\0\10\200\1\10 \16\0\0\0\1\4\264\225\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 16777216) = 1048576
47656 pwrite(259, ":\242\0\0\200\10\200\1\10 \16\0\0\0\1\0044\225\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 17825792) = 1048576
47656 pwrite(259, ":\242\0\0\0\t\200\1\10 \16\0\0\0\1\4\264\224\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 18874368) = 1048576
47656 pwrite(259, ":\242\0\0\200\t\200\1\10 \16\0\0\0\1\0044\224\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 19922944) = 1048576
47656 pwrite(259, ":\242\0\0\0\n\200\1\10 \16\0\0\0\1\4\264\227\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 20971520) = 1048576
47656 pwrite(259, ":\242\0\0\200\n\200\1\10 \16\0\0\0\1\0044\227\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 22020096) = 1048576
47656 pwrite(259, ":\242\0\0\0\v\200\1\10 \16\0\0\0\1\4\264\226\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 23068672) = 1048576
47656 pwrite(259, ":\242\0\0\200\v\200\1\10 \16\0\0\0\1\0044\226\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 24117248) = 1048576
47656 pwrite(259, ":\242\0\0\0\f\200\1\10 \16\0\0\0\1\4\264\221\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 25165824) = 1048576
47656 pwrite(259, ":\242\0\0\200\f\200\1\10 \16\0\0\0\1\0044\221\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 26214400) = 1048576
47656 pwrite(259, ":\242\0\0\0\r\200\1\10 \16\0\0\0\1\4\264\220\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 27262976) = 1048576
47656 pwrite(259, ":\242\0\0\200\r\200\1\10 \16\0\0\0\1\0044\220\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 28311552) = 1048576
47656 pwrite(259, ":\242\0\0\0\16\200\1\10 \16\0\0\0\1\4\264\223\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 29360128) = 1048576
47656 pwrite(259, ":\242\0\0\200\16\200\1\10 \16\0\0\0\1\0044\223\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 30408704) = 1048576
47656 pwrite(259, "\0\242\0\0\0\17\200\1\0\0\0\0\0\0\1\5\200\251\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 8192, 31457280) = 8192
47656 pwrite(259, "\v\242\0\0\1\0\200\1\0\0\0\0\0\0\1\4I\240\0\0\0\0\0\0\0\4 \vn!\267O"..., 8192, 8192) = 8192

--注意看~部分,说明读取这个备份文件到22020096偏移,后面为什么有这么多写,实际上我备份的数据文件大小30M,但是仅仅前面的

--10M有数据,所以后面仅仅写空块。

47656 pwrite(259, " \242\0\0\0\5\200\1\202\246#\0\0\0\2\4\7\363\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 10485760) = 1048576

--10485760/8192=1280
BBED> set dba 6,1280
        DBA             0x01800500 (25167104 6,1280)

BBED> dump /v count 100

File: /mnt/ramdisk/book/sugar01.dbf (6)
Block: 1280                              Offsets:    0 to   99                            Dba:0x01800500
-----------------------------------------------------------------------------------------------------------
20a20000 00058001 82a62300 00000204 07f30000 00000000 00000000 00000000 l  .........#.....................
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 l ................................
00000000 00000000 00000000 04000000 ffffffff 00000000 02000000 40000000 l ............................@...
01000100                                                                l ....
<32 bytes per line>

--pwrite 里面的是8进制。

--20 (八进制)=2*8=16 = 0x10
--242(八进制)=2*8*8+4*8+2=162 = 0xa2
--200(八进制)=2*8*8 = 128 = 0x80
--大家可以自行测试,可以对上的。

--如果你再仔细看可以发现执行2次pread 每次1M,写1次pwrite每次1M。也就是存在无用的读取操作,我取其中一段来分析:

47656 pread(258, " \242\0\0\200\3\200\1\202\246#\0\0\0\2\4\314\363\1\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 14680064) = 1048576

47656 pread(258, " \242\0\0\200\3\300\1\310\246#\0\0\0\2\0047\376\2\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 15728640) = 1048576
47656 pwrite(259, " \242\0\0\0\3\200\1\202\246#\0\0\0\2\4\17\363\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576, 6291456) = 1048576

--你可以发现写入内容在第一个pread的开头并一样。也就是这样恢复读取了数据文件7(也就是表空间tea的备份信息).

4.可以发现这样在仅仅恢复1个数据文件的情况下,要扫描整个备份集。

$ grep pread /tmp/a2.txt  | cut -f2 -d= |xargs echo | sed 's/ /+/g' | bc -l

22118400

$ ls -l /u01/backup/datafile6_7_0crjft5t_1_1

-rw-r----- 1 oracle oinstall 22118400 2016-10-28 09:13:33 /u01/backup/datafile6_7_0crjft5t_1_1
--注意文件大小22118400。这样读取的数量一致。

5.而如果使用参数filesperset=1,这样每个备份集仅仅1个文件就没有这个问题了。

RMAN> recover tablespace sugar ;

Starting recover at 2016-10-28 10:36:31
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 2016-10-28 10:36:31

SCOTT@book> alter tablespace sugar online ;

Tablespace altered.

RMAN> backup datafile 6,7 filesperset=1 format '/u01/backup/datafile6_7_%U' ;

Starting backup at 2016-10-28 10:39:03

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=00006 name=/mnt/ramdisk/book/sugar01.dbf
channel ORA_DISK_1: starting piece 1 at 2016-10-28 10:39:03
channel ORA_DISK_1: finished piece 1 at 2016-10-28 10:39:04
piece handle=/u01/backup/datafile6_7_0drjg267_1_1 tag=TAG20161028T103903 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=/mnt/ramdisk/book/tea01.dbf
channel ORA_DISK_1: starting piece 1 at 2016-10-28 10:39:05
channel ORA_DISK_1: finished piece 1 at 2016-10-28 10:39:06
piece handle=/u01/backup/datafile6_7_0erjg269_1_1 tag=TAG20161028T103903 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2016-10-28 10:39:06

$ ls -l /u01/backup/datafile6_7_0*

-rw-r----- 1 oracle oinstall 22118400 2016-10-28 09:13:33 /u01/backup/datafile6_7_0crjft5t_1_1
-rw-r----- 1 oracle oinstall 11075584 2016-10-28 10:39:03 /u01/backup/datafile6_7_0drjg267_1_1
-rw-r----- 1 oracle oinstall 11075584 2016-10-28 10:39:05 /u01/backup/datafile6_7_0erjg269_1_1

--这样每个备份集1个数据文件,就可以避免这个问题了。

RMAN> list backup of datafile 6,7;

List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
5       Full    21.09M     DISK        00:00:00     2016-10-28 09:13:33
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20161028T091333
        Piece Name: /u01/backup/datafile6_7_0crjft5t_1_1
  List of Datafiles in backup set 5
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  6       Full 2336756    2016-10-28 09:13:33 /mnt/ramdisk/book/sugar01.dbf
  7       Full 2336756    2016-10-28 09:13:33 /mnt/ramdisk/book/tea01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time

------- ---- -- ---------- ----------- ------------ -------------------
6       Full    10.55M     DISK        00:00:00     2016-10-28 10:39:03
        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20161028T103903
        Piece Name: /u01/backup/datafile6_7_0drjg267_1_1
  List of Datafiles in backup set 6
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  6       Full 2341184    2016-10-28 10:39:03 /mnt/ramdisk/book/sugar01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time

------- ---- -- ---------- ----------- ------------ -------------------
7       Full    10.55M     DISK        00:00:00     2016-10-28 10:39:05
        BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: TAG20161028T103903
        Piece Name: /u01/backup/datafile6_7_0erjg269_1_1
  List of Datafiles in backup set 7
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  7       Full 2341185    2016-10-28 10:39:05 /mnt/ramdisk/book/tea01.dbf

--总结:

备份的目的总是要利于恢复的,建议使用参数filesperset =1 ,这样虽然数据文件很多时,备份的文件也很多,但是这样更加利于恢复。

转载地址:http://kugma.baihongyu.com/

你可能感兴趣的文章
验证Oracle处理速度
查看>>
自己写一个jquery
查看>>
艾伟:C#中抽象类和接口的区别
查看>>
Flink - NetworkEnvironment
查看>>
BZOJ4374 : Little Elephant and Boxes
查看>>
【.Net Framework 体积大?】不安装.net framework 也能运行!?开篇叙述-1
查看>>
LLDP协议、STP协议 笔记
查看>>
如何使用 GroupBy 计数-Count()
查看>>
jquery之clone()方法详解
查看>>
Delphi 用文件流读取文本文件字符串的方法
查看>>
php中怎么导入自己写的类
查看>>
C# 委托
查看>>
Using Information Fragments to Answer the Questions Developers Ask
查看>>
JVM学习(4)——全面总结Java的GC算法和回收机制---转载自http://www.cnblogs.com/kubixuesheng/p/5208647.html...
查看>>
getParameter和getAttribute的区别
查看>>
自动工作负载库理论与操作(Automatic Workload Repository,AWR)
查看>>
Redis两种方式实现限流
查看>>
CentOS 7 中使用NTP进行时间同步
查看>>
在MongoDB数据库中查询数据(上)
查看>>
Python import其他文件夹的文件
查看>>