creating user and password in oracle sql [duplicate] - sql

This question already has an answer here:
Oracle ORA-01031: insufficient privileges while creating user
(1 answer)
Closed 1 year ago.
CREATE USER STUDENT IDENTIFIED BY "pass12";
I am creating user and password by this syntax but getting error:
ORA-01031: insufficient privileges
How can I solve it?

User you're currently connected to doesn't have privileges to create other users.
One of such is my SCOTT user:
SQL> show user
USER is "SCOTT"
SQL> create user student identified by pass12;
create user student identified by pass12
*
ERROR at line 1:
ORA-01031: insufficient privileges
But, if I connect as a privileged user (such as SYS), then:
SQL> connect sys as sysdba
Enter password:
Connected.
SQL> create user student identified by pass12;
User created.
SQL>

Related

there is no scott schema in my oracle 11g [duplicate]

This question already has answers here:
Why my Oracle 10g does not have the scott account?
(2 answers)
Closed last month.
recently download oracle 11g, tried login using scott, turns out scott doesnt exist . I logged in using sys as sysdba and ran 'show pdbs' but it showed 'unknown show option pdbs'.
I looked up online and found that i need to run the scott.sql. But then i couldnt find the scott.sql file in the expected location. pls help
11g is rather old, there's no PDB there.
As you're logged as SYS, run the following command and say what status you got (in my database, it is OPEN):
SQL> select account_status from dba_users where username = 'SCOTT';
ACCOUNT_STATUS
--------------------------------
OPEN
SQL>
If it is LOCKED (which might be), then run
SQL> alter user scott account unlock;
User altered.
SQL> alter user scott identified by tiger;
User altered.
SQL>
and - finally - connect:
SQL> connect scott/tiger
Connected.
SQL>
If you really don't have that schema, create it. See this for more info.

Getting insufficient privilege error while creating users in oracle. How to solve it [duplicate]

This question already has answers here:
What privileges are required to create a user in Oracle with a non DBA user?
(2 answers)
Closed 1 year ago.
I'm trying to create a user for my database
Data:
CREATE USER Clerk IDENTIFIED BY MyPassword;
Error:
ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to perform a database operation without
the necessary privileges.
*Action: Ask your database administrator or designated security
administrator to grant you the necessary privileges
but it appears that I keep getting this error
If you don't have CREATE USER privileges, then you will have to contact your DBA to have the user created. You cannot get around this on your own.

Question about Grant (DCL) in Oracle SQL Developer

I have problem with understanding what exatly i do wrong. Impossibile to give access to another user via role. Example:
System user:
create table testtable (id number);--Table TESTTABLE created
create role testrole;--Role TESTROLE created
grant insert on testtable to testrole;--Grant succeeded
grant testrole to hr;--Grant succeeded
Hr user:
insert into system.testtable values(1)
SQL Error: ORA-00942: table or view does not exist
00942. 00000 - "table or view does not exist"
TL;DR: It works, just reconnect the user hr.
The documentations says
"If you grant a role to a user, then the database makes the role available to the user. The user can immediately enable the role and exercise the privileges in the privilege domain of the role."
So your user hr needs to enable the role before being able to use it:
insert into a.testtable values(1);
ORA-00942: table or view does not exist
SELECT * FROM session_roles;
no rows selected
SET ROLE testrole;
Role set.
SELECT * FROM session_roles;
TESTROLE
insert into a.testtable values(1);
1 row created.
Roles are normally automatically enabled during log on, so you have to do the enabling only if hr has a session open while it gets the role granted. Standard procedure is to disconnect/reconnect the user if there are problems with new roles.

Creating a user in Oracle 11g - No permissions issue

I am trying to set up a user in my Oracle 11g database as such
create user BARRY6 IDENTIFIED by password123;
grant connect to BARRY6;
grant create session to BARRY6;
grant UNLIMITED TABLESPACE to BARRY6;
commit;
This should create the user and provides them with the basic permissions.
All commands executes successfully, However i can not connect with this user.
I get an error
An error was encountered performing the requested operation:
ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to perform a database operation without
the necessary privileges.
*Action: Ask your database administrator or designated security
administrator to grant you the necessary privileges
Vendor code 1031
When i view the USER_ROLE_PRIVS table , there is no permissions in that table for my user
This was happening because the role i was trying to login in as was sysdba. While it should be default.
I know, stupid, but it posting the solution in case other people are creating a user and they make this simple mistake. It was caused by loading the sys connection and just changing the password and not changing the role

I am not able to connect with a local user in a pluggable database(12C)

I am not able to connect with a local user in a pluggable database(12C)
Here is relevant code:
enter image description here
SQL> conn sys/sys as sysdba
Connected.
SQL> alter session set container=pdborcl;
Session altered.
SQL> create user user1 identified by user1;
User created.
SQL> grant create session,create table to user1;
Grant succeeded.
SQL> alter user user1 quota unlimited on users;
User altered.
SQL> conn user1/user1
ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.
This is a bit workaround but it worked for me on Oracle 18c Express Edition.First find container name by
show con_name
Then connect to user1 as
conn user1/user1#localhost:1521/xepdb1
enter image description here