标签:decode roc 性能 exe ESS arc trigger address segment
SELECT B.TABLESPACE_NAME TABLESPACE,
A.EXTENT_MANAGEMENT EXT_MGT,
A.SEGMENT_SPACE_MANAGEMENT SEG_MGT,
A.STATUS,
A.LOGGING,
B.TOTAL,
B.FREE,
B.USED_PCT
FROM DBA_TABLESPACES A,
(SELECT D.TABLESPACE_NAME TABLESPACE_NAME,
ROUND((D.SUMBYTES / 1024 / 1024 / 1024), 2) || ‘GB‘ TOTAL,
ROUND(DECODE(F.SUMBYTES, NULL, 0, F.SUMBYTES) / 1024 / 1024 / 1024,
2) || ‘GB‘ FREE,
ROUND((D.SUMBYTES - DECODE(F.SUMBYTES, NULL, 0, F.SUMBYTES)) * 100 /
D.SUMBYTES,
2) || ‘%‘ USED_PCT
FROM (SELECT TABLESPACE_NAME, SUM(BYTES) SUMBYTES
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) F,
(SELECT TABLESPACE_NAME,
SUM(BYTES) SUMBYTES
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME) D
WHERE F.TABLESPACE_NAME(+) = D.TABLESPACE_NAME
ORDER BY D.TABLESPACE_NAME) B
WHERE A.TABLESPACE_NAME = B.TABLESPACE_NAME;
SELECT FILE_ID AS ID,
RELATIVE_FNO "FNO",
ROUND(BYTES / 1024 / 1024) AS MBYTES,
ROUND(MAXBYTES / 1024 / 1024) MAXMBYTES,
BLOCKS,
MAXBLOCKS,
AUTOEXTENSIBLE "AUTO",
INCREMENT_BY "INC",
ROUND(USER_BYTES / 1024 / 1024) "NOW_MB",
USER_BLOCKS,
STATUS,
ONLINE_STATUS "ONLINE_S"
FROM DBA_DATA_FILES;
SELECT A.GROUP#, A.STATUS, A.BYTES, B.MEMBER, A.ARCHIVED
FROM V$LOG A, V$LOGFILE B
WHERE A.GROUP# = B.GROUP#;
SELECT DECODE(REQUEST, 0, ‘阻塞者:‘, ‘等待者:‘) || SID SID,
ID1,
ID2,
LMODE,
REQUEST,
TYPE
FROM V$LOCK
WHERE (ID1, ID2, TYPE) IN
(SELECT ID1, ID2, TYPE FROM V$LOCK WHERE REQUEST > 0)
ORDER BY ID1, REQUEST;
SELECT SPID FROM V$PROCESS WHERE ADDR NOT IN (SELECT PADDR FROM V$SESSION);
SELECT OWNER, A.INDEX_NAME, A.INDEX_TYPE, A.STATUS
FROM DBA_INDEXES A
WHERE STATUS = ‘UNUSABLE‘;
SELECT A.INDEX_NAME, A.PARTITION_NAME, A.TABLESPACE_NAME, A.STATUS
FROM DBA_IND_PARTITIONS A
WHERE STATUS = ‘UNUSABLE‘;
SELECT OWNER, CONSTRAINT_NAME, TABLE_NAME, CONSTRAINT_TYPE, STATUS
FROM DBA_CONSTRAINTS
WHERE STATUS = ‘DISABLE‘
AND CONSTRAINT_TYPE = ‘P‘;
SELECT (1 - (SUM(DECODE(NAME, ‘PHYSICAL READS‘, VALUE, 0)) /
(SUM(DECODE(NAME, ‘DB BLOCK GETS‘, VALUE, 0)) +
SUM(DECODE(NAME, ‘CONSISTENT GETS‘, VALUE, 0))))) * 100 "HIT RATIO"
FROM V$SYSSTAT;
--应大于90%
SELECT (1 - (SUM(GETMISSES) / SUM(GETS))) * 100 "HIT RATIO" FROM V$ROWCACHE;
--此命中率应大于 95%
SELECT SUM(PINS) / (SUM(PINS) + SUM(RELOADS)) * 100 "HIT RATIO" FROM V$LIBRARYCACHE;
--此命中率应大于 95%
SELECT NAME, VALUE FROM V$SYSSTAT WHERE NAME LIKE ‘%SORTS%‘;
--如果存在大量的磁盘排序,则表明检查目前系统中消耗大量磁盘的 SQL 是否已经经过调整。
SELECT B.NAME, A.SID, A.VALUE
FROM V$SESSTAT A, V$STATNAME B
WHERE A.STATISTIC# = B.STATISTIC#
AND B.NAME = ‘SORTS (DISK)‘
AND A.VALUE > 0
AND ROWNUM < 10
ORDER BY A.VALUE DESC;
--检查使用磁盘排序的会话信息,可以定位执行了大量磁盘排序的会话
SELECT * FROM V$TEMP_SPACE_HEADER;
SELECT INSTANCE_NAME, HOST_NAME, STARTUP_TIME, STATUS, DATABASE_STATUS FROM V$INSTANCE;
--其中“STATUS”表示ORACLE当前的实例状态,必须为“OPEN”;“DATABASE_STATUS”表示ORACLE当前数据库的状态,必须为“ACTIVE”
SELECT TABLESPACE_NAME, STATUS FROM DBA_TABLESPACES;
--输出结果中STATUS应该都为ONLINE
SELECT NAME, STATUS FROM V$DATAFILE;
--输出结果中“STATUS”应该都为“ONLINE”
SELECT FILE_NAME, STATUS FROM DBA_DATA_FILES;
--输出结果中“STATUS”应该都为“AVAILABLE”。
SELECT SEGMENT_NAME, STATUS FROM DBA_ROLLBACK_SEGS;
--输出结果中所有回滚段的“STATUS”应该为“ONLINE”。
SELECT 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;
--如果有记录返回,则这些对象的扩展已经快达到它定义时的最大扩展值,对于这些对象要修改它的存储结构参数
SELECT SQL_TEXT
FROM (SELECT * FROM V$SQLAREA ORDER BY DISK_READS)
WHERE ROWNUM <= 5;
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;
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;
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);
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;
SELECT OWNER, TRIGGER_NAME, TABLE_NAME, STATUS
FROM DBA_TRIGGERS
WHERE STATUS = ‘DISABLED‘;
SELECT JOB, WHAT, LAST_DATE, NEXT_DATE, FAILURES, BROKEN
FROM DBA_JOBS
WHERE SCHEMA_USER = ‘FCR51HOST‘;
标签:decode roc 性能 exe ESS arc trigger address segment
原文地址:https://www.cnblogs.com/markblogs/p/12900818.html