收集full table / index scan sql
1. 子程式
#!/bin/ksh
sqlplus -S /nolog
<
col sql_text format a81
set lines 1000
set pages 1000
set verify off
select t.* from v\$sqlarea t, v\$sql_plan p
where t.hash_value=p.hash_value and
p.operation='TABLE ACCESS'
and p.options='FULL';
select sql_text from v\$sqlarea t, v\$sql_plan p
where t.hash_value=p.hash_value and
p.operation='INDEX'
and p.options='FULL
SCAN';
exit;
EOF
2. monitor
#!/usr/bin/ksh
echo "begin seach full table scan" >
./fullscansql.log
while [ 1 -lt 2 ]
do
sleep 300
./getfullscansql.sh >>
./fullscansql.log
done
還可以對sql_plan的timestamp和object_owner加入限制條件
p.TIMESTAMP > to_date('2009-03-18
16:00:00','yyyy-mm-dd hh24:mi:ss')
p.object_owner in ('schema_names...')
come from: http://blog.sina.com.cn/s/blog_538040b70100eect.html
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90618/viewspace-670384/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- INDEX UNIQUE SCAN,INDEX FULL SCAN和INDEX FAST FULL SCANIndexAST
- Index Full Scan vs Index Fast Full ScanIndexAST
- Index Full Scan 與 Index Fast Full ScanIndexAST
- rowid,index,INDEX FULL SCAN,INDEX FAST FULL SCAN|IndexAST
- INDEX FULL SCAN和INDEX FAST FULL SCAN區別IndexAST
- index full scan 和 index FAST full scan 區別IndexAST
- Index Full Scan 與 Index Fast Full Scan (Final)IndexAST
- Index的掃描方式:index full scan/index fast full scanIndexAST
- INDEX FULL SCAN和INDEX FAST FULL SCAN的區別IndexAST
- index full scan 和 index fast full scan (IFS,FFS)的不同IndexAST
- Index Full Scan和Index Fast Full Scan行為差異分析(上)IndexAST
- Index Full Scan和Index Fast Full Scan行為差異分析(下)IndexAST
- (轉)索引掃描還是全表掃描(Index Scan Or Full Table Scan)索引Index
- 轉)索引掃描還是全表掃描(Index Scan Or Full Table Scan)索引Index
- index range scan,index fast full scan,index skip scan發生的條件IndexAST
- index fast full scan 和 nullIndexASTNull
- Fast full index scan 淺析ASTIndex
- 【TUNE_ORACLE】列出走了INDEX FULL SCAN的SQL參考OracleIndexSQL
- FBI? MAX? INDEX FULL SCAN (MIN/MAX)?Index
- [總結]關於index range scans & INDEX (FAST FULL SCAN)IndexAST
- SELECT COUNT(*) 索引會走 index fast full scan索引IndexAST
- 【優化】INDEX FULL SCAN (MIN/MAX)訪問路徑優化Index
- index fast full scan不能使用並行的實驗IndexAST並行
- 【最佳化】INDEX FULL SCAN (MIN/MAX)訪問路徑Index
- oracle實驗記錄(INDEX fast full scan 的成本計算)OracleIndexAST
- Index Full Scans和Index Fast Full ScansIndexAST
- 20180316不使用INDEX FULL SCAN (MIN/MAX)Index
- 高效的SQL(Index unique scan最優化)SQLIndex優化
- 高效的SQL(index range scan優化排序)SQLIndex優化排序
- 高效的SQL(index skip scan使用條件)SQLIndex
- INDEX SKIP SCANIndex
- Clustered Index Scan and Clustered Index SeekIndex
- 理解index skip scanIndex
- Index Unique Scan (213)Index
- PostgreSQL DBA(119) - pgAdmin(LIMIT:Index Scan vs Bitmap Index Scan)SQLMITIndex
- [轉貼]Skip Scan IndexIndex
- 關於INDEX SKIP SCANIndex
- Index Range Scan (214)Index