Skip to main content

How to create users in oracle Database ?

I have seen one Post on facebook in Oracle DB group that someone is asking, How to create user in oracle database. I know it's very silly question but it happens if you are new to Oracle. So I am only writing this post for those people how do not want to study the books. 

So here are the steps to create user in Oracle database. Theses steps will be same in 10g,11g and 12c. I will discuss two scenarios here :-

  1. create simple user 
  2. create user with attributes 

  1. Create simple user

Step1 :- You can connect to database with sysdba privileges. 

      e.g.  sql > conn / as sysdba 


Step2:- After connecting to sysdba, you need to use “CREATE USER” command to create new user. “ALTER USER”  is used to modify the properties of the users like password, profile etc. Please note that users name should be unique. You cannot create user wit the same name.

     e.g.  sql >  create user test identified by test;

Step 3:- With above command your database user created, But now you cannot connect to the database with this user, WHY? because you haven’t granted this user to connect to database and create the session. 
You need to grant your user as below:- 

e.g.  sql > grant create session to  test; 
       sql > grant connect to test; 

Now you can connect to the database by this user test. 
e.g. conn test/test@TNSNAME



  1. create user with attributes

creating user with attributes means you assign properties at the time of creation e.g. suppose we need to create a user and we need to specify its tablespace with quota and also want to assign a profile to this user. 

below is the example:-
sql> create user test identified by test default tablespace test temporary tablespace temp quota unlimited on test profile test;

This will create a user test with password test tablespace test and profile test. 

Keep Sharing :) 

Comments

Popular posts from this blog

DBA_SCHEDULER_JOB_RUN_DETAILS and PURGE_LOG

How to purge DBA_SCHEDULER_JOB_RUN_DETAILS? Manually deleting from DBA_SCHEDULER_JOB_RUN_DETAILS is not recommended by oracle.DBA_SCHEDULER_JOB_RUN_DETAILS is a view that is using two master tables (scheduler$_job_run_details and scheduler$_event_log) and display the information about jobs history. As there is one procedure named PURGE_LOG and Oracle have Scheduler for this procedure. It will purges all rows in the job log that are older than 30 days.This is the default behavior of this procedure. You can change this to any number of days you want by setting the attribute "SET_SCHEDULER_ATTRIBUTE". e.g. exec DBMS_SCHEDULER.SET_SCHEDULER_ATTRIBUTE('log_history','15'); It will purge all logs older than 15days and it will maintain the history of 15days. But If you want manually purge these logs, you can use below solution:- exec DBMS_SCHEDULER.PURGE_LOG(log_history => 15, which_log => 'JOB_LOG'); It will purge all entries from the jog log that are o...

ORA-02051 Another Session Or Branch In Same Transaction Failed

ORA-02051 Another Session Or Branch In Same Transaction Failed (Doc ID 2253226.1)          SYMPTOMS for ORA-02051 Another Session Or Branch In Same Transaction Failed. Database performance is slow and caused   the transactions ORA-02051 another session or branch in same transaction failed or finalized CAUSE for ORA-02051 Another Session Or Branch In Same Transaction Failed. Session transactions branches caused the issue Excessive Waits On The Event "Global transaction acquire instance locks" SOLUTION Please use below sql and identified underscore parameter values for ORA-02051 Another Session Or Branch In Same Transaction Failed : SQL> select a.ksppinm "Parameter", b.ksppstvl "Session Value",c.ksppstvl "Instance Value"  FROM x$ksppi a,x$ksppcv b, x$ksppsv c  WHERE a.indx = b.indx AND a.indx = c.indx AND a.ksppinm LIKE '/_%' escape '/'  AND (a.ksppinm like '%clusterwide_global%' or a.ksppinm like '%disable_autotune_...

ORA-65016: FILE_NAME_CONVERT must be specified

ORA-65016: FILE_NAME_CONVERT must be specified I just started working on 12C version of oracle database.It's new to me and facing many problems. Error code: ORA-65016: FILE_NAME_CONVERT must be specified Description:"ORA-65016: FILE_NAME_CONVERT must be specified" normally occurs when you create a PDB.I will explain later what is a PDB. Cause and solution :  ORA-65016: FILE_NAME_CONVERT must be specified caused when Data files, and possibly other files, needed to be copied as a part of creating a pluggable database.Enable OMF or define PDB_FILE_NAME_CONVERT system parameter before issuing CREATE PLUGGABLE DATABASE statement, or specify FILE_NAME_CONVERT clause as a part of the statement and make sure the path you are giving to convert the file exists. I think if you are creating the PDB's using GUI then you will not face this error "ORA-65016: FILE_NAME_CONVERT must be specified". If you creating ODB using script and you have gave a wrong path then may you f...