ITPub博客

首页 > 数据库 > Oracle > 监控rman备份

监控rman备份

原创 Oracle 作者:baizhaoxian 时间:2011-07-13 10:23:13 0 删除 编辑

记录rman备份的监控

[@more@]

1、备份脚本代码,设置COMMAND ID参数
run{
allocate channel c0 type disk;
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
set command id to 'rman';
backup full database format '/home/oracle/backup/full_%d_%T_%s';
backup archivelog all format '/home/oracle/backup/arch_%d_%T_%s' ;
backup current controlfile format '/home/oracle/backup/cn_%d_%T_%s';
release channel c0;
release channel c1;
release channel c2;
release channel c3;
}
2、查询v$process和v$session哪些session对应到哪些channel
SELECT sid, spid, client_info FROM v$process p, v$session s
WHERE p.addr = s.paddr AND client_info LIKE '%id=rman%';
-------------------------------------------------------------
SID SPID CLIENT_INFO
----------------------------------------------------------------
141 6392 id=rman
149 6414 id=rman,rman channel=c0
140 6415 id=rman,rman channel=c1
SID SPID CLIENT_INFO
----------------------------------------------------------------
159 6416 id=rman,rman channel=c2

157 6417 id=rman,rman channel=c3
3、查询v$sesiion_longops以得到副本的状态
SELECT sid, serial#, context, sofar, totalwork,round(sofar/totalwork*100,2) "% Complete"
FROM V$SESSION_LONGOPS
WHERE opname LIKE 'RMAN:%'
AND opname NOT LIKE 'RMAN: aggregate%'
AND totalwork != 0;
--------------------------------
SID SERIAL# CONTEXT SOFAR TOTALWORK % Complete
---------- ---------- ---------- ---------- ---------- ----------
137 890 1 65280 65280 100
137 890 2 48954 48954 100
149 1469 1 66560 66560 100
149 1469 2 39706 39706 100
141 426 1 195360 195360 100
141 426 2 146494 146494 100
149 1493 1 65280 65280 100
149 1493 2 48954 48954 100
157 516 1 31360 31360 100
157 516 2 27127 27127 100
140 1022 1 53760 53760 100

SID SERIAL# CONTEXT SOFAR TOTALWORK % Complete
---------- ---------- ---------- ---------- ---------- ----------
140 1022 2 39698 39698 100
159 1628 1 44960 44960 100
159 1628 2 30721 30721 100
141 413 1 63520 63520 100
141 413 2 57838 57838 100
149 1469 2 472 472 100
149 1469 1 470 470 100
149 1469 1 302510 302510 100
149 1469 2 302512 302512 100
137 890 1 184231 184231 100
137 890 2 184233 184233 100

SID SERIAL# CONTEXT SOFAR TOTALWORK % Complete
---------- ---------- ---------- ---------- ---------- ----------
149 1469 1 66560 66560 100
149 1469 2 39706 39706 100
137 890 1 65280 65280 100
137 890 2 48954 48954 100
141 413 1 63520 63520 100
141 413 2 57838 57838 100
28 rows selected.
4、如果备份设备采用sbt,当拷贝进程显示挂起时,查询v$session_wait,
使用第2步查询出的语句如下:
SELECT * FROM V$SESSION_WAIT WHERE event LIKE '%sbt%' and SID=?;
SELECT * FROM V$SESSION_WAIT WHERE event LIKE '%disk%' and SID=?;
5、备份数据所处于目录:
ls -la /home/oracle/backup
total 1180892
drwxr-xr-x 2 oracle oinstall 4096 May 6 07:12 .
drwx------ 19 oracle oinstall 4096 Apr 24 07:20 ..
-rw-r----- 1 oracle oinstall 87040 May 6 07:12 arch_MICHAEL_20110506_226
-rw-r----- 1 oracle oinstall 7733248 May 6 07:12 cn_MICHAEL_20110506_227
-rw-r----- 1 oracle oinstall 401047552 May 6 07:10 full_MICHAEL_20110506_222
-rw-r----- 1 oracle oinstall 325222400 May 6 07:10 full_MICHAEL_20110506_223
-rw-r----- 1 oracle oinstall 251682816 May 6 07:08 full_MICHAEL_20110506_224
-rw-r----- 1 oracle oinstall 222240768 May 6 07:07 full_MICHAEL_20110506_225

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

请登录后发表评论 登录
全部评论

注册时间:2008-10-23

  • 博文量
    29
  • 访问量
    123502