[20221208]完善bind_cap_awr.sql指令碼.txt
[20221208]完善bind_cap_awr.sql指令碼.txt
--//以前寫的抓取繫結變數的指令碼,如果繫結變數型別是timestamp型別是儲存在v$sql_bind_capture.value_anydata中.
--//我以前的寫法如下,不合理多建立一個欄位:
$ cat bind_cap_awr.sql
set verify off
prompt
prompt @bind_cap_awr sql_id [column]
prompt
column value_string format a50
column datatype_string format a15
break on snap_id on sql_id on was_captured on last_captured skip 1
select replace(sql_fulltext,chr(13),'') c200 from v$sql where sql_id='&1' and rownum<=1;
--select replace(sql_text,chr(13),'') c200 from DBA_HIST_SQLTEXT where sql_id='&1' and rownum<=1;
SELECT snap_id,
INSTANCE_NUMBER,
sql_id,
was_captured,
last_captured,
name,
position,
max_length,
datatype_string,
DECODE (
datatype_string,
'DATE', TO_CHAR (TO_DATE (value_string, 'mm/dd/yy hh24:mi:ss'),
'yyyy/mm/dd hh24:mi:ss'),
value_string)
value_string,
decode(datatype_string,'TIMESTAMP',ANYDATA.accesstimestamp (value_anydata)) c30
FROM DBA_HIST_SQLBIND
WHERE sql_id = '&1' AND was_captured = 'YES' and dup_position is null and lower(name) like lower('%'||nvl('&&2',name)||'%')
ORDER BY snap_id ,last_captured, was_captured, position;
clear break
--//改寫後程式碼如下:
$ cat bind_cap_awr.sql
set verify off
prompt
prompt @bind_cap_awr sql_id [column]
prompt
column value_string format a50
column datatype_string format a15
break on snap_id on sql_id on was_captured on last_captured skip 1
select replace(sql_fulltext,chr(13),'') c200 from v$sql where sql_id='&1' and rownum<=1;
--select replace(sql_text,chr(13),'') c200 from DBA_HIST_SQLTEXT where sql_id='&1' and rownum<=1;
SELECT snap_id
,INSTANCE_NUMBER
,sql_id
,was_captured
,last_captured
,name
,position
,max_length
,datatype_string
,DECODE
(
datatype_string
,'DATE', TO_CHAR ( TO_DATE (value_string, 'mm/dd/yy hh24:mi:ss') ,'yyyy/mm/dd hh24:mi:ss')
,'TIMESTAMP', TO_CHAR ( ANYDATA.accesstimestamp (value_anydata) ,'yyyy/mm/dd hh24:mi:ss.ff9')
,value_string
)
value_string
-- decode(datatype_string,'TIMESTAMP',ANYDATA.accesstimestamp (value_anydata)) c30
FROM DBA_HIST_SQLBIND
WHERE sql_id = '&1'
AND was_captured = 'YES'
AND dup_position IS NULL
AND LOWER (name) LIKE LOWER ('%' || NVL ('&&2', name) || '%')
ORDER BY snap_id
,last_captured
,was_captured
,position;
clear break
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2927700/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20221208]完善bind_cap.sql指令碼.txtSQL指令碼
- [20170628]完善ooerr指令碼.txt指令碼
- [20210506]完善tix指令碼.txt指令碼
- [20210407]完善ti.sql指令碼.txtSQL指令碼
- [20210623]完善清除aud指令碼.txt指令碼
- [20201202]完善sosi指令碼.txt指令碼
- [20220510]完善tpt expandz.sql指令碼.txtSQL指令碼
- [20211230]完善sql_id指令碼.txtSQL指令碼
- [20221010]完善descz.sql指令碼.txtSQL指令碼
- [20221101]完善descz.sql指令碼.txtSQL指令碼
- [20221101]完善gts.sql指令碼.txtSQL指令碼
- [20211130]完善tpt t.sql指令碼.txtSQL指令碼
- [20211122]完善descx.sql指令碼.txtSQL指令碼
- [20230414]完善seg2.sql指令碼.txtSQL指令碼
- [20231117]完善ashtt.sql指令碼.txtSQL指令碼
- [20230203]完善awr.sql指令碼.txtSQL指令碼
- [20221012]完善spsw.sql指令碼.txtSQL指令碼
- [20211129]完善tpt tablist.sql指令碼.txtSQL指令碼
- [20211202]完善d_buffer.sql指令碼.txtSQL指令碼
- [20211129]完善tpt killi.sql指令碼.txtSQL指令碼
- [20220323]完善tpt get_trace.sql指令碼.txtSQL指令碼
- [20220309]完善shp4.sql指令碼.txtSQL指令碼
- [20220217]完善tpt gts.sql指令碼.txtSQL指令碼
- [20230210]建立完善swcnm.sql指令碼.txtSQL指令碼
- [20230123]完善curheapz.sql指令碼.txtSQL指令碼
- [20210125]完善hide.sql指令碼.txtIDESQL指令碼
- [20241114]建立完善ext_kglob.sh指令碼.txt指令碼
- [20190416]完善shared latch測試指令碼2.txt指令碼
- [20220823]完善tpt的ashtop.sql指令碼.txtSQL指令碼
- [20231025]完善tpt的trans.sql指令碼.txtSQL指令碼
- [20211126]完善tpt pr.sql指令碼.txtSQL指令碼
- [20191111]完善bind_cap.sql指令碼.txtSQL指令碼
- [20220311]完善ash_wait_chains指令碼.txtAI指令碼
- [20230302]建立完善tpt o2.sql指令碼.txtSQL指令碼
- [20230203]建立完善sp1x.sql指令碼.txtSQL指令碼
- [20220422]完善tpt ash ash_index_helperx指令碼2.txtIndex指令碼
- [20220111]完善tpt ashash_index_helper指令碼.txtIndex指令碼
- [20220317]補充完善TPT 顯示欄位列的指令碼.txt指令碼