2022年ORACLE健康检查脚本 .pdf
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《2022年ORACLE健康检查脚本 .pdf》由会员分享,可在线阅读,更多相关《2022年ORACLE健康检查脚本 .pdf(9页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Rem Rem chk_health.sql Rem 1.0 Rem by Pond Ka Rem Rem usage: sqlplus system/password_of_systemconnect_string chk_health.sql Rem only for single instance database Rem not suitable for RAC Rem only tested under 9.2.0 Rem Rem Rem This script do health check . Rem Must run under system or user has dba p
2、rivilege. Rem set pages 0 set lines 1000 set trimspool on set head off set feedback off set echo off set verify off Rem get report name based on database name and report date Rem col logname noprint new_value log_name select lower(name)|to_char(sysdate,yyyymmddhh24mi)|.txt logname from v$database; s
3、pool &log_name Rem Rem report header Rem prompt select Report produced at |to_char(sysdate, yyyy-mm-dd hh24:mi:ss) from dual; prompt prompt Basic information: prompt - Rem Rem Check database information 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 9 页 - - - -
4、 - - - - - Rem set head on set pages 45 col dbid heading Database|ID format a11 col name heading Database|Name col open_mode heading Open |Mode col force_logging heading Force|Logging format a7 select to_char(dbid,9999999999) dbid , name , open_mode , force_logging from v$database ; Rem Rem Check in
5、stance information Rem col instance_name heading Instance|Name format a10 col host_name heading Host|Name format a10 col status heading Instance|Status format a8 col archiver heading Archiver|Status format a8 col up_time heading Running Time format a30 select host_name , instance_name , status , arc
6、hiver , trunc(sysdate - startup_time) | Days | trunc(mod(sysdate-startup_time, 1) *24) | Hours | trunc(mod(sysdate-startup_time)*24,1)*60) | Minutes up_time from v$instance ; prompt prompt prompt Check hit ratio prompt These value expected higher than 90% prompt - Rem Rem Check buffer cache hit rati
7、o 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 9 页 - - - - - - - - - Rem col pr heading Physical|Reads format 999,999,999 col prd heading Phy_Reads|Direct format 999,999,999 col prl heading Phy_Reads|Direct_LOB format 999,999,999 col bg heading Block|Gets for
8、mat 999,999,999,999 col cg heading Consistent|Gets format 999,999,999,999 col ht heading Buffer|Hit Ratio select to_char(1-(pr - prd - prl) / (bg + cg - prd - prl) * 100, 999.9)|% ht , bg, cg, pr, prd, prl from (select value pr from v$sysstat where name = physical reads) pr , (select value prd from
9、v$sysstat where name = physical reads direct) prd , (select value prl from v$sysstat where name = physical reads direct (lob) prl , (select value bg from v$sysstat where name = db block gets) bg , (select value cg from v$sysstat where name = consistent gets) cg ; Rem Rem check library hit ratio Rem
10、col ht heading Libray|Hit Ratio format a10 select to_char(sum(pinhits) / sum(pins) * 100, 999.9)|% ht from v$librarycache ; prompt prompt Check session informations prompt - Rem Rem Check session high water mark Rem col sessions_current heading Sessions|Current format 999,999,999 col sessions_highwa
11、ter heading Sessions|High Water format 999,999,999 select sessions_current , sessions_highwater from v$license ; Rem 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 9 页 - - - - - - - - - Rem Check session wait events Rem col username heading User Name format a15
12、 col program heading Program format a35 col event heading Wait Event format a25 prompt prompt Session wait events, excluding waiting for users message prompt _ select s.username, s.program, sw.event from v$session_wait sw , v$session s where sw.sid = s.sid and s.username is not null and event not in
13、 (SQL*Net message from client) ; Rem Rem Check session status Rem col status heading Session|Status col nu heading Number|of Sessions compute sum of nu on report break on report prompt prompt Session status prompt - select status, count(*) nu from v$session where username is not null group by status
14、 ; clear break; Rem Rem detail information for sessions which idle for more than 4 hours Rem col lc heading Idle Time|(Hours) format a8 col username format a10 heading Database|Username 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 9 页 - - - - - - - - - col ma
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年ORACLE健康检查脚本 2022 ORACLE 健康 检查 脚本
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内