When I execute the below procedure I am getting the below mentioned error
SQL> CREATE PROCEDURE sql_tuning_demo (
2 hint_in IN VARCHAR2 DEFAULT NULL
3 ) AS
4
5 v_task VARCHAR2(30);
6 v_sql CLOB;
7
8 BEGIN
9
10
11 v_sql := ' DELETE /*+ ' || hint_in || ' */ FROM t1 a
12 WHERE a.ROWID > ( SELECT min( b.ROWID )
13 FROM t1 b
14 WHERE a.owner = b.owner
15 AND a.name = b.name
16 AND a.type = b.type
17 AND a.line = b.line )';
18
19
20 BEGIN
21 DBMS_SQLTUNE.DROP_TUNING_TASK(
22 task_name => 'sql_tuning_task'
23 );
24 EXCEPTION
25 WHEN OTHERS THEN
26 NULL;
27 END;
28
29
30 v_task := DBMS_SQLTUNE.CREATE_TUNING_TASK(
31 sql_text => v_sql,
32 time_limit => 1,
33 scope => 'COMPREHENSIVE',
34 task_name => 'sql_tuning_task',
35 description => 'Demo of DBMS_SQLTUNE'
36 );
37
38
39 DBMS_SQLTUNE.EXECUTE_TUNING_TASK(
40 task_name => 'sql_tuning_task'
41 );
42
43
44 ROLLBACK;
45
46 END sql_tuning_demo;
47 /
Error details :
ERROR at line 1:
ORA-13616: The current user scott has not been granted the ADVISOR privilege.
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_ADVISOR", line 941
ORA-06512: at "SYS.DBMS_SQLTUNE", line 622
ORA-06512: at "scott.SQL_TUNING_DEMO", line 95
ORA-06512: at line 1
Please help me on this .
Thanks in advance ............