[Oracle Script] check Literal SQL
SELECT (SELECT parsing_schema_name FROM v$sqlarea WHERE sql_id = a.max_sql_id) SCHEMA,
(SELECT MODULE FROM v$sqlarea WHERE sql_id = a.max_sql_id) MODULE,
a.literal_sql_cnt,
a.execution_cnt,
a.plan_cnt,
(SELECT sql_fulltext FROM v$sqlarea WHERE sql_id = a.max_sql_id) sql_text,
a.max_sql_id
FROM (SELECT s.force_matching_signature,
COUNT(s.exact_matching_signature) literal_sql_cnt,
SUM(s.executions) execution_cnt,
MIN(s.sql_id) max_sql_id,
COUNT(DISTINCT s.plan_hash_value) plan_cnt
FROM v$sql s where s.parsing_schema_name<>'SYS'
GROUP BY s.force_matching_signature
HAVING COUNT(s.exact_matching_signature) > 1) a
ORDER BY 3 DESC;
對SQL語句,去掉重複的空格(不包括字元常量),將大小寫轉換成相同,比如均為大寫(不包括字元常量)後,如果
SQL相同,那麼SQL語句的exact_matching_signature就是相同的。對SQL語句,去掉重複的空格(不包括字元常量),將大小寫轉換成相同,
比如均為大寫(不包括字元常量),然後去掉SQL中的常量,如果SQL相同,那麼SQL語句的force_matching_signature就是相同的。但是例
外的情況是:如果SQL中有繫結變數,force_matching_signature就會與exact_matching_signature一樣的生成標準。
參考: http://blog.itpub.net/24237320/viewspace-2134510/
(SELECT MODULE FROM v$sqlarea WHERE sql_id = a.max_sql_id) MODULE,
a.literal_sql_cnt,
a.execution_cnt,
a.plan_cnt,
(SELECT sql_fulltext FROM v$sqlarea WHERE sql_id = a.max_sql_id) sql_text,
a.max_sql_id
FROM (SELECT s.force_matching_signature,
COUNT(s.exact_matching_signature) literal_sql_cnt,
SUM(s.executions) execution_cnt,
MIN(s.sql_id) max_sql_id,
COUNT(DISTINCT s.plan_hash_value) plan_cnt
FROM v$sql s where s.parsing_schema_name<>'SYS'
GROUP BY s.force_matching_signature
HAVING COUNT(s.exact_matching_signature) > 1) a
ORDER BY 3 DESC;
對SQL語句,去掉重複的空格(不包括字元常量),將大小寫轉換成相同,比如均為大寫(不包括字元常量)後,如果
SQL相同,那麼SQL語句的exact_matching_signature就是相同的。對SQL語句,去掉重複的空格(不包括字元常量),將大小寫轉換成相同,
比如均為大寫(不包括字元常量),然後去掉SQL中的常量,如果SQL相同,那麼SQL語句的force_matching_signature就是相同的。但是例
外的情況是:如果SQL中有繫結變數,force_matching_signature就會與exact_matching_signature一樣的生成標準。
參考: http://blog.itpub.net/24237320/viewspace-2134510/
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-2143141/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [Oracle Script] check userOracle
- [Oracle Script] check latchOracle
- [Oracle Script] check active sessionOracleSession
- [Oracle Script] check lock infoOracle
- [Oracle Script] check tablespace usage infoOracle
- [Oracle Script] check temp tablespace usageOracle
- [Oracle Script] check object count by userOracleObject
- [Oracle Script] check File I/OOracle
- check ftp success scriptFTP
- [Oracle Script] Top sqlOracleSQL
- script of check repair ASM DISKGROUPAIASM
- ORACLE SQL Tuning Health-Check(SQLHC)OracleSQL
- 【SCRIPT】Oracle統計資訊相關SQLOracleSQL
- oracle scriptOracle
- sql server schedule scriptSQLServer
- 關於Oracle DB中SQL Script的註釋(REM,--,/* */)OracleSQLREM
- [Oracle Script] LockOracle
- Oracle Database ScriptOracleDatabase
- top sql capture script.SQLAPT
- a-better-way-to-find-literal-sqls-in-oracle-10g/SQLOracle
- 升級check SQL01SQL
- Oracle kill session scriptOracleSession
- ORACLE常用Script(轉)Oracle
- ORACLE常用Script (轉)Oracle
- MySQL5.7: sql script demoMySql
- Script: resource_waits.sqlAISQL
- Script to Check for Foreign Key Locking Issues [ID 1019527.6]
- Check the transaction running in oracleOracle
- [Oracle Script] Log switch statusOracle
- [Oracle Script] latch holderOracle
- [Oracle Script] Temporary Sort UsageOracle
- [Oracle Script] Rollback Segment UsageOracle
- [Javascript] template literal tagJavaScript
- ORACLE WITH CHECK OPTION子句詳解Oracle
- [Oracle Script] select db parameterOracle
- [Oracle Script] ASM Disks Performance metricOracleASMORM
- [Oracle Script] Undo Usage Per statusOracle
- [Oracle Script] Undo Usage Per sessionOracleSession