为单条sql运行sql Access Advisor
参考自:
https://oracle-base.com/articles/10g/sql-access-advisor-10g
[oracle@test ~]$ sqlplus scott/aaaaaa sql*Plus: Release 10.2.0.5.0 - Production on Sat Jul 1 07:22:20 2017 Copyright (c) 1982,2010,Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning,OLAP,Data Mining and Real Application Testing options sql> BEGIN 2 DBMS_ADVISOR.quick_tune( 3 advisor_name => DBMS_ADVISOR.sqlACCESS_ADVISOR,4 task_name => 'emp_quick_tune_12345',5 attr1 => 'SELECT e.* FROM emp e WHERE UPPER(e.ename) = ''SMITH'''); 6 END; 7 / PL/sql procedure successfully completed. sql> SET LONG 100000 sql> SET PAGESIZE 50000 sql> SELECT DBMS_ADVISOR.get_task_script('emp_quick_tune_12345') AS script FROM dual; SCRIPT -------------------------------------------------------------------------------- Rem sql Access Advisor: Version 10.2.0.5.0 - Production Rem Rem Username: SCOTT Rem Task: emp_quick_tune_12345 Rem Execution date: 01/07/2017 07:23 Rem CREATE INDEX "SCOTT"."EMP_IDX$$_00710001" ON "SCOTT"."EMP" (UPPER("ENAME")) COMPUTE STATISTICS; sql>原文链接:https://www.f2er.com/oracle/208631.html