﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>FranklinFaces.com - Oracle &amp; SQL Server Database Forums for all IT Professionals / Oracle Forum / ORA - Oracle Database Error Codes - Search via specific error codes. / ORA-00000 Through ORA-09989   / ORA-01031 Insufficient privileges / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>FranklinFaces.com - Oracle &amp; SQL Server Database Forums for all IT Professionals</description><link>http://franklinfaces.com/</link><webMaster>no-reply@FranklinFaces.com</webMaster><lastBuildDate>Fri, 10 Feb 2012 23:23:37 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: ORA-01031 Insufficient privileges</title><link>http://franklinfaces.com/Topic138-54-1.aspx</link><description>I found the answer to my ora-01031 insufficient privileges error message that i'm getting while using execute immediate command:&lt;/P&gt;&lt;P&gt;Oracle needs to know explicitly somewhere in the procedure what kind of privileges to use. The way to let Oracle know that is to use AUTHID keyword in the CREATE OR REPLACE statement. If you want the same level of privileges as the creator of the procedure, you use AUTHID DEFINER. If you want Oracle to use the privileges of the user currently running the stored procedure, you want to use AUTHID CURRENT_USER.  Here is the updated procedure and it works great now.&lt;/P&gt;&lt;P&gt;&lt;BR&gt;CREATE or replace PROCEDURE goldid.GID_REBUILD_UNUSABLE_IDXS&lt;BR&gt;&lt;FONT color=#ff1111&gt;AUTHID CURRENT_USER IS &lt;BR&gt;&lt;/FONT&gt;begin&lt;BR&gt;declare&lt;BR&gt;    idx_name varchar2(100);&lt;BR&gt;    idx_cnt integer;&lt;BR&gt;begin&lt;BR&gt;    select count(*) into idx_cnt from user_indexes where status = 'UNUSABLE';&lt;/P&gt;&lt;P&gt;    if idx_cnt &amp;gt; 0 then&lt;BR&gt;         select index_name into idx_name from user_indexes where status = 'UNUSABLE' and rownum &amp;lt;= 1;&lt;BR&gt;    else&lt;BR&gt;        idx_name := null;&lt;BR&gt;    end if;&lt;/P&gt;&lt;P&gt;    while idx_name is not null&lt;BR&gt;    loop&lt;BR&gt;        execute immediate 'alter index ' || idx_name || ' rebuild online parallel';&lt;BR&gt;        select index_name into idx_name from user_indexes where status = 'UNUSABLE' and rownum &amp;lt;= 1;&lt;BR&gt;    end loop;&lt;BR&gt;end;&lt;BR&gt;end;&lt;BR&gt;/&lt;BR&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you guys.</description><pubDate>Fri, 07 Jan 2011 13:57:26 GMT</pubDate><dc:creator>Admin</dc:creator></item><item><title>RE: ORA-01031 Insufficient privileges</title><link>http://franklinfaces.com/Topic138-54-1.aspx</link><description>ORA-01031: insufficient privileges &lt;BR&gt;&lt;BR&gt;* &lt;BR&gt;ERROR at line 1: &lt;BR&gt;ORA-01031: insufficient privileges &lt;BR&gt;&lt;BR&gt;&lt;H1&gt;&lt;FONT size=4&gt;Execute Immediate within a stored procedure keeps giving insufficient priviliges error&lt;/FONT&gt;&lt;/H1&gt;&lt;P&gt;So I have this procedure that i am trying to execute.  When i run it, it keeps giving me insufficient privileges error message:  ORA-01031 during the run.   Here is the procedure:&lt;/P&gt;&lt;P&gt;&lt;BR&gt;CREATE or replace PROCEDURE goldid.GID_REBUILD_UNUSABLE_IDXS&lt;BR&gt;AS&lt;BR&gt;    idx_name varchar2(100);&lt;BR&gt;    idx_cnt integer;&lt;BR&gt;begin&lt;BR&gt;    select count(*) into idx_cnt from user_indexes where status = 'UNUSABLE';&lt;/P&gt;&lt;P&gt;    if idx_cnt &amp;gt; 0 then&lt;BR&gt;         select index_name into idx_name from user_indexes where status = 'UNUSABLE' and rownum &amp;lt;= 1;&lt;BR&gt;    else&lt;BR&gt;        idx_name := null;&lt;BR&gt;    end if;&lt;/P&gt;&lt;P&gt;    while idx_name is not null&lt;BR&gt;    loop&lt;BR&gt;        &lt;FONT color=#ff1111&gt;execute immediate 'alter index ' || idx_name || ' rebuild online parallel';&lt;BR&gt;&lt;/FONT&gt;        select index_name into idx_name from user_indexes where status = 'UNUSABLE' and rownum &amp;lt;= 1;&lt;BR&gt;    end loop;&lt;BR&gt;end;&lt;BR&gt;go&lt;BR&gt;&lt;/P&gt;&lt;P&gt;For some reason, I keep getting insufficient privileges error for the EXECUTE IMMEDIATE command. I found out that the insufficient privileges error usually means the oracle user account does not have privileges for the command used in the query that is passes, which in this case is alter index.&lt;/P&gt;&lt;P&gt;I granted the user alter any index directly to he user without going through the role, yet it still didn't work.</description><pubDate>Fri, 07 Jan 2011 13:53:44 GMT</pubDate><dc:creator>Admin</dc:creator></item><item><title>ORA-01031 Insufficient privileges</title><link>http://franklinfaces.com/Topic138-54-1.aspx</link><description>&lt;FONT color=#3333dd&gt;&lt;STRONG&gt;I had a user that was getting the following ora error message while creating a table in another user's schema:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#113333&gt;&lt;STRONG&gt;ORA-01031 Insufficient privileges&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#3333dd&gt;&lt;STRONG&gt;When i looked it up this is what oracle suggests:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#113333&gt;&lt;EM&gt;01031, 00000, "insufficient privileges"&lt;BR&gt;// *Cause: An attempt was made to change the current username or password&lt;BR&gt;//         without the appropriate privilege. This error also occurs if&lt;BR&gt;//         attempting to install a database without the necessary operating&lt;BR&gt;//         system privileges.&lt;BR&gt;//         When Trusted Oracle is configure in DBMS MAC, this error may occur&lt;BR&gt;//         if the user was granted the necessary privilege at a higher label&lt;BR&gt;//         than the current login.&lt;BR&gt;// *Action: Ask the database administrator to perform the operation or grant&lt;BR&gt;//          the required privileges.&lt;BR&gt;//          For Trusted Oracle users getting this error although granted the&lt;BR&gt;//          the appropriate privilege at a higher label, ask the database&lt;BR&gt;//          administrator to regrant the privilege at the appropriate label.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#3333dd&gt;&lt;STRONG&gt;However, this didn't solve my problem.   I gave the user the following privileges and still didn't work:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#113333&gt;grant select any table to &amp;lt;user&amp;gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#113333&gt;grant drop any table to &amp;lt;user&amp;gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#113333&gt;grant create any table to &amp;lt;user&amp;gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#3333dd&gt;&lt;STRONG&gt;After doing this, still the user was having issues when logging in through his application via odbc connection.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#3333dd&gt;&lt;STRONG&gt;After many tries, and research I granted all to the tables he was using :&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#113333&gt;&lt;EM&gt;grant all on &amp;lt;schema&amp;gt;.&amp;lt;table_name&amp;gt; to &amp;lt;user&amp;gt;;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#3333dd&gt;&lt;STRONG&gt;and then also did the following:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#113333&gt;&lt;EM&gt;grant references on &amp;lt;schema&amp;gt;.&amp;lt;table_name&amp;gt; to &amp;lt;user&amp;gt;;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#3333dd&gt;&lt;STRONG&gt;That did the trick.  I hope this helps you out as well.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#3333dd&gt;If that didn't work my last resort was to grant dba to the user.   Which I didn't want to do because that was just way too much privilege for him.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#3333dd&gt;Thanks,&lt;/FONT&gt;&lt;/STRONG&gt;</description><pubDate>Thu, 09 Jul 2009 14:20:34 GMT</pubDate><dc:creator>Admin</dc:creator></item></channel></rss>
