Thursday, June 19, 2014

How to disable or drop an SQL Profile

Find the profiles currently saved in the database:
SELECT NAME, CREATED,LAST_MODIFIED,TYPE,STATUS,FORCE_MATCHING
FROM DBA_SQL_PROFILES
ORDER BY CREATED DESC;


NAME CREATED LAST_MODIFIED TYPE STATUS FORCE_MATCHING
SYS_SQLPROF_0146b2c081f9011a 19.06.2014 08:11:39,000000 19.06.2014 08:11:39,000000 MANUAL ENABLED NO
SYS_SQLPROF_0146b2bf0d430118 19.06.2014 08:10:03,000000 19.06.2014 08:10:03,000000 MANUAL ENABLED NO
SYS_SQLPROF_0146af25274a0117 18.06.2014 15:23:06,000000 18.06.2014 15:23:06,000000 MANUAL ENABLED NO
SYS_SQLPROF_0146af1a61f40116 18.06.2014 15:11:20,000000 18.06.2014 15:11:20,000000 MANUAL ENABLED NO
SYS_SQLPROF_0146af18d0960115 18.06.2014 15:09:37,000000 18.06.2014 15:09:37,000000 MANUAL ENABLED NO
SYS_SQLPROF_0146af150fc30114 18.06.2014 15:05:31,000000 18.06.2014 15:05:31,000000 MANUAL ENABLED NO
SYS_SQLPROF_01462313623f0113 22.05.2014 10:36:51,000000 22.05.2014 10:36:51,000000 MANUAL ENABLED NO
SYS_SQLPROF_01461857e9680112 20.05.2014 08:35:53,000000 20.05.2014 08:35:53,000000 MANUAL ENABLED NO
SYS_SQLPROF_014614c584ab0111 19.05.2014 15:57:07,000000 19.05.2014 15:57:07,000000 MANUAL ENABLED NO

To disable the profile, which means they will not any longer be considered by the CBO until you once again accept them:
set serveroutput on
 begin
   dbms_sqltune.alter_sql_profile(name=>'SYS_SQLPROF_0146af25274a0117', attribute_name=>'STATUS',value=>'DISABLED');
 end;
/
To completely drop the profile:
set serveroutput on
 begin
   dbms_sqltune.drop_sql_profile(name=>'SYS_SQLPROF_0146af25274a0117');
end;
/

No comments:

Post a Comment