1. 在使用DBLINK连接远程DB之前,确认是否安全,防止SCN大量跳跃,导致headroom过小。
点击(此处)折叠或打开
- select
- ((((
- ((to_number(to_char(cur_date,'YYYY'))-1988)*12*31*24*60*60) +
- ((to_number(to_char(cur_date,'MM'))-1)*31*24*60*60) +
- (((to_number(to_char(cur_date,'DD'))-1))*24*60*60) +
- (to_number(to_char(cur_date,'HH24'))*60*60) +
- (to_number(to_char(cur_date,'MI'))*60) +
- (to_number(to_char(cur_date,'SS')))
- ) * (16*1024)) - &target_db_scn) --跳跃目标值的10进制,看看跳跃到这个数还能剩多少天
- / (16*1024*60*60*24)
- ) headroom
- from (select sysdate cur_date from dual);
2.查询headroom
点击(此处)折叠或打开
- SELECT SYSDATE sdate,
- 'Headroom',
- ROUND ( (chk16kscn - gscn) / 3600 / 16 / 1024, 1) AS headroom_value
- FROM (SELECT tim,
- gscn,
- rate,
- delta,
- ( ( ( (TO_NUMBER (TO_CHAR (tim, 'YYYY')) - 1988)
- * 12
- * 31
- * 24
- * 60
- * 60)
- + ( (TO_NUMBER (TO_CHAR (tim, 'MM')) - 1)
- * 31
- * 24
- * 60
- * 60)
- + ( ( (TO_NUMBER (TO_CHAR (tim, 'DD')) - 1))
- * 24
- * 60
- * 60)
- + (TO_NUMBER (TO_CHAR (tim, 'HH24')) * 60 * 60)
- + (TO_NUMBER (TO_CHAR (tim, 'MI')) * 60)
- + (TO_NUMBER (TO_CHAR (tim, 'SS'))))
- * (16 * 1024))
- chk16kscn
- FROM (SELECT FIRST_TIME tim,
- (next_time - first_time) * 24 * 60 * 60 delta,
- FIRST_CHANGE# gscn,
- ( (NEXT_CHANGE# - FIRST_CHANGE#)
- / ( (NEXT_TIME - FIRST_TIME) * 24 * 60 * 60))
- rate
- FROM v$archived_log
- WHERE (next_time > first_time))
- ORDER BY 1 DESC)
- WHERE TO_CHAR (tim, 'YYYY/MM/DD HH24') >
- TO_CHAR (SYSDATE - 1, 'YYYY/MM/DD HH24')
- AND ROWNUM < 2
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15412087/viewspace-2157232/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/15412087/viewspace-2157232/