CREATE OR REPLACE -- insufficient privilegies
Hello,
I get ORA-01031: insufficient privileges when trying to CREATE OR REPLACE a package body.
I can drop it and create it again, but not just replace it. It is very annoying when using a GUI for developing PL/SQL code.
This works fine on 8i and 9i. I have not tested it with 10g.
Thanks for your help.
C:\>sqlplus system/manager@xe @priv
SQL*Plus: Release 10.2.0.1.0 - Beta on Fri Jan 6 10:38:03 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Beta
SQL>
SQL> DROP USER myuser CASCADE
2 /
User dropped.
SQL> CREATE USER MYUSER IDENTIFIED BY MYUSER
2 /
User created.
SQL> GRANT CREATE SESSION TO MYUSER
2 /
Grant succeeded.
SQL> GRANT CREATE ANY PROCEDURE TO MYUSER
2 /
Grant succeeded.
SQL> GRANT DROP ANY PROCEDURE TO MYUSER
2 /
Grant succeeded.
SQL> GRANT UNLIMITED TABLESPACE TO MYUSER
2 /
Grant succeeded.
SQL>
SQL> DISCONNECT
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Beta
SQL>
SQL> CONNECT MYUSER/MYUSER@XE
Connected.
SQL>
SQL> CREATE PACKAGE mypackage AS
2 PROCEDURE myproc;
3 END;
4 /
Package created.
SQL>
SQL> CREATE PACKAGE BODY mypackage AS
2 PROCEDURE myproc
3 IS
4 BEGIN
5 NULL;
6 END;
7 END;
8 /
Package body created.
SQL>
SQL> CREATE OR REPLACE PACKAGE BODY mypackage AS
2 PROCEDURE myproc
3 IS
4 BEGIN
5 NULL;
6 END;
7 END;
8 /
CREATE OR REPLACE PACKAGE BODY mypackage AS
ERROR at line 1:
ORA-01031: insufficient privileges
SQL>
SQL> DROP PACKAGE BODY mypackage
2 /
Package body dropped.
SQL>
SQL> CREATE OR REPLACE PACKAGE BODY mypackage AS
2 PROCEDURE myproc
3 IS
4 BEGIN
5 NULL;
6 END;
7 END;
8 /
Package body created.
Both ways work. Thanks DLsW and Tom.
I can grant my user either both "CREATE ANY PROCEDURE" and "ALTER ANY PROCEDURE", or just "CREATE PROCEDURE".
In my environment, there is a single database user and I wasn't very much concerned about messing up other schemas, but I appreciate Tom's advice and will make use of it. Thanks again.
--Stan
Similar Messages
-
ORA-01031: insufficient privileges While Trying to Create a Trigger
Hi
I am trying to create a trigger on one of the table in the database schema :
CREATE OR REPLACE TRIGGER Trigger_Name
BEFORE INSERT ON table_name
FOR EACH ROW
---Trigger Body...
However I am getting the following error : ORA-01031: insufficient privileges
I have tried to check the status of the trigger with the following script :
SELECT object_name
FROM dba_objects
WHERE object_type = 'TRIGGER'
AND status = 'INVALID';
and it is showing its status as "INVALID".
Can anybody please suggest me how to proceed on this?Hi,
If the trigger exists than you have privilieges to create trigger but you need some privilieges needed to compile it.
Check all commands and objects you are referring to inside trigger body. Maybe you are trying select table without proper priviliege...?
Bartek -
Error while Creating Master Repository: ORA-01031: insufficient Privileges
Hi,
I'm trying to install ODI into my VM.
I have done the installation and while creating Master Repository, I'm getting following error:
ORA-01031: insufficient Privileges
I'm using Oracle & have created user as ODI_MASTER with Admin Privileges.
I'll be using it to load metadata onto planning (Version 11.1.2)
Is there anything that I'm missing out on.
Jitendra.Seems missing grants on the user you are using to create Master Repository.
you are using Oracle .. grant connect, resource to <your_user>. These two rolesa have sufficient access to db to create the master repository.
execuute the sql from sys user
Regards,
Amit
Edited by: amitgupta1202 on 20 Aug, 2009 10:42 PM -
ORA-01031 SYSMAN Insufficient Privileges Creating a new user
I have installed Oracle 11g R2 onto Windows 7 64bit
I then created a new database, at the end it moaned about the service and listener was not running or allocated to each other and also there was no web admin tool available.
To resolve this I managed to use Net Configuration Assistant to get the listener sorted.
I then had to run:
set ORACLE_HOSTNAME=localhost
set ORACLE_SID=mydb
set ORACLE_UNQNAME=mydb
I then ran
emca -config dbcontrol db -repos recreate
This gave me the web admin tool to create a new user.
I logged in as SYSMAN tried to create a new user and got the "ORA-01031 Insufficient Privileges, you do not have enough privileges to perform this operation." error
Can someone please help.
ThanksIt isn't that simple. As SYSMAN used for 11.2.0.3 database control:
orcl> select privilege from user_sys_privs;
PRIVILEGE
CREATE PUBLIC SYNONYM
SELECT ANY DICTIONARY
UNLIMITED TABLESPACE
ALTER SESSION
orcl>but as SYSMAN used for 12.1 Cloud Control:SQL> select privilege from user_sys_privs;
PRIVILEGE
ALTER USER
DROP USER
CREATE SESSION
CREATE PUBLIC SYNONYM
CREATE JOB
CREATE MATERIALIZED VIEW
SELECT ANY DICTIONARY
CREATE TABLE
ALTER SESSION
CREATE USER
CREATE SYNONYM
DROP PUBLIC SYNONYM
MANAGE SCHEDULER
CREATE VIEW
CREATE DATABASE LINK
15 rows selected.
SQL>so you have to be a bit careful when you give a yes/no answer.
Edited by: JohnWatson on Nov 12, 2012 11:38 AM
Forgot to include a quote: this is replying to the question about whether SYSMAN can create users. -
ORA-01031: insufficient privileges when creating a table in other schema
Dear all,
I appreciate your help please in this issue :
when i try to issue the below statement to create a table in an another schema than the user i am connected in
CREATE TABLE SCHEMA_NAME_B.HST_ARCH nologging AS
SELECT *
FROM HST
WHERE 1 = 0;
I always get ORA-01031: insufficient privileges error, even if i have granted the create table privilege to the user i am connected in.
What other privileges should i grant also,
Please if you have any idea.user562674 wrote:
Dear all,
I appreciate your help please in this issue :
when i try to issue the below statement to create a table in an another schema than the user i am connected in
CREATE TABLE SCHEMA_NAME_B.HST_ARCH nologging AS
SELECT *
FROM HST
WHERE 1 = 0;
I always get ORA-01031: insufficient privileges error, even if i have granted the create table privilege to the user i am connected in.
What other privileges should i grant also,
Can you show us a cut/paste from the sql*plus of session of yours which should show that you have given the privilege directly to this user and after that the command fails?
Aman.... -
Insufficient privileges when creating user logged in as SYS
Hi,
I'm working on 11.1.0.6.0 Enterprise Edition, Advanced Security options, Label Security a and Database Vault installed. (for testing purposes)
I'm creating a new user being logged as SYS using this sentence:
CREATE USER "HR_DIRECTOR" PROFILE "DEFAULT" IDENTIFIED BY "*******" DEFAULT TABLESPACE "USERS" TEMPORARY TABLESPACE "TEMP" ACCOUNT UNLOCK;
However, the command fails with the message "Failed to commit: ORA-01031: insufficient privileges . You do not have enough privileges to perform this operation. You must have the appropriate system and object privileges to create, edit, or drop database objects or objects outside of your schema."
Please note that I'm working on a fresh DB install and I have also installed Database Vault in this instance for testing purposes, but still haven't configured any realm or command rules on it.
Is it possible Vault is the reason why I am not able to create a new user?
Thanks and Regards,
LeandroHi, It seems I've found it.
After you install Database Vault and associate it with your SID, SYS user is revoked the CREATE USER system privilege.
Only a user with the DV_ACCTMGR role may create, alter or drop a user. This is done in order to separate responsabilities in your database. A SYS user cannot grant himself this role or the DV_OWNER role.
(If interested, check page 10-4 from http://www.oracle.com/pls/db111/to_toc?pathname=server.111/b31222/toc.htm)
Regards,
Leandro -
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. -
Create materialized view throws insufficient privileges in single schema
I'm trying to create a complex materialized view in my own schema, using only tables from my own schema:
CREATE MATERIALIZED VIEW MYSCHEMA.MYMVIEW AS
SELECT
A.ONE_THING,
B.ANOTHER_THING,
C.A_THIRD_THING
FROM MYSCHEMA.TABLEA A
JOIN MYSCHEMA.TABLEB B
ON A.COL1 = B.COL1
JOIN MYSCHEMA.TABLEC C
ON A.COL2 = C.COL2The line JOIN MYSCHEMA.TABLEB B throws an ORA-01031: insufficient privileges error, highlighting TABLEB.
I understand that grants need to be explicit on tables when creating objects across schemas, but this code is operating within my own schema only; i created and own all the tables in this schema.
What's going on?
Thanks!Perhaps it is the tool that i am using that highlights the wrong item, because as it turns out, i don't have the CREATE MATERIALIZED VIEW permission after all (the permission was mistakenly granted to a different user instead of to me).
SELECT * FROM SESSION_PRIVS;returns CREATE VIEW, but does not return CREATE MATERIALIZED VIEW.
Sorry to have wasted your time. -
Insufficient privileges after creating new files
I have a PowerBook G4 that I sometimes start-up off an external Firewire drive. The Internal HD is locked-down admin-wise as it's a company laptop but sometimes I need to run my own apps that aren't on the internal HD (i.e. Photo Rescue, Aperture, etc).
When I work on/create a jpeg image while running Photoshop (start-up and PS running off the external FWHD) I save the image onto the PowerBook internal HD inside the Shared Folder.
Later when I boot-up the laptop via the Internal HD I can open these jpeg files but cannot modify them due to Insufficient privileges. I have to make sure I run iRepair to set to privileges on that particular directory before I shutdown off the FW drive.
Is there some way I can default the Leopard Start-Up on the external FW drive so that when I save a file to the internal HD the privileges are wide open? It's a pain to remember to fix the directories with iRepair before I shutdown. I have run Repair Permissions via the FW drive but that hasn't helped anything.Create a disk image in the Shared folder using rhe Disk Utility, select the mounted image in the Finder, choose to ignore permissions from the Get Info window under the File menu, and change the permissions on the image file so that all accounts can write to it. Save the JPEGs to the mounted image.
(31781) -
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. -
Insufficient Privileges when create materialized view as user system
If I login as system (connect sys/****@DevDB) and try to create a materialized view for another schema (e.g. XDCONTROLDB), I get the insufficient privileges error. If I login as sys as sysdba then I can create successfully.
I have searched some ariticles in Google and grant create any snapshot, create any table, create any view, global query rewrite, select any table system privileges to system but still get the same error.
Any other privileges I need to grant to system?
Cheers
below is a sample script to create the view which get the error:
CREATE MATERIALIZED VIEW XDControlDB."XDTest1" PCTFREE 10
PCTUSED 0 MAXTRANS 255
STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS
2147483645 PCTINCREASE 0)
TABLESPACE "USERS"
BUILD IMMEDIATE
REFRESH COMPLETE START WITH sysdate NEXT sysdate + 1/24
ENABLE QUERY REWRITE AS
SELECT * From XDControlDB.RiskInstance;
Message was edited by:
user500168
Message was edited by:
user500168Thanks for your reply. After I grant privileges to system, I login as system and try to create the view as below which I get the insufficient privileges error:
CREATE MATERIALIZED VIEW XDControlDB."XDTest1" PCTFREE 10
PCTUSED 0 MAXTRANS 255
STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS
2147483645 PCTINCREASE 0)
TABLESPACE "USERS"
BUILD IMMEDIATE
REFRESH COMPLETE START WITH sysdate NEXT sysdate + 1/24
ENABLE QUERY REWRITE AS
SELECT 1 From XDControlDB.RiskInstance;
As you can see, I try to create the view under a schema called 'XDCONTROLDB'. If I login as sys as sysdba, then it create successfully.
After I create UserA, and grant the privileges I mentioned in the ealier post, I login as UserA, and run the statement above I get the same privileges error. But if I change the stament to below which will create the view under UserA's schema, then it create successfully:
CREATE MATERIALIZED VIEW UserA."XDTest1" PCTFREE 10
PCTUSED 0 MAXTRANS 255
STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS
2147483645 PCTINCREASE 0)
TABLESPACE "USERS"
BUILD IMMEDIATE
REFRESH COMPLETE START WITH sysdate NEXT sysdate + 1/24
ENABLE QUERY REWRITE AS
SELECT 1 From XDControlDB.RiskInstance;
Looking for your suggestions,
Cheers -
4.0 EA2 - Insufficient Privileges When Creating Object With Proxy
When I have connected by proxying to another user, I receive the following message when trying to create a new object:
The database user has insufficient privileges for the given operation.
Steps to reproduce:
Connect by proxying to another user
Right Click on Views
Select New View
I noticed this under EA1, though, not sure if reported. This worked under 3.2.2Sounds like your management needs a stern lecture on the concept of change management. <g>
I am not debating what you do. I am questioning the logic, or lack thereof, of doing it that way. My recommendation would be to change your procedure to one that:
A. Is more in line with good change management practices.
B. Works. -
Insufficient privileges for creating a table in a procedure
Hello,
I have a problem with creating a table from within a procedure. The error is
-1031 : ORA-01031: insufficient privileges
All objects are owned by the same user, and the procedure is run under that user. This user has CREATE ANY TABLE with Admin Option rights.
I am working with Oracle 8i.
Can anybody tell me how I can fix this?
Thanks, WouterDoes the user have the CREATE ANY TABLE privilege granted directly to it, or through a role? Stored procedures by default don't know about any privileges granted through a role.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Insufficient privileges when creating MV with alter session set current_sch
I am getting Insufficient privileges when creating MV with alter session set current_schema=Application schema name. User running the alter session is DBA user. If run as SYSDBA, MV is created successfully. DB Version is 10.2.0.3
I observed similiar issue with regular View also in 9.2.0.6 also.
Any advice is greatly appreciated.
Thanks,
SivaSounds like your management needs a stern lecture on the concept of change management. <g>
I am not debating what you do. I am questioning the logic, or lack thereof, of doing it that way. My recommendation would be to change your procedure to one that:
A. Is more in line with good change management practices.
B. Works. -
Insufficient privileges to create database
Hi all,
I am new to oracle and just solved my database login problem by using scott/tiger as username/password. I am just wondering does this login has rights to create database? Since the system/manager combo doesn't work when I login, I have no choice but to use scott/tiger. However, I got this when I try to follow the exercise from the book I am reading on.
SELECT tablespace_name
FROM dba_tablespaces
ORDER BY tablespace_name;
ERROR at line 2:
ORA-00942: table or view does not exist
I was just trying to find out what my Default and Temporary tablespace to create an account. I kept on following the book anyways and I tried this:
SQL> create user student identified by
2 default tablespace users
3 temporary tablespace temp;
create user student identified by learn
ERROR at line 1:
ORA-01031: insufficient privileges
Any idea?The user scott does not have the privilege you are trying to use. Have you tried to login as SYS password change_on_install (it is the default and should be changed)?
If you are successful, you can then find the information you were looking for and you can create the user STUDENT
Maybe you are looking for
-
Using only part of a song in iMovie?
I've been using iMovie for a while and it's great but one thing I haven't been able to figure out yet is an easy way to use just a portion of a song. I want to use about six or seven different songs in my iMovie project, but only use certain parts of
-
Can't Play Video Files in Lightroom 4
I can import video files (.mov) into Lightroom 4 but I can't play them. I can play them in Photoshop CS6 Beta. The Control Bar with the "Play" icon doesn't show and the space bar does nothing.
-
Resizing the stage around its center
I have done some animation work on a stage 320px X 320px. I find that I must present the same work on a stage 240px X 320 px. If I use the Property Inspector window, I can enter the new stage size. Unfortunately, the window is resized with the left h
-
IPod Classic Gen 3 Click Wheel 20-GB accidental disk format
I believe I accidentally formatted the disk on my iPod while attempting to format another drive connected to the computer (Win 7). Now I only get the Apple logo and nothing happens when I try and do a reset (menu/select). When I press the menu/play b
-
I have 5.3gb of other data on my iphone, what can i do to get rid of it??
what can i do?