巡检脚本如下:

[oracle@oracle-db-19c check]$ ls -ltr
total 24
-rw-r--r--. 1 oracle oinstall 22753 Jan  5 16:12 ORAcheck.sql
[oracle@oracle-db-19c check]$ cat ORAcheck.sql
set heading off
select '一、数据库的基本情况' from dual;set heading off
select '1、数据库版本' from dual;
set heading on
select * from v$version;set heading off
select '2、查看数据库基本信息' from dual;
set heading on
set linesize 500
col host_name for a20
select dbid,name,instance_name,instance_name,version,parallel rac,host_name from v$database,v$instance;set heading off
select '3、实例状态' from dual;
set heading on
select instance_number,instance_name ,status from gv$instance;set heading off
select '4、数据库运行时间' from dual;
set heading on
select to_char(startup_time,'DD-MON-YYYY HH24:MI:SS') 启动时间,
TRUNC(sysdate - (startup_time))||'天 '||TRUNC(24*((sysdate-startup_time) -TRUNC(sysdate-startup_time)))
||'小时 '||MOD(TRUNC(1440*((SYSDATE-startup_time)-TRUNC(sysdate-startup_time))),60)
||'分 '||MOD(TRUNC(86400*((SYSDATE-STARTUP_TIME)-TRUNC(SYSDATE-startup_time))),60)
||'秒' 运行时间
from v$instance;set heading off
select '5、内存情况' from dual;
set heading on
select * from v$sgainfo;set heading off
select '6、cpu情况' from dual;
set heading on
col STAT_NAME for a20
col COMMENTS for a50
Select stat_name,value,comments from v$osstat where stat_name in ('NUM_CPUS','IDLE_TIME','BUSY_TIME','USER_TIME','SYS_TIME','IOWAIT_TIME');set heading off
select '二、检查Oracle对象状态' from  dual;set heading off
select '1、查看参数文件位置' from dual;
show parameter spfileset heading off
col NAME for a50
select '2、查看控制文件' from dual;
set heading on
select status,name from v$controlfile;set heading off
select '3、查看在线日志' from dual;
set heading on
col MEMBER for a50
select group#,status,type,member from v$logfile;set heading off
select '4、检查日志切换频率' from dual;
set heading on
select sequence#,to_char(first_time,'yyyymmdd_hh24:mi:ss') firsttime,round((first_time-lag(first_time) over(order by first_time))*24*60,2) minutes from v$log_history where first_time > sysdate - 1 order by first_time ,minutes;set heading off
select '5、查看数据文件' from dual;
set heading on
col NAME  for a50
select name,status from v$datafile;set heading off
select '6、查看无效的对象' from dual;
set heading on
set linesize 500
select owner,object_name,object_type from dba_objects where status!='VALID' and owner!='SYS' and owner!='SYSTEM';set heading off
select '7、查看回滚段状态' from dual;
set heading on
select segment_name,status from dba_rollback_segs;set heading off
select '8、检查是否有禁用约束' from dual;
set heading on
set linesize 1000
SELECT owner, constraint_name, table_name, constraint_type, statusFROM dba_constraintsWHERE status ='DISABLE' and constraint_type='P';set heading off
select '9、检查是否有禁用触发器' from dual;
set heading on
col owner for a10
col taigger_name for a10
col table_name for a30
col table_name for a30SELECT owner, trigger_name, table_name, status FROM dba_triggers WHERE status = 'DISABLED';set heading off
select '10、Oracle Job是否有失败' from dual;
set heading on
select job,what,last_date,next_date,failures,broken from dba_jobs Where schema_user='CAIKE';set heading off
select '11、检查失效的索引' from dual;
set heading on
select index_name,table_name,tablespace_name,status From dba_indexes Where owner='CTAIS2' And status<>'VALID';set heading off
select '三、检查Oracle相关资源的使用情况' from dual;set heading off
select '1、查看表空间的使用情况' from dual;
set heading on
set linesize 1000
SELECT UPPER(F.TABLESPACE_NAME) "tablespace_name",
D.TOT_GROOTTE_MB "tablesapce_size(M)",
D.TOT_GROOTTE_MB - F.TOTAL_BYTES "used_tablespace_size(M)",
TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100,2),'990.99') "used%",
F.TOTAL_BYTES "free_size(M)",
F.MAX_BYTES "max_byte(M)"
FROM (SELECT TABLESPACE_NAME,    ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES,    ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTES    FROM SYS.DBA_FREE_SPACE    GROUP BY TABLESPACE_NAME) F,
(SELECT DD.TABLESPACE_NAME,    ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB    FROM SYS.DBA_DATA_FILES DD    GROUP BY DD.TABLESPACE_NAME) D
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME
ORDER BY 4 DESC;set heading off
select '2、查看临时表空间使用情况' from dual;
set heading on
select tablespace_name , sum(bytes)/1024/1024 from dba_temp_files group by tablespace_name;set heading off
select '3、查看临时段使用的情况' from dual;
set heading on
COL username FORMAT a10;
COL segtype FORMAT a10;
SELECT username, segtype, extents "Extents Allocated"
,blocks "Blocks Allocated"
FROM v$tempseg_usage;set heading off
select '4、查看所有数据文件i/o情况' from dual;
set heading on
SELECT ts.name AS ts, fs.phyrds "Reads", fs.phywrts "Writes"
,fs.phyblkrd AS br, fs.phyblkwrt AS bw
,fs.readtim "RTime", fs.writetim "WTime"
FROM v$tablespace ts, v$datafile df, v$filestat fs
WHERE ts.ts# = df.ts# AND df.file# = fs.file#
UNION
SELECT ts.name AS ts, ts.phyrds "Reads", ts.phywrts "Writes"
,ts.phyblkrd AS br, ts.phyblkwrt AS bw
,ts.readtim "RTime", ts.writetim "WTime"
FROM v$tablespace ts, v$tempfile tf, v$tempstat ts
WHERE ts.ts# = tf.ts# AND tf.file# = ts.file# ORDER BY 1;set heading off
select '5、查看top 10 热segment' from dual;
set heading on
col objct_name for a30
col OWNER  for a20
select * from
(selectob.owner, ob.object_name, sum(b.tch) Touchsfrom x$bh b , dba_objects obwhere b.obj = ob.data_object_idand b.ts# > 0group by ob.owner, ob.object_nameorder by sum(tch) desc)
where rownum <=10;set heading off
select '6、查看物理读最多的object' from dual;
set heading on
select * from (select owner,object_name,value from  v$segment_statistics where statistic_name='physical reads' order by value desc) where rownum<=10;set heading off
select '7、查看热点数据文件(从单块读取时间判断)' from dual;
set heading on
SELECT t.file_name,t.tablespace_name,round(s.singleblkrdtim / s.singleblkrds, 2) AS CS,  s.READTIM,s.WRITETIMFROM v$filestat s, dba_data_files tWHERE s.file# = t.file_id and rownum<=10 order by cs desc;set heading off
select '8、检查Oracle初始化文件中相关参数值' from dual;
set heading on
select resource_name,max_utilization,initial_allocation,limit_value from v$resource_limit;
set heading off
select '注:若LIMIT_VALU - MAX_UTILIZATION<=5,则表明与RESOURCE_NAME相关的Oracle初始化参数需要调整。可以通过参数文件调整。' from dual;set heading off
select '9、检查数据库连接情况' from dual;
set heading on
select sid,serial#,username,program,machine,status from v$session;
set heading off
select "(注:杀掉会话的语句alter system kill session 'SID,SERIAL#')" from dual;set heading off
select '10、查看热点数据文件' from dual;
set heading on
SELECT t.file_name,t.tablespace_name,round(s.singleblkrdtim / s.singleblkrds, 2) AS CS,  s.READTIM,s.WRITETIM
FROM v$filestat s, dba_data_files t
WHERE s.file# = t.file_id and rownum<=10 order by cs desc;set heading off
select ' 11、检查一些扩展异常的对象 ' from dual;
set heading onselect Segment_Name, Segment_Type, TableSpace_Name,(Extents/Max_extents)*100 Percent
From sys.DBA_Segments
Where Max_Extents != 0 and (Extents/Max_extents)*100>=95
order By Percent;set heading off
select ' 12、检查system表空间内的内容 ' from dual;
set heading on
select distinct(owner) from dba_tables
where tablespace_name='SYSTEM' and
owner!='SYS' and owner!='SYSTEM'
union
select distinct(owner) from dba_indexes
where tablespace_name='SYSTEM' and
owner!='SYS' and owner!='SYSTEM';set heading off
select ' 13、检查对象的下一扩展与表空间的最大扩展值 ' from dual;
set heading on
select a.table_name, a.next_extent, a.tablespace_name
from all_tables a,
(select tablespace_name, max(bytes) as big_chunk
from dba_free_space
group by tablespace_name ) f
where f.tablespace_name = a.tablespace_name
and a.next_extent > f.big_chunk
union
select a.index_name, a.next_extent, a.tablespace_name
from all_indexes a,
(select tablespace_name, max(bytes) as big_chunk
from dba_free_space
group by tablespace_name ) f
where f.tablespace_name = a.tablespace_name
and a.next_extent > f.big_chunk;set heading off
select '四、内存的具体查看' from dual;set heading off
select '  1、查看内存占用各个池子大小' from dual;
set heading on
COL name FORMAT a32;
SELECT pool, name, bytes FROM v$sgastat
WHERE pool IS NULL
OR pool != 'shared pool' OR (pool = 'shared pool'
AND (name IN('dictionary cache','enqueue','library cache','parameters','processes','sessions','free memory')))
ORDER BY pool DESC NULLS FIRST, name;set heading off
select '  2、检查shered pool  free  space ' from dual;
set heading on
SELECT * FROM V$SGASTAT
WHERE NAME = 'free memory'
AND POOL = 'shared pool';set heading off
select '  3、检查shared pool中library cach ' from dual;
set heading on
select namespace,pinhitratio from v$librarycache;set heading off
select '  4、检查整体命中率(library cache)' from dual;
set heading on
select sum(pins) "hits",sum(reloads) "misses",sum(pins)/(sum(pins)+sum(reloads)) "Hits Ratio"
from v$librarycache;set heading off
select '  5、library cache中详细比率信息' from dual;
set heading on
SELECT 'Library Lock Requests' "Ratio"                                                            , ROUND(AVG(gethitratio) * 100, 2)                          ||'%' "Percentage" FROM V$LIBRARYCACHE
UNION
SELECT 'Library Pin Requests' "Ratio",ROUND(AVG(pinhitratio)* 100, 2)                                                    ||'%' "Percentage" FROM V$LIBRARYCACHE
UNION
SELECT 'Library I/O Reloads' "Ratio"                        , ROUND((SUM(reloads) / SUM(pins)) * 100, 2)                ||'%' "Percentage" FROM V$LIBRARYCACHE
UNION
SELECT 'Library Reparses' "Ratio"                            , ROUND((SUM(reloads) / SUM(pins)) * 100, 2)                ||'%' "Percentage" FROM V$LIBRARYCACHE;set heading off
select '  6、检查数据字典的命中率' from dual;
set heading on
SELECT (SUM(GETS - GETMISSES - FIXED)) / SUM(GETS) "ROW CACHE" FROM V$ROWCACHE;
set heading off
select '注:row cache的命中率至少小于90%' from dual;set heading off
select '  7、每个子shared pool由 单独的shared pool latch保护 查看 他们的命中率 ' from dual;
set heading on
col name format a15
select addr,name,gets,misses,1-misses/gets from v$latch_children where name='shared pool';set heading off
select ' 8、查看shared pool建议' from dual;
set heading on
column c1     heading 'Pool |Size(M)'
column c2     heading 'Size|Factor'
column c3     heading 'Est|LC(M)  '
column c4     heading 'Est LC|Mem. Obj.'
column c5     heading 'Est|Time|Saved|(sec)'
column c6     heading 'Est|Parse|Saved|Factor'
column c7     heading 'Est|Object Hits'   format 999,999,999
SELECT shared_pool_size_for_estimate c1,shared_pool_size_factor c2,estd_lc_size c3,estd_lc_memory_objects c4,estd_lc_time_saved c5,estd_lc_time_saved_factor c6,to_char(estd_lc_memory_object_hits,99999999999) c7 FROM V$SHARED_POOL_ADVICE;set heading off
select ' 9、查看shared pool中 各种类型的chunk的大小数量' from dual;
set heading on
SELECT KSMCHCLS CLASS, COUNT(KSMCHCLS) NUM, SUM(KSMCHSIZ) SIZ,To_char( ((SUM(KSMCHSIZ)/COUNT(KSMCHCLS)/1024)),'999,999.00')||'k' "AVG SIzE"
FROM X$KSMSP GROUP BY KSMCHCLS;set heading off
select ' 10、查看使用shard_pool保留池情况' from dual;
set heading on
SELECT request_misses, request_failures, free_space
FROM v$shared_pool_reserved;set heading off
select '11、 pga 建议' from dual;
set heading on
SELECT (SELECT ROUND(value/1024/1024,0) FROM v$parameter
WHERE name = 'pga_aggregate_target') "Current Mb"
, ROUND(pga_target_for_estimate/1024/1024,0) "Projected Mb"
, ROUND(estd_pga_cache_hit_percentage) "%"
FROM v$pga_target_advice
ORDER BY 2;set heading off
select ' 12、查看buffer cache 命中率' from dual;
set heading onselect 1-(sum(decode(name, 'physical reads', value, 0))/(sum(decode(name, 'db block gets', value, 0))+(sum(decode(name, 'consistent gets', value, 0))))) "Buffer Hit Ratio"
from v$sysstat;set heading off
select ' 13、查看buffer cache设置大小建议' from dual;
set heading on
select size_for_estimate, estd_physical_read_factor, to_char(estd_physical_reads,99999999999999999999999) as"estd_physical_reads" from v$db_cache_advice  where name = 'DEFAULT';set heading off
select '14、查看buffer cache中defalut pool 命中率' from dual;
set heading on
select name,1-(physical_reads)/(consistent_gets+db_block_gets)
from v$buffer_pool_statistics;
set heading off
select '注:default池命中率至少要大于90%' from dual;set heading off
select '15、检查lgwr i/o性能' from dual;
set heading on
select total_waits,time_waited,average_wait,time_waited/total_waits as avg from v$system_event where event = 'log file parallel write';set heading off
select '16、检查与redo相关性能指标' from dual;
set heading on
set linesize 500
select name,value from v$sysstat where name like '%redo%';set heading off
select ' 17、查询redo block size' from dual;
set heading on
select max(lebsz) from x$kccle;set heading off
select '18、  计算出每个事务平均处理多少个redo block' from dual;
set heading on
select a.redoblocks/b.trancount from (select value redoblocks from v$sysstat where name='redo blocks written') a ,(select value trancount from v$sysstat where name='user commits') b;set heading off
select ' 19、 检查undo rollback segment 使用情况' from dual;
set heading on
col name for a60
select name ,rssize,extents,latch,xacts,writes,gets,waits from v$rollstat a,v$rollname b where a.usn=b.usn order by waits desc;set heading off
select '  20、计算每秒钟产生的undoblk数量' from dual;
set heading on
select sum(undoblks)/sum((end_time-begin_time)*24*60*60) from v$undostat;set heading off
select ' 21、查询undo具体信息' from dual;
set heading onCOL undob FORMAT 99990;
COL trans FORMAT 99990;
COL snapshot2old FORMAT 9999999990;
SELECT undoblks "UndoB", txncount "Trans",maxquerylen "LongestQuery", maxconcurrency "MaxConcurrency",ssolderrcnt "Snapshot2Old", nospaceerrcnt "FreeSpaceWait"
FROM v$undostat;set heading off
select ' 22、查询rollback 段详细信息(收缩次数,扩展次数,平均活动事务等)' from dual;
set heading onCOL RBS FORMAT a50;SELECT n.name "RBS", s.extends "Extends", s.shrinks "Shrinks",s.wraps "Wraps", s.aveshrink "AveShrink",s.aveactive "AveActive"
FROM v$rollname n JOIN v$rollstat s USING(usn)
WHERE n.name != 'SYSTEM';set heading off
select ' 23、查询当前rollback segment使用情况' from dual;
set heading onCOL RBS FORMAT a50;
SELECT n.name "RBS", s.status, s.waits, s.gets, to_char(s.writes,'9999999999999'),s.xacts "Active Trans"
FROM v$rollname n JOIN v$rollstat s USING(usn)
WHERE n.name != 'SYSTEM';set heading off
select '24、查询使用rollback segment时等待比率' from dual;
set heading on
SELECT ROUND(SUM(waits/gets)*100,2)||'%' "Contention" FROM v$rollstat;set heading off
select '25、查询使用rollback segment时等待比率及其平局活动事务数' from dual;
set heading on
COL contention FORMAT 9999999990;
SELECT AVG(xacts) "Trans per RBS",ROUND(SUM(waits/gets)*100,2)||'%' "Contention"
FROM v$rollstat;set heading off
select '五、检查Oracle数据库性能' from dual;set heading off
select '1、检查数据库的等待事件' from dual;
set heading on
set pages 80
set lines 120
col event for a40
select sid,event,p1,p2,p3,WAIT_TIME,SECONDS_IN_WAIT from v$session_wait where event not like 'SQL%' and event not like 'rdbms%';set heading off
select '2、查看与redo相关等待事件' from dual;
set heading on
col event format a40
select event,total_waits,total_timeouts,average_wait from v$system_event where upper(event) like'%REDO%';set heading off
select '3、查看session redo event' from dual;
set heading on
select event,total_waits,total_timeouts,average_wait from v$session_event where upper(event) like'%REDO%';set heading off
select '4、Disk Read最高的SQL语句的获取' from dual;
set heading on
SELECT SQL_TEXT FROM (SELECT * FROM V$SQLAREA ORDER BY DISK_READS) WHERE ROWNUM<=5  order  by SQL_TEXT descset heading off
select '5、查找前十条性能差的sql' from dual;
set heading on
SELECT * FROM (SELECT PARSING_USER_ID,EXECUTIONS,SORTS,COMMAND_TYPE,DISK_READS,SQL_TEXT FROM V$SQLAREA ORDER BY DISK_READS DESC) WHERE ROWNUM<10 ;set heading off
select '6、等待时间最多的5个系统等待事件的获取' from dual;
set heading on
SELECT * FROM (SELECT * FROM V$SYSTEM_EVENT WHERE EVENT NOT LIKE 'SQL%' ORDER BY TOTAL_WAITS DESC) WHERE ROWNUM<=5;set heading off
select '7、检查运行很久的SQL' from dual;
set heading on
COLUMN USERNAME FORMAT A12
COLUMN OPNAME FORMAT A16
COLUMN PROGRESS FORMAT A8
SELECT USERNAME,SID,OPNAME,ROUND(SOFAR*100 / TOTALWORK,0) || '%' AS PROGRESS,TIME_REMAINING,SQL_TEXT FROM V$SESSION_LONGOPS , V$SQL WHERE TIME_REMAINING <> 0 AND SQL_ADDRESS=ADDRESS AND SQL_HASH_VALUE = HASH_VALUE;set heading off
select '9、检查碎片程度高的表' from dual;
set heading on
SELECT segment_name table_name,COUNT(*) extents FROM dba_segments WHERE owner NOT IN('SYS', 'SYSTEM') GROUP BY segment_name HAVING COUNT(*)=(SELECT MAX(COUNT(*))
FROM dba_segments GROUP BY segment_name);set heading off
select '10、检查死锁及处理' from dual;
set heading oncol sid for 999999
col username for a10
col schemaname for a10
col osuser for a16
col machine for a16
col terminal for a20
col owner for a10
col object_name for a30
col object_type for a10
select sid,serial#,username,SCHEMANAME,osuser,MACHINE,terminal,PROGRAM,owner,object_name,object_type,o.object_id
from dba_objects o,v$locked_object l,v$session s
where o.object_id=l.object_id and s.sid=l.session_id;set heading off
select '11、查看数据库中行chain' from dual;
set heading on
SELECT 'Chained Rows ' "Ratio"
, ROUND((SELECT SUM(value) FROM V$SYSSTAT
WHERE name = 'table fetch continued row')/ (SELECT SUM(value) FROM V$SYSSTAT
WHERE name IN ('table scan rows gotten', 'table fetch by rowid'))* 100, 3)||'%' "Percentage"
FROM DUAL;set heading off
select '12、查询解析比率' from dual;
set heading onSELECT 'Soft Parses ' "Ratio", ROUND(((SELECT SUM(value) FROM V$SYSSTAT WHERE name = 'parse count (total)')- (SELECT SUM(value) FROM V$SYSSTAT WHERE name = 'parse count (hard)'))/ (SELECT SUM(value) FROM V$SYSSTAT WHERE name = 'execute count')* 100, 2)||'%' "Percentage"
FROM DUAL
UNION
SELECT 'Hard Parses ' "Ratio"
, ROUND((SELECT SUM(value) FROM V$SYSSTAT WHERE name = 'parse count (hard)')/ (SELECT SUM(value) FROM V$SYSSTAT WHERE name = 'execute count') * 100, 2)||'%' "Percentage"
FROM DUAL
UNION
SELECT 'Parse Failures ' "Ratio"
, ROUND((SELECT SUM(value) FROM V$SYSSTAT WHERE name = 'parse count (failures)')/ (SELECT SUM(value) FROM V$SYSSTAT WHERE name = 'parse count (total)')* 100, 5)||'%' "Percentage"
FROM DUAL;set heading off
select '13、查看与latch有关的event信息' from dual;
set heading on
COL event FORMAT a20;
COL waits FORMAT 9999990;
COL timeouts FORMAT 99999990;
COL average FORMAT 99999990;
SELECT event "Event", time_waited "Total Time", total_waits "Waits",average_wait "Average", total_timeouts "Timeouts"
FROM V$SYSTEM_EVENT
WHERE event = 'latch free'
ORDER BY EVENT;set heading off
select '14、查看大表小表扫描对应的值' from dual;
set heading onSELECT value, name FROM V$SYSSTAT WHERE name IN ('table fetch by rowid', 'table scans (short tables)', 'table scans (long tables)');SELECT 'Short to Long Full Table Scans' "Ratio", ROUND((SELECT SUM(value) FROM V$SYSSTAT WHERE name = 'table scans (short tables)')/
(SELECT SUM(value) FROM V$SYSSTAT WHERE name IN ('table scans (short tables)', 'table scans (long tables)'))* 100, 2)||'%' "Percentage" FROM DUAL
UNION
SELECT 'Short Table Scans ' "Ratio", ROUND((SELECT SUM(value) FROM V$SYSSTAT WHERE name = 'table scans (short tables)')/ (SELECT SUM(value) FROM V$SYSSTAT WHERE name IN
('table scans (short tables)', 'table scans (long tables)', 'table fetch by rowid'))* 100, 2)||'%' "Percentage" FROM DUAL
UNION
SELECT 'Long Table Scans ' "Ratio", ROUND((SELECT SUM(value) FROM V$SYSSTAT WHERE name = 'table scans (long tables)')/ (SELECT SUM(value) FROM V$SYSSTAT WHERE name IN
('table scans (short tables)', 'table scans (long tables)', 'table fetch by rowid'))* 100, 2)||'%' "Percentage" FROM DUAL
UNION
SELECT 'Table by Index ' "Ratio", ROUND((SELECT SUM(value) FROM V$SYSSTAT WHERE name = 'table fetch by rowid')/ (SELECT SUM(value) FROM V$SYSSTAT WHERE name IN
('table scans (short tables)', 'table scans (long tables)', 'table fetch by rowid'))* 100, 2)||'%' "Percentage" FROM DUAL
UNION
SELECT 'Efficient Table Access ' "Ratio", ROUND((SELECT SUM(value) FROM V$SYSSTAT WHERE name IN ('table scans (short tables)','table fetch by rowid'))/ (SELECT SUM(value) FROM V$SYSSTAT WHERE name IN
('table scans (short tables)', 'table scans (long tables)', 'table fetch by rowid'))* 100, 2)||'%' "Percentage" FROM DUAL;set heading off
select '15、index使用比率' from dual;
set heading oncol name for a30
SELECT to_char(value,'999999999999999999999'), name FROM V$SYSSTAT WHERE name IN ('table fetch by rowid', 'table scans (short tables)', 'table scans (long tables)') OR name LIKE 'index fast full%' OR name = 'index fetch by key';SELECT 'Index to Table Ratio ' "Ratio" , ROUND((SELECT SUM(value) FROM V$SYSSTAT WHERE name LIKE 'index fast full%' OR name = 'index fetch by key' OR name = 'table fetch by rowid')/ (SELECT SUM(value) FROM V$SYSSTAT WHERE name IN
('table scans (short tables)', 'table scans (long tables)')),0)||':1' "Result" FROM DUAL;set heading off
select '16、等待class' from dual;
set heading on
col wait_class for a30
SELECT wait_class, COUNT(wait_class) FROM v$system_event
GROUP BY wait_class ORDER BY 1;[oracle@oracle-db-19c check]$ 

巡检结果如下:

oracle@oracle-db-19c check]$ pwd
/home/oracle/scripts/check
[oracle@oracle-db-19c check]$ sqlplus / as sysdbaSQL*Plus: Release 19.0.0.0.0 - Production on Thu Jan 5 16:31:38 2023
Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle.  All rights reserved.Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0SQL> alter session set container=PDB1;Session altered.SQL> @/home/oracle/scripts/check/ORAcheck.sql一、数据库的基本情况1、数据库版本BANNER
--------------------------------------------------------------------------------
BANNER_FULL
--------------------------------------------------------------------------------
BANNER_LEGACY
--------------------------------------------------------------------------------CON_ID
----------
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production0BANNER
--------------------------------------------------------------------------------
BANNER_FULL
--------------------------------------------------------------------------------
BANNER_LEGACY
--------------------------------------------------------------------------------CON_ID
----------2、查看数据库基本信息DBID NAME                        INSTANCE_NAME                                    INSTANCE_NAME                                    VERSION                                             RAC       HOST_NAME
---------- --------------------------- ------------------------------------------------ ------------------------------------------------ --------------------------------------------------- --------- --------------------
1093429351 CDB1                        cdb1                                             cdb1                                             19.0.0.0.0                                          NO        oracle-db-19c3、实例状态INSTANCE_NUMBER INSTANCE_NAME                                    STATUS
--------------- ------------------------------------------------ ------------------------------------1 cdb1                                             OPEN4、数据库运行时间启动时间
---------------------------------------------------------------------------------------
运行时间
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
03-JAN-2023 11:15:31
2天 5小时 16分 21秒5、内存情况NAME                                                                                                  BYTES RESIZEABL     CON_ID
------------------------------------------------------------------------------------------------ ---------- --------- ----------
Fixed SGA Size                                                                                      9137968 No                 0
Redo Buffers                                                                                       16027648 No                 0
Buffer Cache Size                                                                                 306184192 Yes                0
In-Memory Area Size                                                                                       0 No                 0
Shared Pool Size                                                                                  293601280 Yes                0
Large Pool Size                                                                                     4194304 Yes                0
Java Pool Size                                                                                            0 Yes                0
Streams Pool Size                                                                                         0 Yes                0
Shared IO Pool Size                                                                                25165824 Yes                0
Data Transfer Cache Size                                                                                  0 Yes                0
Granule Size                                                                                        4194304 No                 0NAME                                                                                                  BYTES RESIZEABL     CON_ID
------------------------------------------------------------------------------------------------ ---------- --------- ----------
Maximum SGA Size                                                                                  629145392 No                 0
Startup overhead in Shared Pool                                                                   193465328 No                 0
Free SGA Memory Available                                                                                 0                    014 rows selected.6、cpu情况STAT_NAME                 VALUE COMMENTS
-------------------- ---------- --------------------------------------------------
NUM_CPUS                      4 Number of active CPUs
IDLE_TIME              25618235 Time (centi-secs) that CPUs have been in the idlestateBUSY_TIME                240493 Time (centi-secs) that CPUs have been in the busystateUSER_TIME                 82238 Time (centi-secs) spent in user code
SYS_TIME                  29393 Time (centi-secs) spent in the kernel
IOWAIT_TIME              106576 Time (centi-secs) spent waiting for IO6 rows selected.二、检查Oracle对象状态1、查看参数文件位置spfile                               string                            /u01/app/oracle/product/19.3.0/dbhome_1/dbs/spfilecdb1.ora2、查看控制文件STATUS                NAME
--------------------- --------------------------------------------------/u02/oradata/CDB1/control01.ctl/u02/oradata/CDB1/control02.ctl3、查看在线日志GROUP# STATUS                TYPE                  MEMBER
---------- --------------------- --------------------- --------------------------------------------------3                       ONLINE                /u02/oradata/CDB1/redo03.log2                       ONLINE                /u02/oradata/CDB1/redo02.log1                       ONLINE                /u02/oradata/CDB1/redo01.log4、检查日志切换频率SEQUENCE# FIRSTTIME                                              MINUTES
---------- --------------------------------------------------- ----------99 20230104_20:07:02100 20230104_22:00:39                                       113.62101 20230105_10:44:24                                       763.75102 20230105_10:58:45                                        14.35103 20230105_12:00:42                                        61.955、查看数据文件NAME                                               STATUS
-------------------------------------------------- ---------------------
/u02/oradata/CDB1/pdb1/system01.dbf                SYSTEM
/u02/oradata/CDB1/pdb1/sysaux01.dbf                ONLINE
/u02/oradata/CDB1/pdb1/undotbs01.dbf               ONLINE
/u02/oradata/CDB1/pdb1/users01.dbf                 ONLINE
/u02/oradata/CDB1/pdb1/data01.dbf                  ONLINE
/u02/oradata/CDB1/pdb1/TBS_MAXWELL_01.dbf          ONLINE
/u02/oradata/CDB1/pdb1/undotbs02.dbf               ONLINE7 rows selected.6、查看无效的对象OWNER
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
OBJECT_NAME                                                                                                                                                                                                                              OBJECT_TYPE
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---------------------------------------------------------------------
CO
CUSTOMER_ORDER_PRODUCTS                                                                                                                                                                                                                  VIEWCO
STORE_ORDERS                                                                                                                                                                                                                             VIEWCO
PRODUCT_ORDERS                                                                                                                                                                                                                           VIEWOWNER
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
OBJECT_NAME                                                                                                                                                                                                                              OBJECT_TYPE
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---------------------------------------------------------------------
SCOTT
PROC3                                                                                                                                                                                                                                    PROCEDURESCOTT
PROC4                                                                                                                                                                                                                                    PROCEDURE7、查看回滚段状态SEGMENT_NAME                                                                               STATUS
------------------------------------------------------------------------------------------ ------------------------------------------------
SYSTEM                                                                                     ONLINE
_SYSSMU1_3588498444$                                                                       ONLINE
_SYSSMU2_2971032042$                                                                       ONLINE
_SYSSMU3_3657342154$                                                                       ONLINE
_SYSSMU4_811969446$                                                                        ONLINE
_SYSSMU5_3018429039$                                                                       ONLINE
_SYSSMU6_442110264$                                                                        ONLINE
_SYSSMU7_2728255665$                                                                       ONLINE
_SYSSMU8_801938064$                                                                        ONLINE
_SYSSMU9_647420285$                                                                        ONLINE
_SYSSMU10_2262159254$                                                                      ONLINESEGMENT_NAME                                                                               STATUS
------------------------------------------------------------------------------------------ ------------------------------------------------
_SYSSMU11_469748424$                                                                       OFFLINE
_SYSSMU12_4253293703$                                                                      OFFLINE
_SYSSMU13_1277683762$                                                                      OFFLINE
_SYSSMU14_3894550872$                                                                      OFFLINE
_SYSSMU15_459268231$                                                                       OFFLINE
_SYSSMU16_3099260925$                                                                      OFFLINE
_SYSSMU17_3739318309$                                                                      OFFLINE
_SYSSMU18_2688946954$                                                                      OFFLINE
_SYSSMU19_3392187082$                                                                      OFFLINE
_SYSSMU20_3044228317$                                                                      OFFLINE21 rows selected.8、检查是否有禁用约束no rows selected9、检查是否有禁用触发器OWNER      TRIGGER_NAME                                                                                                                                                                                                                     TABLE_NAME                      STATUS
---------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------ ------------------------
HR         SECURE_EMPLOYEES                                                                                                                                                                                                                 EMPLOYEES                       DISABLED
SYS        SYSLSBY_EDS_DDL_TRIG                                                                                                                                                                                                            DISABLED
SYS        LOGMNRGGC_TRIGGER                                                                                                                                                                                                               DISABLED
WMSYS      NO_VM_DDL                                                                                                                                                                                                                       DISABLED
WMSYS      NO_VM_DROP_A                                                                                                                                                                                                                    DISABLED
MDSYS      SDO_TOPO_DROP_FTBL                                                                                                                                                                                                              DISABLED
LBACSYS    LBAC$AFTER_DROP                                                                                                                                                                                                                 DISABLED
LBACSYS    LBAC$BEFORE_ALTER                                                                                                                                                                                                               DISABLED
LBACSYS    LBAC$AFTER_CREATE                                                                                                                                                                                                               DISABLED9 rows selected.10、Oracle Job是否有失败no rows selected11、检查失效的索引no rows selected三、检查Oracle相关资源的使用情况1、查看表空间的使用情况tablespace_name                                                                            tablesapce_size(M) used_tablespace_size(M) used%                 free_size(M) max_byte(M)
------------------------------------------------------------------------------------------ ------------------ ----------------------- --------------------- ------------ -----------
SYSTEM                                                                                                    290                  282.37   97.37                       7.63           7
USERS                                                                                                  221.25                  199.25   90.06                         22       21.25
SYSAUX                                                                                                    440                  393.75   89.49                      46.25       27.75
UNDOTBS1                                                                                                  165                   91.25   55.30                      73.75          24
TBS_MAXWELL                                                                                               100                      13   13.00                         87          87
UNDOTBS2                                                                                                  100                    2.25    2.25                      97.75       97.75
DATA01                                                                                                     50                       1    2.00                         49          497 rows selected.2、查看临时表空间使用情况TABLESPACE_NAME                                                                            SUM(BYTES)/1024/1024
------------------------------------------------------------------------------------------ --------------------
TEMP_MAXWELL                                                                                                100
TEMP02                                                                                                        5
TEMP                                                                                                         363、查看临时段使用的情况no rows selected4、查看所有数据文件i/o情况TS                                                                                              Reads     Writes         BR         BW      RTime      WTime
------------------------------------------------------------------------------------------ ---------- ---------- ---------- ---------- ---------- ----------
DATA01                                                                                            157          0      19204          0       1529          0
SYSAUX                                                                                          18550       2200     190868       2907      10938        743
SYSTEM                                                                                          16313       2057     140263       3429      10952        592
TBS_MAXWELL                                                                                       626        879      31697      12475       1988         25
TEMP                                                                                               36         36       1034       1051          0         54
TEMP02                                                                                              3          0          3          0          0          0
TEMP_MAXWELL                                                                                      308        911        370       5626         10        312
UNDOTBS1                                                                                          586       4017      63448      21566       3706        279
UNDOTBS2                                                                                          206         17      25604        136       2296          1
USERS                                                                                             809        293      84631       3808       2649          910 rows selected.5、查看top 10 热segmentOWNER                OBJECT_NAME                                                                                                                                                                                                          TOUCHS
-------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------
MAXWELLPAN           T                                                                                                                                                                                                                      1446
SYS                  SMON_SCN_TO_TIME_AUX                                                                                                                                                                                                    396
SYS                  SMON_SCN_TIME                                                                                                                                                                                                           396
SYS                  WRI$_OPTSTAT_HISTGRM_HISTORY                                                                                                                                                                                            231
SYS                  WRI$_OPTSTAT_HISTHEAD_HISTORY                                                                                                                                                                                           132
SYS                  I_WRI$_OPTSTAT_OPR_TASKS_STIME                                                                                                                                                                                           74
SYS                  SCHEDULER$_EVENT_LOG                                                                                                                                                                                                     73
SYS                  STATS_TARGET$                                                                                                                                                                                                            72
SYS                  I_WRI$_OPTSTAT_TAB_ST                                                                                                                                                                                                    52
SYS                  WRI$_OPTSTAT_OPR                                                                                                                                                                                                         4610 rows selected.6、查看物理读最多的objectOWNER                OBJECT_NAME                                                                                                                                                                                                           VALUE
-------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------
SYS                  TAB$                                                                                                                                                                                                                   5840
SYS                  I_WRI$_OPTSTAT_H_OBJ#_ICOL#_ST                                                                                                                                                                                         4254
SYS                  HISTGRM$                                                                                                                                                                                                               3543
SYS                  OBJ$                                                                                                                                                                                                                   3415
SYS                  I_OBJ2                                                                                                                                                                                                                 3058
SYS                  I_WRI$_OPTSTAT_HH_OBJ_ICOL_ST                                                                                                                                                                                          2640
SYS                  I_WRI$_OPTSTAT_H_ST                                                                                                                                                                                                    2373
SYS                  I_WRI$_OPTSTAT_HH_ST                                                                                                                                                                                                   2197
SYS                  HIST_HEAD$                                                                                                                                                                                                             1791
SYS                  SMON_SCN_TIME                                                                                                                                                                                                          156610 rows selected.7、查看热点数据文件(从单块读取时间判断)FILE_NAME
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TABLESPACE_NAME                                                                                    CS    READTIM   WRITETIM
------------------------------------------------------------------------------------------ ---------- ---------- ----------
/u02/oradata/CDB1/pdb1/undotbs01.dbf
UNDOTBS1                                                                                          .51       3706        279/u02/oradata/CDB1/pdb1/system01.dbf
SYSTEM                                                                                             .5      10952        592/u02/oradata/CDB1/pdb1/sysaux01.dbf
SYSAUX                                                                                            .33      10938        743FILE_NAME
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TABLESPACE_NAME                                                                                    CS    READTIM   WRITETIM
------------------------------------------------------------------------------------------ ---------- ---------- ----------
/u02/oradata/CDB1/pdb1/users01.dbf
USERS                                                                                              .1       2649          9/u02/oradata/CDB1/pdb1/TBS_MAXWELL_01.dbf
TBS_MAXWELL                                                                                       .03       1988         25/u02/oradata/CDB1/pdb1/data01.dbf
DATA01                                                                                              0       1529          0FILE_NAME
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TABLESPACE_NAME                                                                                    CS    READTIM   WRITETIM
------------------------------------------------------------------------------------------ ---------- ---------- ----------
/u02/oradata/CDB1/pdb1/undotbs02.dbf
UNDOTBS2                                                                                            0       2296          17 rows selected.8、检查Oracle初始化文件中相关参数值no rows selected注:若LIMIT_VALU - MAX_UTILIZATION<=5,则表明与RESOURCE_NAME相关的Oracle初始化参数需要调整。可以通过参数文件调整。9、检查数据库连接情况SID    SERIAL# USERNAME   PROGRAM                                                                                                                                          MACHINE                                                  STATUS
---------- ---------- ---------- ------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------1      29750            oracle@oracle-db-19c (PSP0)                                                                                                                      oracle-db-19c                                            ACTIVE2      35878            oracle@oracle-db-19c (TT00)                                                                                                                      oracle-db-19c                                            ACTIVE3      59608 SYS        oracle@oracle-db-19c (OFSD)                                                                                                                      oracle-db-19c                                            ACTIVE4       8745            oracle@oracle-db-19c (SVCB)                                                                                                                      oracle-db-19c                                            ACTIVE5      38313            oracle@oracle-db-19c (LGWR)                                                                                                                      oracle-db-19c                                            ACTIVE6      36347            oracle@oracle-db-19c (LG01)                                                                                                                      oracle-db-19c                                            ACTIVE7       7077            oracle@oracle-db-19c (LREG)                                                                                                                      oracle-db-19c                                            ACTIVE8      53079            oracle@oracle-db-19c (MMON)                                                                                                                      oracle-db-19c                                            ACTIVE11       7662            oracle@oracle-db-19c (ARC1)                                                                                                                      oracle-db-19c                                            ACTIVE15       4302            oracle@oracle-db-19c (AQPC)                                                                                                                      oracle-db-19c                                            ACTIVE17      47699            oracle@oracle-db-19c (QM02)                                                                                                                      oracle-db-19c                                            ACTIVESID    SERIAL# USERNAME   PROGRAM                                                                                                                                          MACHINE                                                  STATUS
---------- ---------- ---------- ------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------18      43785 SYS        sqlplus@oracle-db-19c (TNS V1-V3)                                                                                                                oracle-db-19c                                            ACTIVE21      23486            oracle@oracle-db-19c (W003)                                                                                                                      oracle-db-19c                                            ACTIVE127      48823            oracle@oracle-db-19c (VKTM)                                                                                                                      oracle-db-19c                                            ACTIVE128      10533            oracle@oracle-db-19c (GEN1)                                                                                                                      oracle-db-19c                                            ACTIVE129      25740            oracle@oracle-db-19c (SCMN)                                                                                                                      oracle-db-19c                                            ACTIVE130      11277            oracle@oracle-db-19c (PMAN)                                                                                                                      oracle-db-19c                                            ACTIVE131      12651            oracle@oracle-db-19c (CKPT)                                                                                                                      oracle-db-19c                                            ACTIVE132      12336            oracle@oracle-db-19c (SMCO)                                                                                                                      oracle-db-19c                                            ACTIVE135      18763            oracle@oracle-db-19c (MMNL)                                                                                                                      oracle-db-19c                                            ACTIVE136      31640            oracle@oracle-db-19c (Q003)                                                                                                                      oracle-db-19c                                            ACTIVE138      57758            oracle@oracle-db-19c (ARC2)                                                                                                                      oracle-db-19c                                            ACTIVESID    SERIAL# USERNAME   PROGRAM                                                                                                                                          MACHINE                                                  STATUS
---------- ---------- ---------- ------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------140      44325            oracle@oracle-db-19c (W007)                                                                                                                      oracle-db-19c                                            ACTIVE146       5498            oracle@oracle-db-19c (Q001)                                                                                                                      oracle-db-19c                                            ACTIVE147      51143            oracle@oracle-db-19c (M000)                                                                                                                      oracle-db-19c                                            ACTIVE151      15680            oracle@oracle-db-19c (W001)                                                                                                                      oracle-db-19c                                            ACTIVE152      62718            oracle@oracle-db-19c (M002)                                                                                                                      oracle-db-19c                                            ACTIVE253      65512            oracle@oracle-db-19c (PMON)                                                                                                                      oracle-db-19c                                            ACTIVE254      51127            oracle@oracle-db-19c (GEN0)                                                                                                                      oracle-db-19c                                            ACTIVE255      15463            oracle@oracle-db-19c (SCMN)                                                                                                                      oracle-db-19c                                            ACTIVE256       2716            oracle@oracle-db-19c (DBRM)                                                                                                                      oracle-db-19c                                            ACTIVE257      36799            oracle@oracle-db-19c (DIA0)                                                                                                                      oracle-db-19c                                            ACTIVE258      41365            oracle@oracle-db-19c (LG00)                                                                                                                      oracle-db-19c                                            ACTIVESID    SERIAL# USERNAME   PROGRAM                                                                                                                                          MACHINE                                                  STATUS
---------- ---------- ---------- ------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------259       1193            oracle@oracle-db-19c (RECO)                                                                                                                      oracle-db-19c                                            ACTIVE260      19373            oracle@oracle-db-19c (PXMN)                                                                                                                      oracle-db-19c                                            ACTIVE261      18301            oracle@oracle-db-19c (ARC0)                                                                                                                      oracle-db-19c                                            ACTIVE262      63688            oracle@oracle-db-19c (ARC3)                                                                                                                      oracle-db-19c                                            ACTIVE266      34589            oracle@oracle-db-19c (CJQ0)                                                                                                                      oracle-db-19c                                            ACTIVE267      65108            oracle@oracle-db-19c (M004)                                                                                                                      oracle-db-19c                                            ACTIVE268      32215            oracle@oracle-db-19c (W004)                                                                                                                      oracle-db-19c                                            ACTIVE272      55676            oracle@oracle-db-19c (W000)                                                                                                                      oracle-db-19c                                            ACTIVE279      58495            oracle@oracle-db-19c (M003)                                                                                                                      oracle-db-19c                                            ACTIVE379      15127            oracle@oracle-db-19c (TT01)                                                                                                                      oracle-db-19c                                            ACTIVE380       5790            oracle@oracle-db-19c (CLMN)                                                                                                                      oracle-db-19c                                            ACTIVESID    SERIAL# USERNAME   PROGRAM                                                                                                                                          MACHINE                                                  STATUS
---------- ---------- ---------- ------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------381      33762            oracle@oracle-db-19c (MMAN)                                                                                                                      oracle-db-19c                                            ACTIVE382      32093            oracle@oracle-db-19c (DIAG)                                                                                                                      oracle-db-19c                                            ACTIVE383       2250            oracle@oracle-db-19c (VKRM)                                                                                                                      oracle-db-19c                                            ACTIVE384      25003            oracle@oracle-db-19c (DBW0)                                                                                                                      oracle-db-19c                                            ACTIVE385      47308            oracle@oracle-db-19c (SMON)                                                                                                                      oracle-db-19c                                            ACTIVE386      59203            oracle@oracle-db-19c (W002)                                                                                                                      oracle-db-19c                                            ACTIVE388      54385            oracle@oracle-db-19c (TMON)                                                                                                                      oracle-db-19c                                            ACTIVE389      17391            oracle@oracle-db-19c (TT02)                                                                                                                      oracle-db-19c                                            ACTIVE395       6039            oracle@oracle-db-19c (W005)                                                                                                                      oracle-db-19c                                            ACTIVE399      56366            oracle@oracle-db-19c (W006)                                                                                                                      oracle-db-19c                                            ACTIVE54 rows selected.select "(注:杀掉会话的语句alter system kill session 'SID,SERIAL#')" from dual*
ERROR at line 1:
ORA-00904: "(注:杀掉会话的语句alter system kill session 'SID,SERIAL#')": invalid identifier10、查看热点数据文件FILE_NAME
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TABLESPACE_NAME                                                                                    CS    READTIM   WRITETIM
------------------------------------------------------------------------------------------ ---------- ---------- ----------
/u02/oradata/CDB1/pdb1/undotbs01.dbf
UNDOTBS1                                                                                          .51       3706        279/u02/oradata/CDB1/pdb1/system01.dbf
SYSTEM                                                                                             .5      10952        592/u02/oradata/CDB1/pdb1/sysaux01.dbf
SYSAUX                                                                                            .33      10938        743FILE_NAME
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TABLESPACE_NAME                                                                                    CS    READTIM   WRITETIM
------------------------------------------------------------------------------------------ ---------- ---------- ----------
/u02/oradata/CDB1/pdb1/users01.dbf
USERS                                                                                              .1       2649          9/u02/oradata/CDB1/pdb1/TBS_MAXWELL_01.dbf
TBS_MAXWELL                                                                                       .03       1988         25/u02/oradata/CDB1/pdb1/data01.dbf
DATA01                                                                                              0       1529          0FILE_NAME
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TABLESPACE_NAME                                                                                    CS    READTIM   WRITETIM
------------------------------------------------------------------------------------------ ---------- ---------- ----------
/u02/oradata/CDB1/pdb1/undotbs02.dbf
UNDOTBS2                                                                                            0       2296          17 rows selected.11、检查一些扩展异常的对象no rows selected12、检查system表空间内的内容OWNER
--------------------
GSMADMIN_INTERNAL
LBACSYS
OJVMSYS
ORDDATA
ORDSYS
OUTLN
SCOTT7 rows selected.13、检查对象的下一扩展与表空间的最大扩展值no rows selected四、内存的具体查看1、查看内存占用各个池子大小POOL                                       NAME                                  BYTES
------------------------------------------ -------------------------------- ----------buffer_cache                      281018368fixed_sga                           9137968log_buffer                         16027648shared_io_pool                     25165824
shared pool                                free memory                        17798368
large pool                                 free memory                         37027846 rows selected.2、检查shered pool  free  spacePOOL                                       NAME                                  BYTES     CON_ID
------------------------------------------ -------------------------------- ---------- ----------
shared pool                                free memory                        17634856          03、检查shared pool中library cachNAMESPACE                                                                                                                                                                                        PINHITRATIO
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -----------
SQL AREA                                                                                                                                                                                          .873216801
TABLE/PROCEDURE                                                                                                                                                                                   .876346328
BODY                                                                                                                                                                                              .877026916
TRIGGER                                                                                                                                                                                           .666189795
INDEX                                                                                                                                                                                             .580197676
CLUSTER                                                                                                                                                                                           .979467704
DIRECTORY                                                                                                                                                                                                .28
QUEUE                                                                                                                                                                                              .12962963
RULESET                                                                                                                                                                                                    0
XML SCHEMA                                                                                                                                                                                                 1
SUBSCRIPTION                                                                                                                                                                                               0NAMESPACE                                                                                                                                                                                        PINHITRATIO
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -----------
TEMPORARY TABLE                                                                                                                                                                                            0
TEMPORARY INDEX                                                                                                                                                                                            0
EDITION                                                                                                                                                                                           .866374269
DBLINK                                                                                                                                                                                                     1
OBJECT ID                                                                                                                                                                                                  1
SCHEMA                                                                                                                                                                                                     1
DBINSTANCE                                                                                                                                                                                                 1
SQL AREA STATS                                                                                                                                                                                    .030114136
ACCOUNT_STATUS                                                                                                                                                                                             1
SQL AREA BUILD                                                                                                                                                                                             1
PDB                                                                                                                                                                                                        1NAMESPACE                                                                                                                                                                                        PINHITRATIO
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -----------
AUDIT POLICY                                                                                                                                                                                      .950545068
USER PRIVILEGE                                                                                                                                                                                    .115384615
PDBOPER                                                                                                                                                                                                    1
FED APP                                                                                                                                                                                           .929759704
APP STATE                                                                                                                                                                                                  1
CMP                                                                                                                                                                                               .04324324328 rows selected.4、检查整体命中率(library cache)hits     misses Hits Ratio
---------- ---------- ----------5205581      81257 .9846303225、library cache中详细比率信息Ratio                                                           Percentage
--------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------
Library I/O Reloads                                             1.56%
Library Lock Requests                                           50.52%
Library Pin Requests                                            64.99%
Library Reparses                                                1.56%6、检查数据字典的命中率ROW CACHE
----------
.899250492注:row cache的命中率至少小于90%7、每个子shared pool由 单独的shared pool latch保护 查看 他们的命中率ADDR             NAME                  GETS     MISSES 1-MISSES/GETS
---------------- --------------- ---------- ---------- -------------
0000000060349618 shared pool          65004          0             1
0000000060349578 shared pool          65004          0             1
00000000603494D8 shared pool          65004          0             1
0000000060349438 shared pool          65004          0             1
0000000060349398 shared pool          65004          0             1
00000000603492F8 shared pool          65004          0             1
0000000060349258 shared pool       12640902      68251    .9946007817 rows selected.8、查看shared pool建议Est        EstTime      ParsePool        Size        Est     Est LC      Saved      Saved EstSize(M)     Factor    LC(M)    Mem. Obj.      (sec)     Factor Object Hits
---------- ---------- ---------- ---------- ---------- ---------- ------------------------------------280          1         26       1280      35958          1      3892570284     1.0143         29       1481      35963     1.0001      3895122288     1.0286         32       1644      35972     1.0004      3898068292     1.0429         35       1801      35981     1.0006      3900576296     1.0571         38       1994      35990     1.0009      3902870300     1.0714         42       2079      36000     1.0012      3905343304     1.0857         46       2164      36006     1.0013      3908229308        1.1         50       2249      36012     1.0015      3911345Est        EstTime      ParsePool        Size        Est     Est LC      Saved      Saved EstSize(M)     Factor    LC(M)    Mem. Obj.      (sec)     Factor Object Hits
---------- ---------- ---------- ---------- ---------- ---------- ------------------------------------312     1.1143         54       2334      36021     1.0018      3914333316     1.1286         57       2425      36028     1.0019      3917488336        1.2         77       3335      36062     1.0029      3931153364        1.3        104       4466      36092     1.0037      3941382392        1.4        131       5442      36129     1.0048      3950645420        1.5        159       6223      36147     1.0053      3957575448        1.6        187       6955      36166     1.0058      3962361476        1.7        215       7687      36179     1.0061      3966691Est        EstTime      ParsePool        Size        Est     Est LC      Saved      Saved EstSize(M)     Factor    LC(M)    Mem. Obj.      (sec)     Factor Object Hits
---------- ---------- ---------- ---------- ---------- ---------- ------------------------------------504        1.8        242       8535      36195     1.0066      3969937532        1.9        269       9875      36213     1.0071      3972118560          2        296      11026      36236     1.0077      397415519 rows selected.9、查看shared pool中 各种类型的chunk的大小数量no rows selected10、查看使用shard_pool保留池情况no rows selected11、 pga 建议Current Mb Projected Mb          %
---------- ------------ ----------200           25         96200           50         96200          100         96200          150         96200          200        100200          240        100200          280        100200          320        100200          360        100200          400        100200          600        100Current Mb Projected Mb          %
---------- ------------ ----------200          800        100200         1200        100200         1600        10014 rows selected.12、查看buffer cache 命中率Buffer Hit Ratio
----------------.98822706413、查看buffer cache设置大小建议SIZE_FOR_ESTIMATE ESTD_PHYSICAL_READ_FACTOR estd_physical_reads
----------------- ------------------------- ------------------------------------------------------------------------16                    4.7163                   70451832                    3.3259                   49681748                     2.695                   40258064                    2.2673                   33868880                    1.9485                   29106096                     1.632                   243787112                    1.4187                   211921128                    1.2884                   192466144                    1.1708                   174897160                     1.058                   158037172                         1                   149379SIZE_FOR_ESTIMATE ESTD_PHYSICAL_READ_FACTOR estd_physical_reads
----------------- ------------------------- ------------------------------------------------------------------------176                     .9795                   146314192                     .9188                   137255208                     .8689                   129797224                     .7854                   117319240                     .7259                   108431256                     .6691                    99944272                     .6317                    94363288                      .616                    92018304                     .5992                    89513320                     .5866                    876268                         1                        0SIZE_FOR_ESTIMATE ESTD_PHYSICAL_READ_FACTOR estd_physical_reads
----------------- ------------------------- ------------------------------------------------------------------------16                         1                        024                         1                        032                         1                        040                         1                        048                         1                        056                         1                        064                         1                        072                         1                        080                         1                        088                         1                        096                         1                        0SIZE_FOR_ESTIMATE ESTD_PHYSICAL_READ_FACTOR estd_physical_reads
----------------- ------------------------- ------------------------------------------------------------------------100                         1                        0104                         1                        0112                         1                        0120                         1                        0128                         1                        0136                         1                        0144                         1                        0152                         1                        0160                         1                        042 rows selected.14、查看buffer cache中defalut pool 命中率NAME            1-(PHYSICAL_READS)/(CONSISTENT_GETS+DB_BLOCK_GETS)
--------------- --------------------------------------------------
DEFAULT                                                 .989934139
DEFAULT                                                          1注:default池命中率至少要大于90%15、检查lgwr i/o性能no rows selected16、检查与redo相关性能指标NAME                 VALUE
--------------- ----------
BPS redo wait            0
redo blocks rea      30568
d for recoveryredo k-bytes re      15284
ad for recoveryredo k-bytes re          0
ad for terminalrecoveryNAME                 VALUE
--------------- ----------
redo entries        757319
redo size        420901088
redo entries fo          0
r lost write de
tectionredo size for l          0
ost write detec
tionredo size for d   25335124NAME                 VALUE
--------------- ----------
irect writesredo buffer all         13
ocation retriesredo wastage             0
redo write acti          0
ve strandsredo writes              0
redo writes (gr          0NAME                 VALUE
--------------- ----------
oup 0)redo writes (gr          0
oup 1)redo writes (gr          0
oup 2)redo writes (gr          0
oup 3)NAME                 VALUE
--------------- ----------
redo writes (gr          0
oup 4)redo writes (gr          0
oup 5)redo writes (gr          0
oup 6)redo writes (gr          0
oup 7)NAME                 VALUE
--------------- ----------redo writes ada          0
ptive allredo writes ada          0
ptive workerredo writes coa          0
lescedredo blocks wri          0NAME                 VALUE
--------------- ----------
ttenredo blocks wri          0
tten (group 0)redo blocks wri          0
tten (group 1)redo blocks wri          0
tten (group 2)NAME                 VALUE
--------------- ----------
redo blocks wri          0
tten (group 3)redo blocks wri          0
tten (group 4)redo blocks wri          0
tten (group 5)redo blocks wri          0
tten (group 6)NAME                 VALUE
--------------- ----------redo blocks wri          0
tten (group 7)redo write size          0count (   4KB)redo write size          0count (   8KB)redo write size          0NAME                 VALUE
--------------- ----------count (  16KB)redo write size          0count (  32KB)redo write size          0count (  64KB)redo write size          0count ( 128KB)NAME                 VALUE
--------------- ----------
redo write size          0count ( 256KB)redo write size          0count ( 512KB)redo write size          0count (1024KB)redo write size          0count (inf)NAME                 VALUE
--------------- ----------redo write time          0
redo write time          0(usec)redo write work          0
er delay (usec)redo write work          0
er delay countNAME                 VALUE
--------------- ----------
redo blocks che          0
cksummed by FG
(exclusive)redo blocks che          0
cksummed by LGW
Rredo log space          14
requestsNAME                 VALUE
--------------- ----------
redo log space           3
wait timeredo ordering m        386
arksredo subscn max       1351countsredo write broa          0
dcast ack timeNAME                 VALUE
--------------- ----------redo write broa          0
dcast ack countredo write broa          0
dcast lgwr postcountredo synch time        174
redo synch time    1771081(usec)NAME                 VALUE
--------------- ----------redo synch time    4286578overhead (usec
)redo synch time        154overhead count(  2ms)redo synch time          9overhead countNAME                 VALUE
--------------- ----------(  8ms)redo synch time          6overhead count( 32ms)redo synch time          6overhead count(128ms)redo synch time          6NAME                 VALUE
--------------- ----------overhead count(inf)redo synch fast          0sync all sleep(usec)redo synch fast          0sync all sleepcountNAME                 VALUE
--------------- ----------
redo synch fast          0sync all sleep(20us)redo synch fast          0sync all sleep(40us)redo synch fast          0sync all sleep(60us)NAME                 VALUE
--------------- ----------redo synch fast          0sync all sleep(80us)redo synch fast          0sync all sleep(100us)redo synch fast          0sync all sleepNAME                 VALUE
--------------- ----------(120us)redo synch fast          0sync all sleep(160us)redo synch fast          0sync all sleep(240us)redo synch fast          0NAME                 VALUE
--------------- ----------sync all sleep(400us)redo synch fast          0sync all sleep(720us)redo synch fast          0sync all sleep(inf)NAME                 VALUE
--------------- ----------
redo synch fast          0sync sleep cou
ntredo synch fast          0sync sleep (us
ec)redo synch fast          0sync sleep o/h(usec)NAME                 VALUE
--------------- ----------redo synch fast          0sync spin coun
tredo synch fast          0sync spin (use
c)redo synch fast          0sync backoff cNAME                 VALUE
--------------- ----------
ountredo synch fast          0sync backoff (
usec)redo synch fast          0sync backoff o
/h (usec)redo synch writ        238NAME                 VALUE
--------------- ----------
esredo synch long          2waitsredo write gath          0
er timeredo write sche          0
dule timeNAME                 VALUE
--------------- ----------
redo write issu          0
e timeredo write fini          0
sh timeredo write tota          0
l timeredo synch poll          0writesNAME                 VALUE
--------------- ----------redo synch poll          0
sredo write info        181findredo write info          0find failredo KB read         16564NAME                 VALUE
--------------- ----------
redo KB read (m          0
emory)redo KB read fo          0
r transportredo KB read (m          0
emory) for tran
sportredo non-durabl          0NAME                 VALUE
--------------- ----------
e records skipp
edtxn cache redo           0
sync readsIM ADG redo rec          0
ords seensecurefile inod          0
e lhb redoNAME                 VALUE
--------------- ----------securefile inod          0
e itree redo105 rows selected.17、查询redo block sizeMAX(LEBSZ)
----------51218、  计算出每个事务平均处理多少个redo blockA.REDOBLOCKS/B.TRANCOUNT
------------------------019、 检查undo rollback segment 使用情况NAME                                                             RSSIZE    EXTENTS      LATCH      XACTS     WRITES       GETS      WAITS
------------------------------------------------------------ ---------- ---------- ---------- ---------- ---------- ---------- ----------
_SYSSMU3_3657342154$                                           34725888         35          3          0   36540940      67630          2
_SYSSMU10_2262159254$                                           1171456          3          0          0   22691224      65720          1
_SYSSMU1_3588498444$                                            2220032          4          1          0    6824628      64280          1
_SYSSMU6_442110264$                                            17948672         19          1          0   22065812      66294          0
_SYSSMU7_2728255665$                                            9560064         11          2          0   12342776      64787          0
_SYSSMU8_801938064$                                             3268608          5          3          0    5757944      63614          0
_SYSSMU9_647420285$                                             3268608          5          4          0    7281274      64551          0
_SYSSMU4_811969446$                                            13754368         15          4          0   16258396      65369          0
_SYSSMU2_2971032042$                                            5365760          7          2          0   11699968      65121          0
SYSTEM                                                           450560          7          0          0      19888        375          0
_SYSSMU5_3018429039$                                            3268608          5          0          0    7849356      64004          011 rows selected.20、计算每秒钟产生的undoblk数量SUM(UNDOBLKS)/SUM((END_TIME-BEGIN_TIME)*24*60*60)
-------------------------------------------------.10235325421、查询undo具体信息UndoB  Trans LongestQuery MaxConcurrency Snapshot2Old FreeSpaceWait
------ ------ ------------ -------------- ------------ -------------6    119            0              2            0             00      0            0              0            0             00     58            0              0            0             02     10            0              1            0             00      0            0              0            0             00     56            0              0            0             07     69            0              2            0             00      0            0              0            0             01     51            0              1            0             01     11            0              1            0             00      0            0              0            0             0UndoB  Trans LongestQuery MaxConcurrency Snapshot2Old FreeSpaceWait
------ ------ ------------ -------------- ------------ -------------1     52            0              1            0             04     79            0              2            0             00      0            0              0            0             06    265            0              1            0             0652   1041            0              3            0             00      0            0              0            0             01     62            0              1            0             09     92            0              2            0             00      0            0              0            0             00      0            0              0            0             00     27            0              0            0             0UndoB  Trans LongestQuery MaxConcurrency Snapshot2Old FreeSpaceWait
------ ------ ------------ -------------- ------------ -------------0     14            0              0            0             00      0            0              0            0             02     72            0              2            0             08     88            0              2            0             00      0            0              0            0             02     35            0              1            0             00     35            0              0            0             00      0            0              0            0             043    117            0              1            0             048    141            0              2            0             041      0            0              1            0             0UndoB  Trans LongestQuery MaxConcurrency Snapshot2Old FreeSpaceWait
------ ------ ------------ -------------- ------------ -------------2042    193            0              2            0             01416     78            0              2            0             02696      1            0              1            0             012    134            0              4            0             017    319            0              4            0             08     31            0              6            0             00      0            0              0            0             00      0            0              1            0             02     99         3593              2            0             03     42         3593              2            0             00      0         3593              1            0             0UndoB  Trans LongestQuery MaxConcurrency Snapshot2Old FreeSpaceWait
------ ------ ------------ -------------- ------------ -------------3     94         3593              3            0             01      4         3593              2            0             00      0            0              0            0             07    158         3593              6            0             01     14            0              5            0             00      0            0              0            0             03     46            0              2            0             05     74        71421              2            0             00     10        71421              1            0             00     67        71421              1            0             00      0        71421              1            0             0UndoB  Trans LongestQuery MaxConcurrency Snapshot2Old FreeSpaceWait
------ ------ ------------ -------------- ------------ -------------1      8        71421              5            0             03     76        71421              3            0             06    176        71421              2            0             00      0        71421              1            0             09     62        71421              3            0             02     55        71421              2            0             01     10        71421              3            0             07     78        71421              3            0             00      0        71421              1            0             05    187        71421              2            0             01431     79        71421              2            0             0UndoB  Trans LongestQuery MaxConcurrency Snapshot2Old FreeSpaceWait
------ ------ ------------ -------------- ------------ -------------2077      2        71421              1            0             015    213        71421              2            0             03     86        71421              2            0             00     28        71421              0            0             00      0        71421              0            0             03     48        71421              1            0             012    350        71421              1            0             01     13        71421              1            0             01067   3483        71421              5            0             00      0            0              0            0             04     75        71421              2            0             0UndoB  Trans LongestQuery MaxConcurrency Snapshot2Old FreeSpaceWait
------ ------ ------------ -------------- ------------ -------------0      0            0              0            0             02     64            0              1            0             08    147            0              2            0             00      3            0              0            0             035    224            0              3            0             0158    269            0              3            0             03      8            0              2            0             05    128            0              2            0             06    110            0              1            0             04    141            0              1            0             00      2            0              0            0             0UndoB  Trans LongestQuery MaxConcurrency Snapshot2Old FreeSpaceWait
------ ------ ------------ -------------- ------------ -------------5    106            0              2            0             00      0            0              0            0             02     64            0              1            0             04     75            0              3            0             00      0            0              0            0             02     71            0              1            0             05     88            0              2            0             00      0            0              0            0             04     72            0              1            0             04     58            0              1            0             00      0            0              0            0             0UndoB  Trans LongestQuery MaxConcurrency Snapshot2Old FreeSpaceWait
------ ------ ------------ -------------- ------------ -------------309    216            0              2            0             0278    222            0              2            0             02     15            0              2            0             03     60            0              1            0             0823   3552            0              3            0             00      0            0              0            0             040    239            0              2            0             0884    292            0              2            0             01762 ######            0              2            0             03     70            0              1            0             01     92            0              1            0             0UndoB  Trans LongestQuery MaxConcurrency Snapshot2Old FreeSpaceWait
------ ------ ------------ -------------- ------------ -------------0      0            0              0            0             00      0            0              0            0             06     96            0              2            0             00      1            0              0            0             09     83            0              3            0             06    193            0              1            0             01757 ######            0              2            0             05    162            0              1            0             01764 ######            0              3            0             033    305            0              4            0             0120 rows selected.22、查询rollback 段详细信息(收缩次数,扩展次数,平均活动事务等)RBS                                                   Extends    Shrinks      Wraps  AveShrink  AveActive
-------------------------------------------------- ---------- ---------- ---------- ---------- ----------
_SYSSMU1_3588498444$                                        1          2         13    2097152     397329
_SYSSMU2_2971032042$                                        3          2         19    6291456     795251
_SYSSMU3_3657342154$                                       31          1         43    3145728   26447315
_SYSSMU4_811969446$                                        10          0         21          0    5179365
_SYSSMU5_3018429039$                                        1          1         14   10485760     474893
_SYSSMU6_442110264$                                        15          4         28    6553600   10822445
_SYSSMU7_2728255665$                                        7          0         16          0    3287355
_SYSSMU8_801938064$                                         0          0          9          0     344093
_SYSSMU9_647420285$                                         0          0         11          0     482124
_SYSSMU10_2262159254$                                      30          6         59    3429717    752175210 rows selected.23、查询当前rollback segment使用情况RBS                                                STATUS                                             WAITS       GETS TO_CHAR(S.WRITES,'9999999999999')          Active Trans
-------------------------------------------------- --------------------------------------------- ---------- ---------- ------------------------------------------ ------------
_SYSSMU1_3588498444$                               ONLINE                                                 1      64282        6824628                                        0
_SYSSMU2_2971032042$                               ONLINE                                                 0      65123       11699968                                        0
_SYSSMU3_3657342154$                               ONLINE                                                 2      67632       36540940                                        0
_SYSSMU4_811969446$                                ONLINE                                                 0      65371       16258396                                        0
_SYSSMU5_3018429039$                               ONLINE                                                 0      64006        7849356                                        0
_SYSSMU6_442110264$                                ONLINE                                                 0      66296       22065812                                        0
_SYSSMU7_2728255665$                               ONLINE                                                 0      64789       12342776                                        0
_SYSSMU8_801938064$                                ONLINE                                                 0      63616        5757944                                        0
_SYSSMU9_647420285$                                ONLINE                                                 0      64553        7281274                                        0
_SYSSMU10_2262159254$                              ONLINE                                                 1      65722       22691224                                        010 rows selected.24、查询使用rollback segment时等待比率Contention
---------------------------------------------------------------------------------------------------------------------------
.01%25、查询使用rollback segment时等待比率及其平局活动事务数Trans per RBS Contention
------------- ---------------------------------------------------------------------------------------------------------------------------0 .01%五、检查Oracle数据库性能1、检查数据库的等待事件SID EVENT                                            P1         P2         P3  WAIT_TIME SECONDS_IN_WAIT
---------- ---------------------------------------- ---------- ---------- ---------- ---------- ---------------2 Data Guard: Gap Manager                           0          0          0          0              233 OFS idle                                          0          0          0          0               14 wait for unread message on broadcast cha 1745204944 1745061232          0          0               1nnel6 LGWR worker group idle                            1          0          0          0              517 lreg timer                                        1          0          0          0               215 AQPC idle                                         0          0          0          0              2617 Streams AQ: qmn coordinator idle wait             0          0          0          0               021 Space Manager: slave idle wait                    3          0          0          0               5127 VKTM Logical Idle Wait                            0          0          0          0           65129129 watchdog main loop                                0         10          0          0               1130 pman timer                                        0          0          0          0               1136 Streams AQ: qmn slave idle wait                   1          0          0          0               0140 Space Manager: slave idle wait                    7          0          0          0               1146 Streams AQ: waiting for time management           0          0          0          0           18276or cleanup tasks147 class slave wait                                  0          0          0          0              51151 Space Manager: slave idle wait                    1          0          0          0               0152 class slave wait                                  0          0          0          0              51253 pmon timer                                      300          0          0          0               1255 watchdog main loop                                0          8          0          0               1257 DIAG idle wait                                    3          1          0          0               1258 LGWR worker group idle                            0          0          0          0               9267 class slave wait                                  0          0          0          0              51268 Space Manager: slave idle wait                    4          0          0          0               0272 Space Manager: slave idle wait                    0          0          0          0               3279 class slave wait                                  0          0          0          0              51379 Data Guard: Timer                                 0          0          0          0              20380 pmon timer                                      300          0          0          0               1382 DIAG idle wait                                    3          1          0          0               1383 VKRM Idle                                         0          0          0          0           65129385 smon timer                                      300          0          0          0             103386 Space Manager: slave idle wait                    2          0          0          0               0389 heartbeat redo informer                           0          0          0          0               1395 Space Manager: slave idle wait                    5          0          0          0               3399 Space Manager: slave idle wait                    6          0          0          0               034 rows selected.2、查看与redo相关等待事件EVENT                                    TOTAL_WAITS TOTAL_TIMEOUTS AVERAGE_WAIT
---------------------------------------- ----------- -------------- ------------
latch: redo allocation                             1              0          .043、查看session redo eventEVENT                                    TOTAL_WAITS TOTAL_TIMEOUTS AVERAGE_WAIT
---------------------------------------- ----------- -------------- ------------
latch: redo writing                                1              0          .01
heartbeat redo informer                        64995              0        100.24、Disk Read最高的SQL语句的获取5、查找前十条性能差的sqlPARSING_USER_ID EXECUTIONS      SORTS COMMAND_TYPE DISK_READS
--------------- ---------- ---------- ------------ ----------
SQL_TEXT
------------------------------------------------------------------------------------------------------------------------0     121207          0            3        356
select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#, sample_size, minimum, maximum, distcnt, lowval,hival, density, col#, spare1, spare2, avgcln, minimum_enc, maximum_enc from hist_head$ where obj#=:1 and intcol#=:20       1019       1019            3        246
select owner#,name,namespace,remoteowner,linkname,p_timestamp,p_obj#, nvl(property,0),subname,type#,flags,d_attrs from d
ependency$ d, obj$ o where d_obj#=:1 and p_obj#=obj#(+) order by order#0          1          0            3        154
SELECT owner, constraint_name, table_name, constraint_type, status      FROM dba_constraints     WHERE status ='DISABLE'and constraint_type='P'0          1          1            3        115
select Segment_Name, Segment_Type, TableSpace_Name,        (Extents/Max_extents)*100 Percent From sys.DBA_Segments WhereMax_Extents != 0 and (Extents/Max_extents)*100>=95 order By Percent0       5442          0            3        112
select obj#,type#,ctime,mtime,stime, status, dataobj#, flags, oid$, spare1, spare2, spare3, signature, spare7, spare8, s
pare9, nvl(dflcollid, 16382), creappid, creverid, modappid, modverid, crepatchid, modpatchid from obj$ where owner#=:1 a
nd name=:2 and namespace=:3 and remoteowner is null and linkname is null and subname is null0       7359      13809            3         73
select i.obj#,i.ts#,i.file#,i.block#,i.intcols,i.type#,i.flags,i.property,i.pctfree$,i.initrans,i.maxtrans,i.blevel,i.le
afcnt,i.distkey,i.lblkkey,i.dblkkey,i.clufac,i.cols,i.analyzetime,i.samplesize,i.dataobj#,nvl(i.degree,1),nvl(i.instance
s,1),i.rowcnt,mod(i.pctthres$,256),i.indmethod#,i.trunccnt,nvl(c.unicols,0),nvl(c.deferrable#+c.valid#,0),nvl(i.spare1,i
.intcols),i.spare4,i.spare2,i.spare6,decode(i.pctthres$,null,null,mod(trunc(i.pctthres$/256),256)),nvl(i.evaledition#,1)
,nvl(i.unusablebefore#,0),nvl(i.unusablebeginning#,0), ist.cachedblk,ist.cachehit,ist.logicalread from ind$ i, ind_stats
$ ist, (select enabled, min(intcols) unicols,min(to_number(bitand(defer,1))) deferrable#,min(to_number(bitand(defer,4)))valid# from cdef$ where obj#=:1 and enabled > 1 group by enabled) c where i.obj#=c.enabled(+) and i.obj# = ist.obj#(+)
and i.bo#=:1 order by i.obj#0       8235       8235            3         58
select name,intcol#,segcol#,type#,length,nvl(precision#,0),decode(type#,2,nvl(scale,-127/*MAXSB1MINAL*/),178,scale,179,s
cale,180,scale,181,scale,182,scale,183,scale,231,scale,0),null$,fixedstorage,nvl(deflength,0),default$,rowid,col#,proper
ty, nvl(charsetid,0),nvl(charsetform,0),spare1,spare2,nvl(spare3,0), nvl(evaledition#,1),nvl(unusablebefore#,0),nvl(unus
ablebeginning#,0), case when (type# in (1,8,9,96,112)) then nvl(collid, 16382) else 0 end case, nvl(collintcol#,0), nvl(
acdrrescol#, 0), nvl(spare7, 0), nvl(spare9, 0), nvl(spare10, 0) from col$ where obj#=:1 order by intcol#0       1434       1434            3         48
select /*+ rule */ bucket, endpoint, col#, epvalue, epvalue_raw, ep_repeat_count, endpoint_enc from histgrm$ where obj#=
:1 and intcol#=:2 and row#=:3 order by bucket0         30          0            3         44
SELECT xs.sid                                                                FROM   sys.rxs$sessions xsWHERE  BITAND(xs.flag,32) <> 32 AND                                                 xs
.inactivetimeout <> 0 AND                                                  365*30*24*60*(extract(year FROM systimestamp)-                                            extract(year FROM accesstime)) +                               30*24*60*(e
xtract(month FROM systimestamp) -                                           extract(month FROM accesstime)) +24*60*(extract(day FROM systimestamp) -                                             extract(day F
ROM accesstime)) +                                       60*(extract(hour FROM systimestamp) -extract(hour FROM accesstime)) +                                         (extract(minute FROM systimes
tamp) -9 rows selected.6、等待时间最多的5个系统等待事件的获取EVENT                                    TOTAL_WAITS TOTAL_TIMEOUTS TIME_WAITED AVERAGE_WAIT TIME_WAITED_MICRO
---------------------------------------- ----------- -------------- ----------- ------------ -----------------
TOTAL_WAITS_FG TOTAL_TIMEOUTS_FG TIME_WAITED_FG AVERAGE_WAIT_FG TIME_WAITED_MICRO_FG   EVENT_ID WAIT_CLASS_ID
-------------- ----------------- -------------- --------------- -------------------- ---------- -------------
WAIT_CLASS#
-----------
WAIT_CLASS
------------------------------------------------------------------------------------------------------------------------CON_ID
----------
db file sequential read                        31525              0       12596           .4         1259639746138                 0           1509             .25             15088073 2652584166    17407597678
User I/O3PGA memory operation                           31136              0          32            0            31676722355                 0             23               0               232201 1800992443    18939770030
Other3control file sequential read                    7936              0          11            0            1099551310                 0              5               0                51291 3213517201    41083077679
System I/O3control file parallel write                     4333              0         399          .09           398570686                 0              4             .05                40906 4078387448    41083077679
System I/O3db file scattered read                          2370              0        1094          .46          10943503277                 0             48             .17               484296  506183215    17407597678
User I/O37、检查运行很久的SQLno rows selected9、检查碎片程度高的表TABLE_NAME                        EXTENTS
------------------------------ ----------
SALES_CHANNEL_BIX                      16
SALES                                  16
SALES_CUST_BIX                         16
SALES_PROMO_BIX                        16
SALES_PROD_BIX                         16
SALES_TIME_BIX                         166 rows selected.10、检查死锁及处理no rows selected11、查看数据库中行chainRatio
---------------------------------------
Percentage
------------------------------------------------------------------------------------------------------------------------
Chained Rows
.028%12、查询解析比率Ratio
---------------------------------------------
Percentage
------------------------------------------------------------------------------------------------------------------------
Hard Parses
10.03%Parse Failures
.05383%Soft Parses
20.45%13、查看与latch有关的event信息Event                Total Time    Waits   Average  Timeouts
-------------------- ---------- -------- --------- ---------
latch free                    1       10         0         014、查看大表小表扫描对应的值VALUE NAME
---------- ------------------------------------------------------------160143 table scans (short tables)19 table scans (long tables)889360 table fetch by rowidRatio
------------------------------------------------------------------------------------------
Percentage
------------------------------------------------------------------------------------------------------------------------
Efficient Table Access
100%Long Table Scans
0%Short Table Scans
15.26%Short to Long Full Table Scans
99.99%Table by Index
84.74%15、index使用比率TO_CHAR(VALUE,'999999999999999999999')                             NAME
------------------------------------------------------------------ ------------------------------160143                                             table scans (short tables)19                                             table scans (long tables)889360                                             table fetch by rowid172                                             index fast full scans (full)0                                             index fast full scans (rowid ranges)0                                             index fast full scans (directread)694064                                             index fetch by key7 rows selected.Ratio
---------------------------------------------------------------
Result
------------------------------------------------------------------------------------------------------------------------
Index to Table Ratio
10:116、等待classWAIT_CLASS                     COUNT(WAIT_CLASS)
------------------------------ -----------------
Administrative                                 1
Application                                    3
Commit                                         1
Concurrency                                   15
Configuration                                  6
Idle                                           9
Network                                        2
Other                                         28
System I/O                                     2
User I/O                                      1310 rows selected.SQL> 

Oracle自动化巡检脚本出炉相关推荐

  1. mysql 5.7巡检脚本_mysql自动化巡检脚本生成html报告

    一. 前言 1.之前出了一篇oracle自动巡检脚本生成html报告和一篇Linux服务器系统自动巡检脚本生成html报告,本篇文章出一篇mysql自动巡检脚本生成html报告. 2.脚本只提供部分简 ...

  2. mysql自动化巡检_mysql自动化巡检脚本生成html报告

    一. 前言 1.之前出了一篇oracle自动巡检脚本生成html报告和一篇Linux服务器系统自动巡检脚本生成html报告,本篇文章出一篇mysql自动巡检脚本生成html报告. 2.脚本只提供部分简 ...

  3. 第一章【Oracle自动化部署脚本】诞生

    作者简介 作者:LuciferLiu,中国DBA联盟(ACDU)成员. 目前从事Oracle DBA工作,曾从事 Oracle 数据库开发工作,主要服务于生产制造,汽车金融等行业. 现拥有Oracle ...

  4. oracle健康巡检脚本,oracle 巡检脚本

    二.巡检脚本: # ---------------------------------------------------- # #                      系统负载         ...

  5. oracle自动化,Oracle 自动化备份脚本

    备份脚本,基于linux,windows环境需要适当修改. 主脚本,会调用2,3步骤的rman.sql&status.sql $ more main.sh #set env ######### ...

  6. Linux服务器系统自动巡检脚本生成html报告

    一. 前言 1.在上一篇文章里给大家介绍oracle自动巡检脚本生成html报告,这篇文章介绍linux服务巡检脚本生成html报告. 2.脚本依然是简单脚本语句的堆积,方便大家二次编辑使用. 3.项 ...

  7. 小麦苗数据库巡检脚本,支持Oracle、MySQL、SQL Server和PG等数据库

    文章目录 一.巡检脚本简介 二.巡检脚本特点 三.巡检结果展示 1.Oracle数据库 2.MySQL数据库 3.SQL Server数据库 4.PG数据库 5.OS信息 四.脚本运行方式 1.Ora ...

  8. 【加量不加价,提供只读脚本】小麦苗健康检查脚本说明(Oracle巡检脚本)

    小麦苗健康检查脚本说明 第一章   小麦苗健康检查脚本特点 小麦苗健康检查脚本 有如下的特点: 1.  绿色版.免安装.纯 SQL 文本 2.  跨平台,只要有 SQL*Plus 环境即可运行 3.  ...

  9. 小麦苗健康检查脚本说明(Oracle巡检脚本)

    小麦苗健康检查脚本说明 第一章 小麦苗健康检查脚本特点 小麦苗健康检查脚本有如下的特点: 1. 绿色版.免安装.纯SQL文本 2. 跨平台,只要有SQL*Plus环境即可运行 3. 兼容Oracle ...

最新文章

  1. 求表达式 f(n)结果末尾0的个数
  2. RDKit | 基于RDKit和化学信息学探索化学空间
  3. 由内而外:大脑是如何形成感官记忆的
  4. C# 8新提案让泛型Attribute成为现实
  5. php-echo原理
  6. 如何管理和记录 SSIS 各个 Task 的开始执行时间和结束时间以及 Task 中添加|删除|修改的记录数...
  7. 线性回归(一)---一元线性回归
  8. sqlserver2000换成mysql_MS SQL Server2000转换成MySQL
  9. 版本控制系统相关知识
  10. 安装SQL2005后SQL Server Management Studio 没有出来的解决方案
  11. nas 和 远程文件夹同步_群晖NAS同步文件夹功能打开有什么需要注意的?
  12. STM32F103—有关SIM900A模块的使用
  13. 车架号VIN码识别api接口-vin码OCR识别-车辆识别代码识别-汽车vin码图片识别
  14. c语言编写作息时间表_嵌入式杂谈之中断向量表
  15. 求某年某月某日是星期几公式
  16. Fastadmin 自带的导入Excel功能
  17. #1.从学生表中查询所有学生的所有信息SELECT * FROM `student`#2.从学生表查询所有学生的学号姓名信息并分别赋予别名SELECT StudentNo AS ‘学号‘, St
  18. 学计算机颈椎,长期玩电脑颈椎病
  19. 4.4 测试度量指标体系和质量评估
  20. 服务器残留文件怎么删除,流氓软件卸载后它又自己重新安装怎么办 流氓软件如何彻底删除...

热门文章

  1. 使用android studio时酷狗音乐,17 Android Studio开发实战:音乐播放器——浪花音乐...
  2. HMI-55-【多媒体】音乐播放器 4
  3. E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher android.util.AndroidRuntimeException: Animators
  4. 开发需要了解的服务器配置
  5. 批量插入报错:Parameter ‘id‘ not found. Available parameters are [forlonList, param1]
  6. vs2019能开发java_VS2019快捷键大全
  7. IE8 浏览器性能解密
  8. 职业攻略:成为一名游戏代练||成为一名程序员
  9. 计算机技术与软件资格证书有哪些,请问计算机技术与软件专业技术资格的证书有什么用..._出版资格_帮考网...
  10. mysql 银行卡号数据类型_MYSQL 数据类型