ERROR: insufficient privileges while using EXPLAIN PLAN command

Hi,
I have a table named TEST and i ran following command on this table.
SQL> EXPLAIN PLAN FOR
2 SELECT NAME FROM TEST;
SELECT NAME FROM TEST
ERROR at line 2:
ORA-01031: insufficient privileges
So which privilege do i need to give for using EXPLAIN PLAN command.
Thank.

http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14211/ex_plan.htm#i19260
SQL> @C:\oracle\product\10.2.0\db_1\RDBMS\ADMIN\utlxplan.sql
Table created.
SQL> select table_name from user_tables where table_name='PLAN_TABLE';
TABLE_NAME
PLAN_TABLE
You might consider checking dba_tables to check the owner in your case and may be you don't privilege on that table.

Similar Messages

  • Error  SP2-0027 while using explain plan

    I'm using explain paln command in order to get the tables
    acceeded by a SQL query.
    When I use the command with some of them, that's OK.
    But when I use it with a query of 4999 characters, it gives me
    this error message:
    SP2-0027: Input is too long (> 2499 characters) - line ignored
    Has anybody an idea to solve this problem or to change this
    limit of 2499?

    user12043927 wrote:
    Open the file (or copy the sql) in a text editor and then resave the file as a different file type.
    In Microsoft Word, you click on File, Save As, then select file type 'text only with line breaks' and save the file. Once this is done, you can successfully run the script from SQL*Plus or Server Manager.You never get a second chance for your first impression.
    As your first post you resurrect a ten year dead zombie post.
    SWEET!
    Can you find a post that is older & dormant to boost your post count?

  • Insufficient privilege while using dynamic sql in procedure

    Hi,
    I am using following script on oracle 10g. and getting unsufficient privs error. please advice.
    SQL> show user
    User is "GRSADM"
    SQL> create or replace procedure grsadm.test_proc as
    a varchar2(2000);
    begin
    a:='CREATE OR REPLACE VIEW
    test_view
    AS SELECT
    ''sadf'' a
    FROM dual';
    execute immediate a;
    end;
    Procedure created.
    SQL> begin
    grsadm.test_proc;
    end;
    begin
    grsadm.test_proc;
    end;
    Error at line 16
    ORA-01031: insufficient privileges
    ORA-06512: at "GRSADM.TEST_PROC", line 9
    ORA-06512: at line 2
    SQL> select * from session_privs
    where privilege like '%VIEW%'
    PRIVILEGE
    CREATE ANY VIEW
    DROP ANY VIEW
    CREATE ANY MATERIALIZED VIEW
    ALTER ANY MATERIALIZED VIEW
    DROP ANY MATERIALIZED VIEW
    5 rows selected.
    Edited by: Ratnesh Sharma on Nov 24, 2011 12:00 PM

    yes it has EXECUTE ANY PROCEDURE priv.
    Following is the list of all the priv this user has.
    PRIVILEGE
    CREATE ANY SQL PROFILE
    DROP ANY SQL PROFILE
    GRANT ANY OBJECT PRIVILEGE
    DEBUG CONNECT SESSION
    RESUMABLE
    ADMINISTER DATABASE TRIGGER
    ADMINISTER RESOURCE MANAGER
    DROP ANY OUTLINE
    DROP ANY CONTEXT
    CREATE ANY CONTEXT
    MANAGE ANY QUEUE
    DROP ANY DIMENSION
    CREATE ANY DIMENSION
    GLOBAL QUERY REWRITE
    DROP ANY INDEXTYPE
    CREATE ANY INDEXTYPE
    DROP ANY OPERATOR
    CREATE ANY OPERATOR
    DROP ANY LIBRARY
    CREATE ANY LIBRARY
    EXECUTE ANY TYPE
    DROP ANY TYPE
    ALTER ANY TYPE
    CREATE ANY TYPE
    DROP ANY DIRECTORY
    CREATE ANY DIRECTORY
    DROP ANY MATERIALIZED VIEW
    ALTER ANY MATERIALIZED VIEW
    CREATE ANY MATERIALIZED VIEW
    ANALYZE ANY
    DROP PROFILE
    CREATE PROFILE
    DROP ANY TRIGGER
    ALTER ANY TRIGGER
    CREATE ANY TRIGGER
    EXECUTE ANY PROCEDURE
    DROP ANY PROCEDURE
    ALTER ANY PROCEDURE
    CREATE ANY PROCEDURE
    CREATE PROCEDURE
    AUDIT ANY
    DROP ANY ROLE
    CREATE ROLE
    DROP PUBLIC DATABASE LINK
    CREATE PUBLIC DATABASE LINK
    CREATE DATABASE LINK
    DROP ANY SEQUENCE
    CREATE ANY SEQUENCE
    DROP ANY VIEW
    CREATE ANY VIEW
    DROP PUBLIC SYNONYM
    CREATE PUBLIC SYNONYM
    DROP ANY SYNONYM
    CREATE ANY SYNONYM
    DROP ANY INDEX
    ALTER ANY INDEX
    CREATE ANY INDEX
    DROP ANY CLUSTER
    CREATE ANY CLUSTER
    DELETE ANY TABLE
    UPDATE ANY TABLE
    INSERT ANY TABLE
    SELECT ANY TABLE
    COMMENT ANY TABLE
    DROP ANY TABLE
    ALTER ANY TABLE
    CREATE ANY TABLE
    DROP ROLLBACK SEGMENT
    CREATE ROLLBACK SEGMENT
    DROP USER
    BECOME USER
    CREATE USER
    UNLIMITED TABLESPACE
    DROP TABLESPACE
    ALTER TABLESPACE
    CREATE TABLESPACE
    CREATE SESSION
    ALTER SYSTEM

  • Query tunning in Oracle using Explain Plan

    Adding to my below question: I have now modified the query and the path shownby 'Explain plan' has reduced. The 'Time' column of plan_table is also showing much lesser value. However, some people are suggesting me to consider the time required by the query to execute on Toad. Will it be practical? Please help!!
    Hi, I am using Oracle 11g. I need to optimize a Select query(Need to minimize the execution time). I need to know how 'Explain Plan' would help me. I know how to use Explain Plan command. I refer Plan_table table to see the details of the plan. Please guide me regarding which columns of the Plan_table should be considered while modifying the query for optimization. Some people say, 'Time' column should be considered, some say 'Bytes' etc. Some suggest on minimizing the full table scans, while some people say that I should minimize the total no. operations (less no. of rows should be displayed in Plan_table). As per an experienced friend of mine, full table scans should be reduced (for e.g. if there are 5 full table scans in the plan, then try to reduce them to less than 5. ). However, if I consider any full table scan operation in the plan_table, its shows value of 'time' column as only 1 which is very very less. Does this mean the full scan is actually taking very less time?? If yes, then this means full table scans are very fast in my case and no need to work on them. Some articles suggest that plan shown by 'Explain Plan' command is not necessarily followed while executing the query. So what should I look for then? How should I optimize the query and how will I come to know that it's optimized?? Please help!!...
    Edited by: 885901 on Sep 20, 2011 2:10 AM

    885901 wrote:
    Hi, I am using Oracle 11g. I need to optimize a Select query(Need to minimize the execution time). I need to know how 'Explain Plan' would help me. I know how to use Explain Plan command. I refer Plan_table table to see the details of the plan. Please guide me regarding which columns of the Plan_table should be considered while modifying the query for optimization. Some people say, 'Time' column should be considered, some say 'Bytes' etc. Some suggest on minimizing the full table scans, while some people say that I should minimize the total no. operations (less no. of rows should be displayed in Plan_table). As per an experienced friend of mine, full table scans should be reduced (for e.g. if there are 5 full table scans in the plan, then try to reduce them to less than 5. ). However, if I consider any full table scan operation in the plan_table, its shows value of 'time' column as only 1 which is very very less. Does this mean the full scan is actually taking very less time?? If yes, then this means full table scans are very fast in my case and no need to work on them. Some articles suggest that plan shown by 'Explain Plan' command is not necessarily followed while executing the query. So what should I look for then? How should I optimize the query and how will I come to know that it's optimized?? Please help!!...how fast is fast enough?

  • Tunning using EXPLAIN PLAN

    HI,
    I am trying to do EXPLAIN PLAN. But SP HAS SO MANY PARAMETER declaration, its very difficult to run explain for each select statement.
    Can any one help me how to run explain paln.

    885901 wrote:
    Hi, I am using Oracle 11g. I need to optimize a Select query(Need to minimize the execution time). I need to know how 'Explain Plan' would help me. I know how to use Explain Plan command. I refer Plan_table table to see the details of the plan. Please guide me regarding which columns of the Plan_table should be considered while modifying the query for optimization. Some people say, 'Time' column should be considered, some say 'Bytes' etc. Some suggest on minimizing the full table scans, while some people say that I should minimize the total no. operations (less no. of rows should be displayed in Plan_table). As per an experienced friend of mine, full table scans should be reduced (for e.g. if there are 5 full table scans in the plan, then try to reduce them to less than 5. ). However, if I consider any full table scan operation in the plan_table, its shows value of 'time' column as only 1 which is very very less. Does this mean the full scan is actually taking very less time?? If yes, then this means full table scans are very fast in my case and no need to work on them. Some articles suggest that plan shown by 'Explain Plan' command is not necessarily followed while executing the query. So what should I look for then? How should I optimize the query and how will I come to know that it's optimized?? Please help!!...how fast is fast enough?

  • "ORA-20171 WM error: Insufficient privileges" using mergeTable

    Hi,
    I deleted 1 row on a table in a workspace and committed. Now when I do mergeTable for that row I get the following error:
    ORA-20171 WM error: Insufficient privileges
    ORA-06512 at “WMSYS.LT”, line 7203
    ORA-06512 as line 7
    DBMS_WM.mergetable(WORKSPACE => ‘xxxx’,TABLE_ID =>’yyyy’,WHERE_CLAUSE => 'PK_COLUMN = id',REMOVE_DATA => FALSE,AUTO_COMMIT => FALSE);
    The user that i'm using to log in the db has all the available privilieges for all workspaces: XXX_ANY_WORKSPACE; and he is the owner of the refered table.
    Can you help me?
    Thanks in advance.
    Best regards,
    Pedro Lourenço

    Hi,
    We are using version 10.2.0.4.3 of OWM.
    The call stack you asked for:
    ----- PL/SQL Call Stack -----
    object line object
    handle number name
    0x1c37310b8 342 package body WMSYS.WM_ERROR
    0x1c37310b8 359 package body WMSYS.WM_ERROR
    0x1c37787d8 8643 package body WMSYS.LTUTIL
    0x1c36e6ef8 17 package body WMSYS.OWM_ASSERT_PKG
    0x1c450d8c8 5057 package body WMSYS.LTADM
    0x1c450d8c8 6999 package body WMSYS.LTADM
    0x1c450d8c8 7158 package body WMSYS.LTADM
    0x1c450d8c8 9094 package body WMSYS.LTADM
    0x1c48f5910 2743 package body WMSYS.LT
    0x1c48f5910 2467 package body WMSYS.LT
    0x1c48f5910 2409 package body WMSYS.LT
    0x1c48f5910 7191 package body WMSYS.LT
    0x1a9d70c70 7 anonymous block
    ----- Call Stack Trace -----
    Any idea? Thanks.
    Regards,
    Pedro Lourenço

  • Not able to use EXPLAIN PLAN in Toad

    hi,
    I am not able to use Explain Plan in Toad. The error it gives is the table PLAN_TABLE doesn't exit.
    But after seeing this error I did run the script "UTLXPLAN.sql" in order to create the plan_table table.
    After installing the above table I am not able to use EXPLAIN_PLAN from toad, Its giving same error Table PLAN_TABLE doesn't exit though i created it successfully in the proper schema.
    Thanks in advance
    Ram

    check and post.
    SQL> select owner from dba_tables where table_name='PLAN_TABLE';
    before using toad ,first u should connect to sqlplus by that user and issue
    SET AUTOTRACE ON.
    Kuljeet

  • Using explain plan

    Hi,
    I am quite new to use explain plan in oracle.
    I want to know what are the important factors that we should emphasize to optimize a SQL query.
    Thanks in Advance,
    Dilip

    If I had to identify key SQL tuning factors to look for in relation to an explain plan I would say that number one is to verify that the plan is driving on the right tables in the proper order.
    Second looking at the SQL make sure it is not written in such a manner as to disable the use of available indexes such as when a trunc is done on an indexed date column so it can be compared equal to another date when a >= date value of midnight and < midnight of first day not desired could be used instead enabling use of the index on the date column by the optimizer. Implicit conversions of join column data types can also disable use of an index.
    Third, if the CBO is doing something other than what you expected do not just assume it is wrong. Try to figure out why it is doing what it is doing and then try to determine if it is right or wrong. I have caught people trying to tune SQL because they knew the plan was wrong, but did not actually test it before spending a lot of time to develop a different path that ran slower than the optimzer plan.
    HTH -- Mark D Powell --

  • Insufficient privileges while creating EUL

    Hi All,
    I am trying to create a new EUL in Discoverer 9.0.4. Option "Select an existing user" is selected and "Grant access to Public" is unchecked.
    I am connected as user A. The tables are in schema for user B. So I selected the user B and entered the password. When I click "Finish", I get the following error:
    Insufficient privileges to create a new user or grant the necessary privileges to an existing user. You must have CREATE USER, ALTER USER and GRANT ANY PRIVILEGE privileges.
    Now user A does have privileges to create role, view, table, session, sequence, procedure. User B too has these privileges plus a few more.
    Can somebody help me with what privileges am I lacking? For which user, A or B?
    Thanks.

    If you want to create an EUL the user you select (B in your case) must be the following privilegies:
    CREATE SESSION
    CREATE USER
    GRANT ANY PRIVILEGE
    ALTER USER
    It doesn't matter the user you are connected in Discoverer.
    Hope this helps.

  • How to export low quality png while using exportToPNGSequence jsfl command ?

    how export low quality png while using exportToPNGSequence jsfl command ?

    var mat=fl.getDocumentDOM().library[0].matrix;
    mat.a=.5;
    mat.d=.5;
    fl.getDocumentDOM().library[0].exportToPNGSequence(file:///yourfile.png,startframe,endfram e,mat);

  • Used Explain Plan

    Hi,
    on 11.2.0.3 , I use the following to verify the Explain Plan used for an executed query.
    SELECT * FROM
    TABLE(DBMS_XPLAN.DISPLAY_AWR('<sql_id>','<plan_hash>'));
    For example
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_AWR('cx8m90z5n57g1','3867296312'));
    The problem is that it does not bring always back a result to display . Every now and then it does not find any Explain Plan. Why ?
    Any other way that let to find Used Explain Plan for sure ?
    Thanks and regards.

    The problem is that it does not bring always back a result to display . Every now and then it does not find any Explain Plan. Why ?
    Because the statemen didn't qualify according to the thresholds of thw AWR or was already removed from the AWR.
    Any other way that let to find Used Explain Plan for sure ?
    Definitely. And anyone providing DBMS_XPLAN examples as search string in Google would have been able to find them.
    Sybrand Bakker
    Senior Oracle DBA

  • Giving error of insufficient privileges while creating triggers

    Hi all,
    I am facing the problem of insuffcient privilege on base tables while creating triggers. I have three schemas say A, B, C in my database.
    Base tables are in schema A. I have given all the grants on base table to schema B and C.
    grant all on base_table_name to B;
    grant all on base_table_name to C;
    I have created synonym also on that base table.
    And i m creating triggers in schema B.
    When i execute the query for trigger the it giving following error :
    +AFTER INSERT OR UPDATE OR DELETE ON BASE_TBALE_NAME                                      *+
    ERROR at line 3:
    ORA-01031: insufficient privileges
    even i have checked in dba_tab_privs for that base_table.....it is showing all the grants to USER B and C.
    What should I do now?
    please suggest.......
    Regards,
    Andy.

    Hi karan,
    You are right. While searching docs i got the solution of my problem.
    Privileges Required to Use Triggers
    To create a trigger in your schema:
    +•You must have the CREATE TRIGGER system privilege+
    +•One of the following must be true:+
    +◦You own the table specified in the triggering statement+
    +◦You have the ALTER privilege for the table specified in the triggering statement+
    +◦You have the ALTER ANY TABLE system privilege+
    To create a trigger in another schema, or to reference a table in another schema from a trigger in your schema:
    +•You must have the CREATE ANY TRIGGER system privilege.+
    +•You must have the EXECUTE privilege on the referenced subprograms or packages.+
    To create a trigger on the database, you must have the ADMINISTER DATABASE TRIGGER privilege. If this privilege is later revoked, you can drop the trigger but not alter it.
    The object privileges to the schema objects referenced in the trigger body must be granted to the trigger owner explicitly (not through a role). The statements in the trigger body operate under the privilege domain of the trigger owner, not the privilege domain of the user issuing the triggering statement (this is similar to the privilege model for stored subprograms).
    I have to grant only create any trigger to user.
    Problem solved.
    Thanks to all for ur help.
    Regards,
    Andy.

  • What are the privileges required for explain plan in Oracle 11g database

    I am facing the problem in doing a explain plan for a view in Oracle 11g database. When I select from the view like this:
    select * from zonewisearpu
    It does a select on the view but when I give explain plan like
    explain plan for
    select * from zonewisearpu
    I get the error like insufficient privileges.
    Please let me know if things are getting missed out as I guess system level privileges are required to execute this.
    I hope, my question is clear.
    It’s a humble request to revert urgently if possible as I need to complete a task and do not know the way out.
    Regards

    975148 wrote:
    Thanks for your reply. I have found out that an explain plan is possible on the user's own objects and is not possible on the granted objects from a different schema. For eg, if I do a explain plan on a view querying on tables from a different view, it would not allow the explain plan to proceed. This could mean that explain plan needs different privileges than just a select.
    Requesting for a revert to this.
    Here is a simple test case that I have perfomed
    SQL> create user test1 identified by test1;
    User created.
    SQL> create user test2 identified by test1;
    User created.
    SQL> grant connect, resource to test1,test2;
    Grant succeeded.
    SQL> create table test1.tab1 as select * from v$session;
    Table created.
    SQL> connect test2/test1
    Conencted.
    SQL> show user
    USER is "TEST2"
    SQL>
    SQL> explain plan for
      2  select sid,serial#,status,username from test1.tab1 where username<> '';
    Explained.
    SQL>
    So, as can be seen I am able to do a explain plan from user test2 for tables belong to user test1.
    As far as privileges are concerned, following is the list
    SQL> select * from dba_role_privs where grantee in ('TEST1','TEST2') order by 1;
    GRANTEE                        GRANTED_ROLE                   ADM DEF
    TEST1                          CONNECT                        NO  YES
    TEST1                          RESOURCE                       NO  YES
    TEST2                          CONNECT                        NO  YES
    TEST2                          RESOURCE                       NO  YES
    SQL>
    SQL> select grantee,owner,table_name,privilege from dba_tab_privs where grantee in ('TEST1','TEST2') order by 1;
    GRANTEE    OWNER      TABLE_NAME           PRIVILEGE
    TEST2      TEST1      TAB1                 SELECT
    SQL>
    SQL>  select * from dba_sys_privs where grantee in ('TEST1','TEST2') order by 1;
    GRANTEE    PRIVILEGE                      ADM
    TEST1      UNLIMITED TABLESPACE           NO
    TEST2      UNLIMITED TABLESPACE           NO
    SQL>

  • Ora-01039 - Insuffficient priviliges - Tuning using Explain Plan

    In a TEST instance, i am trying (as the APPS user) on a 9.2.0.5 DB (11.5.10.2) trying to run an explain plan on a query but keep getting the 'ora-01039 - Insuffficient privileges on underlying objects of view' error message.
    I have granted 'select any dictionary' to both the APPS and APPLSYS users - but this does not seem to enable the explain plan to work.
    Could someone please shed some light on this?
    Tks

    You seem to be doin an Explain Plan on a query against a custom view against non-Apps objects.
    Explain Plan needs to be able to "see" the underlying tables (in that other schema).
    See :
    SQL> create view his_cntry_vw as select * from my_cntry;
    View created.
    SQL> grant select on his_cntry_vw to abc;
    Grant succeeded.
    SQL> connect abc/abc
    Connected.
    SQL> create synonym his_cntry_vw for otheruser.his_cntry_vw;
    Synonym created.
    SQL> select * from his_cntry_vw;
    GRP_I CNTRY
    ABC   Z9
    XYZ   UK
    SQL> explain plan for select * from his_cntry_vw;
    explain plan for select * from his_cntry_vw
    ERROR at line 1:
    ORA-01039: insufficient privileges on underlying objects of the view
    SQL> REM  THIS IS THE FIX :
    SQL> connect otheruser/otheruser
    Connected.
    SQL> grant select on my_cntry to abc;
    Grant succeeded.
    SQL> connect abc/abc
    Connected.
    SQL> explain plan for select * from his_cntry_vw;
    Explained.
    SQL>Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • Register schema: insufficient privileges to use enablehierarchy

    Hello,
    In Oracle11g release 2 I'm trying to register a schema. It works, as long as I set enablehierarchy to ENABLE_HIERARCHY_NONE.
    For all other values of this parameter, I get this error message:
    ORA-31061: XDB error: DBMS_XDBZ.ENABLE_HIERARCHY
    ORA-06512: at "XDB.DBMS_XDBZ0", line 131
    ORA-06512: at "XDB.DBMS_XDBZ0", line 586
    ORA-01031: insufficient privileges
    ORA-06512: at "XDB.DBMS_XDBZ", line 37
    ORA-06512: at line 1
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 55
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 159
    ORA-06512: at line 4
    for instance, this works:
    declare doc xmltype;
    begin
    select dbms_xmlschema.generateschema(user,'VORM') into doc from dual;
    dbms_xmlschema.registerschema('http://www.5hart.com/schema/vormen.xsd', doc,
    gentypes => false,
    enablehierarchy=>dbms_xmlschema.*ENABLE_HIERARCHY_NONE*);
    end;
    but this doesn't:
    declare doc xmltype;
    begin
    select dbms_xmlschema.generateschema(user,'VORM') into doc from dual;
    dbms_xmlschema.registerschema('http://www.5hart.com/schema/vormen.xsd', doc,
    gentypes => false,
    enablehierarchy=>dbms_xmlschema.*ENABLE_HIERARCHY_CONTENTS*);
    end;
    Could someone tell me what privileges I'm missing? I have the role XDBADMIN, I've tried "grant execute on DBMS_XDBZ, but nothing works.
    Help would be appreciated.
    Thanx,
    Marko
    Edited by: user11998055 on 10-dec-2009 2:09
    Edited by: user11998055 on 10-dec-2009 2:55

    Nowadays I can explain why this works - I think.
    Locally registered xml schemas are protected by ACL's (more or less) and is accessable ONLY by the user that created it (besides SYS). DBA,XDBADMIN, system accounts etc are just not good enough.
    The direct granted "alter session" prevents having to use the full syntax of OWNER.OBJECT_NAME.COLUMN_NAME@DBLINK etc, etc... and thus refering to objects can be reduced to OBJECT_NAME instead of OWNER.OBJECTNAME and makes it possible for the package to do its XDBZ thingy.
    ;-)

Maybe you are looking for