[20190228]Backup Restore Throttle sleep.txt

lfree發表於2019-03-01

[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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章