[20171122]rman filesystemio_options.txt

简介: [20171122]rman备份与参数filesystemio_options设置.txt --//这几天写了几篇filesystemio_options参数设置的文章,单独测试这个参数对rman备份以及os缓存的影响.

[20171122]rman备份与参数filesystemio_options设置.txt

--//这几天写了几篇filesystemio_options参数设置的文章,单独测试这个参数对rman备份以及os缓存的影响.

1.测试环境:
SYS@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

2.测试一:
--//首先测试filesystemio_options=SETALL的情况:
SYS@book> show parameter filesystem
NAME                 TYPE   VALUE
-------------------- ------ ------
filesystemio_options string SETALL

--//在rman备份前我清除os缓存.

$ find /mnt/ramdisk/book/ -name "*.*" -print0  | xargs -0 -I{} cachedel {}
$ find /mnt/ramdisk/book/ -name "*.*" -print0  | xargs -0 -I{} cachestats {}
/mnt/ramdisk/book/redo03.log             pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/system01.dbf           pages in cache: 0/194562 (0.0%)  [filesize=778248.0K, pagesize=4K]
/mnt/ramdisk/book/undotbs01.dbf          pages in cache: 0/275202 (0.0%)  [filesize=1100808.0K, pagesize=4K]
/mnt/ramdisk/book/control02.ctl          pages in cache: 0/2612 (0.0%)  [filesize=10448.0K, pagesize=4K]
/mnt/ramdisk/book/redostb04.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/redostb03.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/redo01.log             pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/sysaux01.dbf_20171120  pages in cache: 0/240642 (0.0%)  [filesize=962568.0K, pagesize=4K]
/mnt/ramdisk/book/redostb01.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/sysaux01.dbf           pages in cache: 0/240642 (0.0%)  [filesize=962568.0K, pagesize=4K]
/mnt/ramdisk/book/redostb02.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/temp01.dbf             pages in cache: 0/105986 (0.0%)  [filesize=423944.0K, pagesize=4K]
/mnt/ramdisk/book/control01.ctl          pages in cache: 0/2612 (0.0%)  [filesize=10448.0K, pagesize=4K]
/mnt/ramdisk/book/users01.dbf            pages in cache: 0/554498 (0.0%)  [filesize=2217992.0K, pagesize=4K]
/mnt/ramdisk/book/tea01.dbf              pages in cache: 0/10242 (0.0%)  [filesize=40968.0K, pagesize=4K]
/mnt/ramdisk/book/example01.dbf          pages in cache: 0/88642 (0.0%)  [filesize=354568.0K, pagesize=4K]
/mnt/ramdisk/book/redo02.log             pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]

$ free -m
             total       used       free     shared    buffers     cached
Mem:        129161     105226      23935          0       1097     100197
-/+ buffers/cache:       3930     125230
Swap:        30718          2      30715


RMAN> backup database  format '/home/oracle/backup/%U';
Starting backup at 2017-11-22 09:49:12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=106 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=119 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=132 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=00004 name=/mnt/ramdisk/book/users01.dbf
input datafile file number=00006 name=/mnt/ramdisk/book/tea01.dbf
channel ORA_DISK_1: starting piece 1 at 2017-11-22 09:49:14
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00002 name=/mnt/ramdisk/book/sysaux01.dbf
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
channel ORA_DISK_2: starting piece 1 at 2017-11-22 09:49:14
channel ORA_DISK_3: starting full datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00003 name=/mnt/ramdisk/book/undotbs01.dbf
input datafile file number=00005 name=/mnt/ramdisk/book/example01.dbf
channel ORA_DISK_3: starting piece 1 at 2017-11-22 09:49:14
channel ORA_DISK_1: finished piece 1 at 2017-11-22 09:49:21
piece handle=/home/oracle/backup/gjsk6o4q_1_1 tag=TAG20171122T094913 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_3: finished piece 1 at 2017-11-22 09:49:21
piece handle=/home/oracle/backup/glsk6o4q_1_1 tag=TAG20171122T094913 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_2: finished piece 1 at 2017-11-22 09:49:29
piece handle=/home/oracle/backup/gksk6o4q_1_1 tag=TAG20171122T094913 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:15
Finished backup at 2017-11-22 09:49:29
Starting Control File and SPFILE Autobackup at 2017-11-22 09:49:29
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/autobackup/2017_11_22/o1_mf_s_960716969_f19ox9rn_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2017-11-22 09:49:30

--//17秒完成.

$ find /mnt/ramdisk/book/ -name "*.*" -print0  | xargs -0 -I{} cachestats {}
/mnt/ramdisk/book/redo03.log             pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/system01.dbf           pages in cache: 0/194562 (0.0%)  [filesize=778248.0K, pagesize=4K]
/mnt/ramdisk/book/undotbs01.dbf          pages in cache: 0/275202 (0.0%)  [filesize=1100808.0K, pagesize=4K]
/mnt/ramdisk/book/control02.ctl          pages in cache: 0/2612 (0.0%)  [filesize=10448.0K, pagesize=4K]
/mnt/ramdisk/book/redostb04.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/redostb03.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/redo01.log             pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/sysaux01.dbf_20171120  pages in cache: 0/240642 (0.0%)  [filesize=962568.0K, pagesize=4K]
/mnt/ramdisk/book/redostb01.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/sysaux01.dbf           pages in cache: 0/240642 (0.0%)  [filesize=962568.0K, pagesize=4K]
/mnt/ramdisk/book/redostb02.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/temp01.dbf             pages in cache: 0/105986 (0.0%)  [filesize=423944.0K, pagesize=4K]
/mnt/ramdisk/book/control01.ctl          pages in cache: 0/2612 (0.0%)  [filesize=10448.0K, pagesize=4K]
/mnt/ramdisk/book/users01.dbf            pages in cache: 0/554498 (0.0%)  [filesize=2217992.0K, pagesize=4K]
/mnt/ramdisk/book/tea01.dbf              pages in cache: 0/10242 (0.0%)  [filesize=40968.0K, pagesize=4K]
/mnt/ramdisk/book/example01.dbf          pages in cache: 0/88642 (0.0%)  [filesize=354568.0K, pagesize=4K]
/mnt/ramdisk/book/redo02.log             pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]

$ free -m
             total       used       free     shared    buffers     cached
Mem:        129161     105349      23811          0       1098     100187
-/+ buffers/cache:       4063     125098
Swap:        30718          2      30715

--//可以发现rman备份也OS也不缓存,free查看注意free列,基本没有变化.
--//补充测试:看看备份文件是否也缓存.
$ find /home/oracle/backup/ -name "AA*" -print0  | xargs -0 -I{} cachestats {}
/home/oracle/backup/AA_h7sk6p7f_1_1      pages in cache: 0/85158 (0.0%)  [filesize=340632.0K, pagesize=4K]
/home/oracle/backup/AA_h9sk6p7f_1_1      pages in cache: 0/19382 (0.0%)  [filesize=77528.0K, pagesize=4K]
/home/oracle/backup/AA_h8sk6p7f_1_1      pages in cache: 0/322672 (0.0%)  [filesize=1290688.0K, pagesize=4K]

--//噢!my god!!备份集文件,os也是不缓存.采用直接写的方式.

3.测试二:
--//首先测试filesystemio_options=asynch的情况:
SYS@book> alter system set filesystemio_options=asynch scope=spfile;
System altered.

SYS@book> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@book> startup
ORACLE instance started.
Total System Global Area  634732544 bytes
Fixed Size                  2255792 bytes
Variable Size             197133392 bytes
Database Buffers          427819008 bytes
Redo Buffers                7524352 bytes
Database mounted.
Database opened.

$ find /mnt/ramdisk/book/ -name "*.*" -print0  | xargs -0 -I{} cachedel {}
$ find /mnt/ramdisk/book/ -name "*.*" -print0  | xargs -0 -I{} cachestats {}
/mnt/ramdisk/book/redo03.log             pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/system01.dbf           pages in cache: 6/194562 (0.0%)  [filesize=778248.0K, pagesize=4K]
/mnt/ramdisk/book/undotbs01.dbf          pages in cache: 0/275202 (0.0%)  [filesize=1100808.0K, pagesize=4K]
/mnt/ramdisk/book/control02.ctl          pages in cache: 4/2612 (0.2%)  [filesize=10448.0K, pagesize=4K]
/mnt/ramdisk/book/redostb04.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/redostb03.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/redo01.log             pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/sysaux01.dbf_20171120  pages in cache: 0/240642 (0.0%)  [filesize=962568.0K, pagesize=4K]
/mnt/ramdisk/book/redostb01.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/sysaux01.dbf           pages in cache: 0/240642 (0.0%)  [filesize=962568.0K, pagesize=4K]
/mnt/ramdisk/book/redostb02.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/temp01.dbf             pages in cache: 0/105986 (0.0%)  [filesize=423944.0K, pagesize=4K]
/mnt/ramdisk/book/control01.ctl          pages in cache: 32/2612 (1.2%)  [filesize=10448.0K, pagesize=4K]
/mnt/ramdisk/book/users01.dbf            pages in cache: 28/554498 (0.0%)  [filesize=2217992.0K, pagesize=4K]
/mnt/ramdisk/book/tea01.dbf              pages in cache: 0/10242 (0.0%)  [filesize=40968.0K, pagesize=4K]
/mnt/ramdisk/book/example01.dbf          pages in cache: 0/88642 (0.0%)  [filesize=354568.0K, pagesize=4K]
/mnt/ramdisk/book/redo02.log             pages in cache: 2/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]

$ free -m
             total       used       free     shared    buffers     cached
Mem:        129161     103838      25322          0       1100      98725
-/+ buffers/cache:       4012     125148
Swap:        30718          2      30715

RMAN> backup database  format '/home/oracle/backup/%U';
Starting backup at 2017-11-22 09:54:23
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
....略..
Finished backup at 2017-11-22 09:54:38
--//15秒.


$ find /mnt/ramdisk/book/ -name "*.*" -print0  | xargs -0 -I{} cachestats {}
/mnt/ramdisk/book/redo03.log             pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/system01.dbf           pages in cache: 194562/194562 (100.0%)  [filesize=778248.0K, pagesize=4K]
/mnt/ramdisk/book/undotbs01.dbf          pages in cache: 215050/275202 (78.1%)  [filesize=1100808.0K, pagesize=4K]
/mnt/ramdisk/book/control02.ctl          pages in cache: 100/2612 (3.8%)  [filesize=10448.0K, pagesize=4K]
/mnt/ramdisk/book/redostb04.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/redostb03.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/redo01.log             pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/sysaux01.dbf_20171120  pages in cache: 0/240642 (0.0%)  [filesize=962568.0K, pagesize=4K]
/mnt/ramdisk/book/redostb01.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/sysaux01.dbf           pages in cache: 240642/240642 (100.0%)  [filesize=962568.0K, pagesize=4K]
/mnt/ramdisk/book/redostb02.log          pages in cache: 0/12801 (0.0%)  [filesize=51200.5K, pagesize=4K]
/mnt/ramdisk/book/temp01.dbf             pages in cache: 0/105986 (0.0%)  [filesize=423944.0K, pagesize=4K]
/mnt/ramdisk/book/control01.ctl          pages in cache: 2604/2612 (99.7%)  [filesize=10448.0K, pagesize=4K]
/mnt/ramdisk/book/users01.dbf            pages in cache: 215322/554498 (38.8%)  [filesize=2217992.0K, pagesize=4K]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/ramdisk/book/tea01.dbf              pages in cache: 10242/10242 (100.0%)  [filesize=40968.0K, pagesize=4K]
/mnt/ramdisk/book/example01.dbf          pages in cache: 88642/88642 (100.0%)  [filesize=354568.0K, pagesize=4K]
/mnt/ramdisk/book/redo02.log             pages in cache: 11/12801 (0.1%)  [filesize=51200.5K, pagesize=4K]

$ free -m
             total       used       free     shared    buffers     cached
Mem:        129161     109332      19829          0       1102     104181
-/+ buffers/cache:       4048     125112
Swap:        30718          2      30715

--//可以发现rman备份也OS也缓存,free查看注意free列,备份前23811,备份后19829,23811-19829=3982M.
--//另外注意下划线内容,数据文件users01.dbf并没有缓存全部,这是因为许多数据库还没有数据,rman不会备份空块,这样仅仅读取缓存了
--//38.8%.

$ find /home/oracle/backup/ -name "h*" -print0  | xargs -0 -I{} cachestats {}
/home/oracle/backup/h5sk6ovl_1_1         pages in cache: 19348/19348 (100.0%)  [filesize=77392.0K, pagesize=4K]
/home/oracle/backup/h3sk6ovl_1_1         pages in cache: 85158/85158 (100.0%)  [filesize=340632.0K, pagesize=4K]
/home/oracle/backup/h4sk6ovl_1_1         pages in cache: 322670/322670 (100.0%)  [filesize=1290680.0K, pagesize=4K]
--//备份集文件也会缓存.

--//换一句话,如果os缓存部分,rman备份还可以更快一些.再次备份应该会快一些.
RMAN> backup database  format '/home/oracle/backup/%U';

Starting backup at 2017-11-22 10:00:46
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=00004 name=/mnt/ramdisk/book/users01.dbf
input datafile file number=00006 name=/mnt/ramdisk/book/tea01.dbf
channel ORA_DISK_1: starting piece 1 at 2017-11-22 10:00:46
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00002 name=/mnt/ramdisk/book/sysaux01.dbf
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
channel ORA_DISK_2: starting piece 1 at 2017-11-22 10:00:46
channel ORA_DISK_3: starting full datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00003 name=/mnt/ramdisk/book/undotbs01.dbf
input datafile file number=00005 name=/mnt/ramdisk/book/example01.dbf
channel ORA_DISK_3: starting piece 1 at 2017-11-22 10:00:46
channel ORA_DISK_3: finished piece 1 at 2017-11-22 10:00:47
piece handle=/home/oracle/backup/h1sk6oqe_1_1 tag=TAG20171122T100046 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: finished piece 1 at 2017-11-22 10:00:49
piece handle=/home/oracle/backup/gvsk6oqe_1_1 tag=TAG20171122T100046 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_2: finished piece 1 at 2017-11-22 10:00:53
piece handle=/home/oracle/backup/h0sk6oqe_1_1 tag=TAG20171122T100046 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:07
Finished backup at 2017-11-22 10:00:53
Starting Control File and SPFILE Autobackup at 2017-11-22 10:00:54
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/autobackup/2017_11_22/o1_mf_s_960717654_f19plp35_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2017-11-22 10:00:55

--//7秒,os缓存加快了备份速度.

目录
相关文章
|
Oracle 关系型数据库 数据库管理
[20180619]bbed verify问题.txt
[20180619]bbed verify问题.txt --//记录一下自己一个多年的错误. 1.环境: SCOTT@test01p> @ ver1 PORT_STRING                    VERSION        BANNER   ...
1288 0
|
Oracle 关系型数据库 Linux
[20180115]RMAN-06820.txt
[20180115]RMAN-06820.txt --//在备库做归档备份出现RMAN-06820的问题。就是如果在备库做全表,因为要做主库日志切换,一般执行rman target /会出现问题。
1420 0
|
Oracle 关系型数据库 测试技术
[20171225]RMAN-06808.txt
[20171225]RMAN-06808: SECTION SIZE cannot be used when piece limit is in effect.txt --//朋友拿我的一些例子来测试遇到的RMAN-06808: SECTION SIZE cannot be used when piece limit is in effect问题.
951 0
|
关系型数据库
[20171221]RMAN-05501.txt
[20171221]RMAN-05501 aborting duplication of target database.txt --//昨天使用rman duplicate建立dg,出现如下错误: rman > duplicate target database for standby from active database; .
1070 0
|
Oracle 关系型数据库
[20171130]关于rman的一些总结.txt
[20171130]关于rman的一些总结.txt --//最近一直做rman相关测试,测试那个乱,没办法.无法从周围的人获得帮助,纯粹是自己的乱猜,乱测,不知道别人是否能看懂我写的东西.
1090 0
|
Oracle 关系型数据库 Shell
[20171121]rman backup as copy 2.txt
[20171121]rman backup as copy 2.txt --//昨天测试backup as copy ,备份时备份文件的文件头什么时候更新.是最后完成后还是顺序写入备份文件.
1013 0
|
Oracle 关系型数据库 Linux
[20171121]rman backup as copy.txt
[20171121]rman backup as copy.txt --//上个星期做数据文件块头恢复时,提到使用rman备份数据文件时,文件头数据库信息是最后写入备份集文件的,在filesperset=1的情况 --//下写入备份集文件中的倒数第2块就是文件头的备份.
1228 0
|
Oracle 关系型数据库 Linux
[20171101]rman to destination.txt
[20171101]rman to destination.txt --//国庆放假,看了一些rman方面的书,看到一个不常用的参数to destination,测试看看.
943 0
|
Oracle 关系型数据库 数据库
[20170616]recover copy of datafile 6.txt
[20170616]no copy of datafile 6 found to recover.txt --//最近几天一直被这个问题纠缠,我虽然不知道问题在哪来,还是找到简单的解决方法,做1个记录: --//链接:http://www.
1153 0
|
SQL
[20170506]fetch sqlplus arraysize.txt
[20170506]fetch sqlplus arraysize.txt http://blog.itpub.net/267265/viewspace-2138042/ --//前一阵子写的,如果设置arrarsize=3,可以看到3条3条输出.
970 0