ITPub博客

首页 > 数据库 > Oracle > [20190228]Backup Restore Throttle sleep.txt

[20190228]Backup Restore Throttle sleep.txt

原创 Oracle 作者:lfree 时间:2019-03-01 09:12:47 0 删除 编辑

[20190228]Backup Restore Throttle sleep.txt


--//别人的系统提供awr报表,看一下发现Backup Restore Throttle sleep等待事件.找到如下链接:

--//http://blog.itpub.net/28211342/viewspace-2141191/=>rman备份产生等待事件.

--//检查后面的参数resource_manager_plan非空,估计resource_manager_plan对磁盘有一定限制,导致出现该等待事件.

--//从字面上里面,感觉限制rman备份的速率也可以重演该等待事件,测试看看.


1.环境:

SYS@book> @ 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


--//修改rman配置如下:

RMAN> CONFIGURE CHANNEL 1 DEVICE TYPE DISK RATE 128 K;

new RMAN configuration parameters:

CONFIGURE CHANNEL 1 DEVICE TYPE DISK RATE 128 K;

new RMAN configuration parameters are successfully stored


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

old RMAN configuration parameters:

CONFIGURE DEVICE TYPE DISK PARALLELISM 3 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


--//取消RMAN> CONFIGURE CHANNEL 1 DEVICE TYPE DISK clear ;


2.测试:

RMAN> backup as copy datafile 1 format '/u01/backup/%b';


Starting backup at 2019-02-28 16:38:28

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=94 device type=DISK

channel ORA_DISK_1: starting datafile copy

input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf

--//慢


SYS@book> @ wait

P1RAW            P2RAW            P3RAW P1  P2  P3  SID SERIAL# SEQ# EVENT                         STATUS   STATE   WAIT_TIME_MICRO SECONDS_IN_WAIT WAIT_CLASS

---------------- ---------------- ----- -- --- --- ---- ------- ---- ----------------------------- -------- ------- --------------- --------------- ----------

000000000000005E 000000000000000B 00    94  11   0   94      11 3127 Backup Restore Throttle sleep ACTIVE   WAITING          913277               1 Other


SYS@book> @ wait

P1RAW            P2RAW            P3RAW P1  P2  P3  SID SERIAL# SEQ# EVENT                         STATUS   STATE   WAIT_TIME_MICRO SECONDS_IN_WAIT WAIT_CLASS

---------------- ---------------- ----- -- --- --- ---- ------- ---- ----------------------------- -------- ------- --------------- --------------- ----------

000000000000005E 000000000000000B 00    94  11   0   94      11 3129 Backup Restore Throttle sleep ACTIVE   WAITING          400255               0 Other


--//可以发现出现Backup Restore Throttle sleep等待事件,也就是讲限制磁盘IO也会导致该等待事件.


user interrupt received

Finished backup at 2019-02-28 16:42:30

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03099: job cancelled at user request

--//太慢了,取消操作.


3.扩展知识:

--//我有看一些链接,发现dbms_backup_restore包里面自带一个sleep函数.

--//估计调用这个函数也能演示出这个等待事件.

SYS@book> @ desc_proc sys DBMS_BACKUP_RESTORE SLEEP

OWNER      PACKAGE_NAME         OBJECT_NAME SEQUENCE ARGUMENT_NAME        DATA_TYPE            IN_OUT    DEFAULTED

---------- -------------------- ----------- -------- -------------------- -------------------- --------- ----------

SYS        DBMS_BACKUP_RESTORE  SLEEP              1 SECS                 BINARY_INTEGER       IN        N


--//执行如下:

SYS@book> exec sys.DBMS_BACKUP_RESTORE.SLEEP( 100 );

...


--//打开新回话:

SYS@book> @ wait

P1RAW            P2RAW            P3RAW P1 P2  P3  SID SERIAL#  SEQ# EVENT                         STATUS   STATE   WAIT_TIME_MICRO SECONDS_IN_WAIT WAIT_CLASS

---------------- ---------------- ----- -- -- --- ---- ------- ----- ----------------------------- -------- ------- --------------- --------------- ----------

0000000000000036 0000000000000047 00    54 71   0   54      71    40 Backup Restore Throttle sleep ACTIVE   WAITING         1343560               1 Other


--//估计正确.


4.跟踪rman看看:

RMAN> CONFIGURE CHANNEL 1 DEVICE TYPE DISK RATE 20M;

old RMAN configuration parameters:

CONFIGURE CHANNEL 1 DEVICE TYPE DISK RATE 10 M;

new RMAN configuration parameters:

CONFIGURE CHANNEL 1 DEVICE TYPE DISK RATE 20 M;

new RMAN configuration parameters are successfully stored


$ strace -fttx -o /tmp/a1 rman target /

RMAN> backup as copy  datafile 1 format '/u01/backup/%b_o';

Starting backup at 2019-03-01 09:00:21

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=54 device type=DISK

channel ORA_DISK_1: starting datafile copy

input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf

output file name=/u01/backup/system01.dbf_o tag=TAG20190301T090022 RECID=21 STAMP=1001754060

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45

channel ORA_DISK_1: throttle time: 0:00:34

channel ORA_DISK_1: starting datafile copy

copying current control file

channel ORA_DISK_1: throttle time: 0:00:34


 $ grep 'nanosleep(' /tmp/a1 | cut -f1 -d" " | sort | uniq -c

      7 16036

     34 16053


--//进程16053,调用 nanosleep({1, 0}, NULL) = 0,34次(也就是34秒),与rman的输出一致.

--//跟踪如何调用有点蛮烦放弃!!


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

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

注册时间:2008-01-03

  • 博文量
    2850
  • 访问量
    6638319