Oracle SCN健康狀態檢查
步驟1、執行以下指令碼,查詢當前資料庫SCN狀態
SQL> @scnhealthcheck.sql
$ vi scnhealthcheck.sql
Rem
Rem $Header: rdbms/admin/scnhealthcheck.sql st_server_tbhukya_bug-13498243/8 2012/01/17 03:37:18 tbhukya Exp $
Rem
Rem scnhealthcheck.sql
Rem
Rem Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
Rem
Rem NAME
Rem scnhealthcheck.sql - Scn Health check
Rem
Rem DESCRIPTION
Rem Checks scn health of a DB
Rem
Rem NOTES
Rem .
Rem
Rem MODIFIED (MM/DD/YY)
Rem tbhukya 01/11/12 - Created
Rem
Rem
define LOWTHRESHOLD=10
define MIDTHRESHOLD=30
define VERBOSE=FALSE
set veri off;
set feedback off;
set serverout on
DECLARE
verbose boolean:=&&VERBOSE;
BEGIN
For C in (
select
version,
date_time,
dbms_flashback.get_system_change_number current_scn,
indicator
from
(
select
version,
to_char(SYSDATE,'YYYY/MM/DD HH24:MI:SS') DATE_TIME,
((((
((to_number(to_char(sysdate,'YYYY'))-1988)*12*31*24*60*60) +
((to_number(to_char(sysdate,'MM'))-1)*31*24*60*60) +
(((to_number(to_char(sysdate,'DD'))-1))*24*60*60) +
(to_number(to_char(sysdate,'HH24'))*60*60) +
(to_number(to_char(sysdate,'MI'))*60) +
(to_number(to_char(sysdate,'SS')))
) * (16*1024)) - dbms_flashback.get_system_change_number)
/ (16*1024*60*60*24)
) indicator
from v$instance
)
) LOOP
dbms_output.put_line( '-----------------------------------------------------'
|| '---------' );
dbms_output.put_line( 'ScnHealthCheck' );
dbms_output.put_line( '-----------------------------------------------------'
|| '---------' );
dbms_output.put_line( 'Current Date: '||C.date_time );
dbms_output.put_line( 'Current SCN: '||C.current_scn );
dbms_output.put_line( 'SCN Headroom: '||round(C.indicator,2) );
dbms_output.put_line( 'Version: '||C.version );
dbms_output.put_line( '-----------------------------------------------------'
|| '---------' );
IF C.version > '10.2.0.5.0' and
C.version NOT LIKE '9.2%' THEN
IF C.indicator>&MIDTHRESHOLD THEN
dbms_output.put_line('Result: A - SCN Headroom is good');
dbms_output.put_line('Apply the latest recommended patches');
dbms_output.put_line('based on your maintenance schedule');
IF (C.version < '11.2.0.2') THEN
dbms_output.put_line('AND set _external_scn_rejection_threshold_hours='
|| '24 after apply.');
END IF;
ELSIF C.indicator<=&LOWTHRESHOLD THEN
dbms_output.put_line('Result: C - SCN Headroom is low');
dbms_output.put_line('If you have not already done so apply' );
dbms_output.put_line('the latest recommended patches right now' );
IF (C.version < '11.2.0.2') THEN
dbms_output.put_line('set _external_scn_rejection_threshold_hours=24 '
|| 'after apply');
END IF;
dbms_output.put_line('AND contact Oracle support immediately.' );
ELSE
dbms_output.put_line('Result: B - SCN Headroom is low');
dbms_output.put_line('If you have not already done so apply' );
dbms_output.put_line('the latest recommended patches right now');
IF (C.version < '11.2.0.2') THEN
dbms_output.put_line('AND set _external_scn_rejection_threshold_hours='
||'24 after apply.');
END IF;
END IF;
ELSE
IF C.indicator<=&MIDTHRESHOLD THEN
dbms_output.put_line('Result: C - SCN Headroom is low');
dbms_output.put_line('If you have not already done so apply' );
dbms_output.put_line('the latest recommended patches right now' );
IF (C.version >= '10.1.0.5.0' and
C.version <= '10.2.0.5.0' and
C.version NOT LIKE '9.2%') THEN
dbms_output.put_line(', set _external_scn_rejection_threshold_hours=24'
|| ' after apply');
END IF;
dbms_output.put_line('AND contact Oracle support immediately.' );
ELSE
dbms_output.put_line('Result: A - SCN Headroom is good');
dbms_output.put_line('Apply the latest recommended patches');
dbms_output.put_line('based on your maintenance schedule ');
IF (C.version >= '10.1.0.5.0' and
C.version <= '10.2.0.5.0' and
C.version NOT LIKE '9.2%') THEN
dbms_output.put_line('AND set _external_scn_rejection_threshold_hours=24'
|| ' after apply.');
END IF;
END IF;
END IF;
dbms_output.put_line(
'For further information review MOS document id 1393363.1');
dbms_output.put_line( '-----------------------------------------------------'
|| '---------' );
END LOOP;
end;
/
執行結果如下,Result A表示當前SCN狀態良好。
步驟2、查詢當前資料庫SCN自動升級狀態,執行以下儲存過程
$sqlplus / as sysdba
SQL>
set serverout on
declare
v_autorollover_date date;
v_target_compat number;
v_RSL number;
v_hr_in_scn number;
v_hr_in_sec number;
v_t4 number;
v_max_cmpat number;
v_isenabled boolean;
v_current_compat number;
begin
dbms_scn.GETCURRENTSCNPARAMS(v_RSL,v_hr_in_scn,v_hr_in_sec,v_current_compat,v_max_cmpat);
dbms_scn.GETSCNAUTOROLLOVERPARAMS( v_autorollover_date,v_target_compat,v_isenabled);
--dbms_output.put_line('Current SCN compatibility:'||v_current_compat);
--dbms_output.put_line('Current SCN RATE:'||round((v_hr_in_scn/v_hr_in_sec)/1024)||'k');
if (v_isenabled) then
dbms_output.put_line('AUTO SCN compatibility rollover is ENABLED!!!');
dbms_output.put_line('AUTO rollover time:'||to_char(v_autorollover_date,'YYYY/MM/DD'));
dbms_output.put_line('AUTO rollover target value:'||v_target_compat );
else
dbms_output.put_line('AUTO SCN compatibility rollover is DISABLED!!!');
end if;
end;
/
執行結果如下,表示已在2019/6/23日進行了SCN相關調整,級別為3,無需相關操作。
步驟3、查詢當前資料庫DBLINK連結資訊
select * from dba_db_links;
返回為空表示當前資料庫沒有db_link,沒有導致SCN異常的因素。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69994536/viewspace-2772230/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Docker 容器的健康狀態檢查Docker
- 【SCN】Oracle檢查scn值指令碼Oracle指令碼
- oracle物理dg狀態檢查Oracle
- Oracle 檢查點涉及的SCNOracle
- Oracle SCN機制解析 (SCN, checkpoint檢查點) - finalOracle
- Oracle ERP系統健康檢查Oracle
- 利用RDA對Oracle做健康檢查Oracle
- 叢集故障處理之處理思路以及健康狀態檢查(三十二)
- ORACLE SCN 查詢Oracle
- oracle狀態查詢(補)Oracle
- oracle常用狀態查詢Oracle
- 漫談Oracle資料庫健康檢查Oracle資料庫
- Oracle資料庫健康檢查常用SQLOracle資料庫SQL
- 檢查Oracle的鎖狀態並清除問題會話Oracle會話
- RAC常見命令檢查狀態
- 2.檢查網路狀態
- linux檢查埠狀態命令Linux
- 檢查Capital許可狀態API
- 查詢Oracle的SCNOracle
- oracle 資料庫效能健康檢查指令碼Oracle資料庫指令碼
- oracle資料庫健康檢查報告模板Oracle資料庫
- Oracle 11g RAC 檢查各部分執行狀態Oracle
- EntityFramework Core健康檢查Framework
- Health Monitor 健康檢查
- uptime命令檢視Linux伺服器健康狀態Linux伺服器
- 深入淺出-檢查點scn
- 檢查點機制與scn
- 使用Spring Boot實現動態健康檢查HealthChecksSpring Boot
- 檢查點和oracle資料庫的恢復(一)SCNOracle資料庫
- (轉)oracle 資料庫效能健康檢查指令碼Oracle資料庫指令碼
- 如何檢測機械硬碟和固態硬碟的健康狀況?硬碟
- 網路狀態的檢查和MJRefresh
- 11G RAC檢查各元件狀態元件
- SOFABoot 健康檢查能力分析boot
- 【TUNE_ORACLE】Oracle健康檢查基礎專案(四)專案檢查步驟概述其三Oracle
- 【TUNE_ORACLE】Oracle健康檢查基礎專案(三)專案檢查步驟概述其二Oracle
- 【TUNE_ORACLE】Oracle健康檢查基礎專案(二)專案檢查步驟概述其一Oracle
- 1 Oracle Database 11.2.0.3.0 RAC On Oralce Linux 6.5 使用-檢查RAC狀態OracleDatabaseLinux