[20150403]修正sql語句.txt
[20150403]修正sql語句.txt
--主要在一些除錯與最佳化時加入hint容易.
--參考了連結,我自己做了小量的修改.
http://blog.itpub.net/22034023/viewspace-1063610/
/* Formatted on 2015/4/3 9:01:53 (QP5 v5.252.13127.32867) */
--SET LINESIZE 153
SET VERIFY OFF
--SET PAGESIZE 10000
--ACCEPT sql_id -
--PROMPT 'Enter value for sql_id: ' -
--DEFAULT '&&1'
SELECT * FROM TABLE (DBMS_XPLAN.display_cursor ('&&1', NULL, 'outline'));
ACCEPT hint_txt -
PROMPT 'Enter value for hint_text: ' -
DEFAULT 'comment'
SET FEEDBACK OFF
SET SQLBLANKLINES ON
SET SERVEROUTPUT ON
DECLARE
l_profile_name VARCHAR2 (30);
cl_sql_text CLOB;
BEGIN
SELECT sql_fulltext
INTO cl_sql_text
FROM v$sqlarea
WHERE sql_id = '&&1';
SELECT 'profile ' || '&&1' INTO l_profile_name FROM DUAL;
DBMS_SQLTUNE.import_sql_profile
(
sql_text => cl_sql_text
,profile => sqlprof_attr (q'[&&hint_txt]')
,category => ''
,name => l_profile_name
,force_match => FALSE
);
DBMS_OUTPUT.put_line (' ');
DBMS_OUTPUT.put_line ('Profile ' || l_profile_name || ' created.');
DBMS_OUTPUT.put_line (' ');
END;
/
COL FIRST_LOAD_TIME FOR a20
SELECT OBJECT_STATUS
,FIRST_LOAD_TIME
,plan_hash_value
,executions
,buffer_gets
,LAST_ACTIVE_TIME
,SQL_ID
FROM v$sql
WHERE sql_id = '&&1';
prompt =================================================================================================================================================
prompt if drop or alter sql profile ,run :
prompt execute dbms_sqltune.drop_sql_profile(name => 'profile &&1')
prompt execute dbms_sqltune.alter_sql_profile(name => 'profile &&1',attribute_name=>'STATUS',value=>'DISABLED')
prompt =================================================================================================================================================
prompt
prompt
PRO
PRO
UNDEF sql_id
UNDEF hint_txt
SET SQLBLANKLINES OFF
SET SERVEROUTPUT OFF
SET FEEDBACK ON
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-1484706/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SQL語句的處理過程修正SQL
- [20170103]sql語句過載.txtSQL
- SQL語句SQL
- Java中如何解析SQL語句、格式化SQL語句、生成SQL語句?JavaSQL
- [20170703]SQL語句分析執行過程.txtSQL
- [20131204]sql語句優化.txtSQL優化
- [20151221]sql語句優化.txtSQL優化
- [20141013]奇怪的sql語句.txtSQL
- [20150527]跟蹤單個sql語句.txtSQL
- [20121101]tkprof抽取sql語句.txtSQL
- [20240320]空格與sqlpus的sql語句.txtSQL
- [20240607]PL/SQL中sql語句的註解.txtSQL
- sql語句大全SQL
- 共享SQL語句SQL
- SQL語句整理SQL
- SQL基本語句SQL
- 精妙Sql語句SQL
- SQL語句集合SQL
- oracle sql語句OracleSQL
- sql語句 求救!SQL
- SQL精妙語句SQL
- SQL語句收集SQL
- 常用SQL語句SQL
- sql常用語句SQL
- [20201210]sql語句優化.txtSQL優化
- 【SQL】10 SQL UPDATE 語句SQL
- 【SQL】11 SQL DELETE 語句SQLdelete
- [20150724]無法通過sql_id找到sql語句.txtSQL
- [20220117]超長sql語句.txtSQL
- [20201105]再分析sql語句.txtSQL
- [20220329]是否開發寫錯sql語句.txtSQL
- [20220331]如何調整sql語句.txtSQL
- [20160704]從跟蹤檔案抽取sql語句.txtSQL
- [20160407]sql語句父子游標的堆轉儲.txtSQL
- [20150831]中文符號在sql語句.txt符號SQL
- 【SQL】9 SQL INSERT INTO 語句SQL
- 1.3. SQL 語句SQL
- Sql語句小整理SQL