database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
ㆍOracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
Oracle Q&A 2534 게시물 읽기
No. 2534
Explain plain
작성자
나그네
작성일
2000-12-30 16:23
조회수
2,611

Doc

Name: SQL_10SEC.sql

Author: Mahnho Han

List all SQL statements that have a response time more than 10 seconds

#

column nl newline;

set heading off

set pagesize 9999

set linesize 80

set echo off

set feedback off

set verify off

column runt format 999,999.99 newline;

spool diskread.sql

 

select ' ' nl,'doc' nl,translate(sql_text,'&',':') nl,

' Expected Run Time = '||

DISK_Reads / decode(executions,0,1,executions) / 50 runt,

' Executions = ' || executions nl,

'#' nl,

'delete sys.han_table;' nl,

'explain plan into sys.han_table for ' nl,

sql_text ||';' nl,

'@$HOME/mhan/plan '

from v$sqlarea

where disk_reads / decode(executions,0,1,executions) / 50 > 10

and upper(sql_text) not like '%BEGIN%'

and upper(sql_text) not like '%SQLAREA%'

and upper(sql_text) not like '%DBA_%'

and upper(sql_text) not like '%USER_%'

and upper(sql_text) not like '%ALL_%'

order by executions desc

/

spool off

spool bufget.sql

select ' ' nl,

'doc' nl,

translate(sql_text,'&',':') nl,

' Expected Run Time = '||

buffer_gets / decode(executions,0,1,executions) / 500 runt,

' Executions = ' || executions nl,

'#' nl,

'delete sys.han_table;' nl,

'explain plan into sys.han_table for ' nl,

sql_text ||';' nl,

'@$HOME/mhan/plan '

from v$sqlarea

where buffer_gets / decode(executions,0,1,executions) / 500 > 10

and upper(sql_text) not like '%BEGIN%'

and upper(sql_text) not like '%SQLAREA%'

and upper(sql_text) not like '%DBA_%'

and upper(sql_text) not like '%USER_%'

and upper(sql_text) not like '%ALL_%'

order by executions desc

/

spool off

spool badstmt.lis

doc

got an excessive number of disk reads

#

@diskread.sql

doc

got an excessive number of scan through the buffer cache.

#

@bufget.sql

spool off

[Top]
No.
제목
작성자
작성일
조회
2539오라클서버 원격지로 접속해서..하는 방법
냐호~~
2001-01-02
1756
2537[Q]리스너가 한번 연결연결후 끊고 나면 다음부터는 아답터 에러발생합니다!
중짜
2001-01-01
1744
2535오라클과 asp를 연결할려구 하는데...
한은석
2000-12-30
1937
2534Explain plain
나그네
2000-12-30
2611
2533Response time 이 10초 이상인 SQL source
나그네
2000-12-30
2100
2532현재 running 중인 SQL 의 조회
나그네
2000-12-30
2172
2531어떤 object 에 어떤 lock 이 진행중인가?
나그네
2000-12-30
2124
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.018초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다