Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regarding Users in Oracle 12c

I have installed an Oracle 12c database on my system. I had an application which need to access the database.

Previously in Oracle 11g, I used the following commands to create an user.

create user name identified by name;  
grant connect,create session,resource,create view to name;

Can anyone tell me how to create a user in Oracle 12c with my above requirements? I used the following statements but my installation is showing a fatal error saying

FATAL ERROR - java.sql.SQLException: ORA-01950: no privileges on tablespace 'USERS'

Following were the statements used.

create user c##test1 identified by test1 container = ALL;
grant connect,create session,resource,create view to test1;
like image 991
user218045 Avatar asked Nov 21 '13 07:11

user218045


2 Answers

Best Practice is to create a tablespace and assign that to the User.

Just to make it easier to understand use same name for username and tablespace

CREATE BIGFILE TABLESPACE C##1
DATAFILE '/path/to/datafile/C##1.dbf'
SIZE 10M AUTOEXTEND ON NEXT 5M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO NOLOGGING;


--Create User

CREATE USER C##1
IDENTIFIED BY password DEFAULT TABLESPACE C##1
QUOTA UNLIMITED ON C##1;

like image 182
Gunjan Shakya Avatar answered Oct 31 '22 07:10

Gunjan Shakya


You should also give the user a quota on his default tablespace:

CREATE USER name
IDENTIFIED BY name
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp
QUOTA 50M /* or any other number that makes sense */ ON users

GRANT CONNECT, CREATE SESSION, RESOURCE, CREATE VIEW TO name;
like image 32
Mureinik Avatar answered Oct 31 '22 08:10

Mureinik