I have installed Oracle 11g on my PC. When I try to create a user in SQL*Plus I get an error:
SQL>create user scott identified by scott;
*
ERROR at Line 1:
ORA-01031:insufficient privilages
What am I doing wrong?
Related
I am new to using Oracle database. I worked on it for some weeks. It worked well. But now, I'm having some problem. I am getting this error while trying to connect. I didn't change the password. I am using the default user name and password only.
SQL> connect as sysdba
Enter user-name: SCOTT
Enter password:
ERROR:
ORA-01031: insufficient privileges
Can someone tell the solution for this?
That's because SCOTT isn't granted a SYSDBA role. Have a look at his demonstration.
This is what you have now:
SQL> connect as sysdba
Enter user-name: scott
Enter password:
ERROR:
ORA-01031: insufficient privileges
Warning: You are no longer connected to ORACLE.
SQL>
Connect as a privileged user (SYS) and grant SYSDBA to SCOTT:
SQL> connect as sysdba
Enter user-name: sys
Enter password:
Connected.
SQL>
SQL> grant sysdba to scott;
Grant succeeded.
SQL>
OK; now, back to the initial attempt:
SQL> connect as sysdba
Enter user-name: scott
Enter password:
Connected.
SQL>
Not everyone has SYSDBA privileges, and not everyone should have them. Handle with care, it is a powerful privilege so I'll revoke it from SCOTT:
SQL> connect as sysdba
Enter user-name: sys
Enter password:
Connected.
SQL> revoke sysdba from scott;
Revoke succeeded.
SQL>
Please share more information like OS etc
But have you checked user you are using to connect is part of ORA_DBA group assuming you are on windows
I use Oracle 12c R2 on Windows 10 pro x64. I get sample script by
cd E:\github.com\oracle
git clone https://github.com/oracle/db-sample-schemas.git
in CMD
E:\github.com\oracle\db-sample-schemas\human_resources>sqlplus sys/summer as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 28 11:15:24 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> #hr_main.sql
specify password for HR as parameter 1:
Enter value for 1: 123456
specify default tablespeace for HR as parameter 2:
Enter value for 2: hr_tablespace
specify temporary tablespace for HR as parameter 3:
Enter value for 3: hr_temp_tablespace
specify password for SYS as parameter 4:
Enter value for 4: summer
specify log path as parameter 5:
Enter value for 5: C:\vy\
specify connect string as parameter 6:
Enter value for 6: localhost:1521/orcl
SP2-0606: Cannot create SPOOL file "C:\vy\hr_main.log"
DROP USER hr CASCADE
*
ERROR at line 1:
ORA-01918: user 'HR' does not exist
CREATE USER hr IDENTIFIED BY 123456
*
ERROR at line 1:
ORA-65096: invalid common user or role name
ALTER USER hr DEFAULT TABLESPACE hr_tablespace
*
ERROR at line 1:
ORA-01918: user 'HR' does not exist
ALTER USER hr TEMPORARY TABLESPACE hr_temp_tablespace
*
ERROR at line 1:
ORA-01918: user 'HR' does not exist
GRANT CREATE SESSION, CREATE VIEW, ALTER SESSION, CREATE SEQUENCE TO hr
*
ERROR at line 1:
ORA-01917: user or role 'HR' does not exist
GRANT CREATE SYNONYM, CREATE DATABASE LINK, RESOURCE , UNLIMITED TABLESPACE TO hr
*
ERROR at line 1:
ORA-01917: user or role 'HR' does not exist
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
Warning: You are no longer connected to ORACLE.
SP2-0640: Not connected
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
SP2-0640: Not connected
SP2-0640: Not connected
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\hr_cre.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\hr_popul.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\\hr_idx.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\\hr_code.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\\hr_comnt.sql"
SP2-0310: unable to open file "E:\github.com\oracle\db-sample-schemas\human_resources\human_resources\\hr_analz.sql"
not spooling currently
SQL>
How to fix these error:
SP2-0606: Cannot create SPOOL file
ORA-01918: user 'HR' does not exist
ORA-65096: invalid common user or role name
The easy ones first:
ORA-01918: user 'HR' does not exist
The script starts with a precautionary drop user statement. You haven't run the script before so there is no HR user to drop. Hence the message. You can ignore it.
ORA-65096: invalid common user or role name
You have given an invalid password: Enter value for 1: 123456. For whatever reasons Oracle passwords follow similar rules to object names, which means the password must start with a letter - unless it's wrapped in double-quotes.
Now this is a trickier issue:
SP2-0606: Cannot create SPOOL file
So, does directory C:\vy exist? Does your user have write access to it?
I had same issue.
You need create HR user before runnig "hr_main.sql". Follow next steps::
SQL> connect sys as sysdba
Enter password:
Connected.
SQL> create user HR identified by oracle;
User created.
SQL> #?/demo/schema/human_resources/hr_main.sql
and next step as in guide:
https://docs.oracle.com/database/121/COMSC/installation.htm#COMSC109
I'm running an installer script. which is granting on sys.aux_stats$, sys.wri$optstat_aux_history, sys.dbms_spm and sys.dbms_xplan. At this point there is an exception throwed: ORA-01031: insufficient privileges For the installer I created a DBA-User (FOODBA) and a DB-User (FOOADM). The DBA is created like this on the oracle machine:
bash-4.1$ sqlplus
...
Enter user-name: sys as sysdba
Enter password:
SQL> CREATE USER FOODBA IDENTIFIED BY Password;
User created.
SQL> GRANT DBA TO FOODBA ;
Grant succeeded.
SQL> GRANT ADMINISTER SQL MANAGEMENT OBJECT TO FOODBA ;
Grant succeeded.
doesn't work at all, do I tried like this:
SQL> GRANT ALL PRIVILEGES TO FOODBA;
Grant succeeded.
Still not working, so I tried to give permission on custom object:
SQL> grant all privileges on sys.aux_stats$ to FOODBA;
Grant succeeded.
And when I run the script with user FOODBA:
grant select, insert, update, delete on sys.aux_stats$ to FOOADM
It's throwing again the insufficient privileges excpetion.
What I'm supposed to do, so that the FOODBA user can create and grant the FOOADM correctly? The install script is 3rd party.
Having an object grant is not sufficient to pass this grant on to another user/role. You will need "with grant option".
grant select, insert, update, delete on sys.aux_stats$ to FOODBA with grant option;
I've recently installed Oracle 11g on an Ubuntu 12.04 machine.
I can't create a user; the following is the error I got
SQL> create user rachid identified by rachid;
create user rachid identified by rachid
*
ERROR at line 1:
ORA-01109: database not open
The instance is started :
SQL> select status from v$instance;
STATUS
------------------------------------
STARTED
Do you have any solution to overcome this issue ?
You can try to open it using
ALTER DATABASE OPEN
or you can try to shut it and start again and then try to create the user:
$ sqlplus sys/Change12345#orc01 as sysdba
SQL> shut immediate
SQL> startup
I want to grant execute permission to user B so that it can execute a packaged procedure belonging to user A.
procedure name = PKGNAME.PROCEDURENAME
user = USERA
I am trying below command:
GRANT EXECUTE ON USERA.PKGNAME.PROCEDURENAME TO USERB;
But it gives me error:
ERROR at line 1:
ORA-00905: missing keyword
is there a syntax problem ? I used this link :
Granting Rights on Stored Procedure to another user of Oracle
you can't grant permissions on a procedure which is within a package, either grant permissions to the entire package or move the procedure outside of the package so it's a stand alone one and then grant permission
so either
GRANT EXECUTE ON USERA.PKGNAME TO USERB;
or
GRANT EXECUTE ON USERA.PROCEDURENAME TO USERB;