Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Thursday, 28 March 2019

How to Create a User and Grant Permissions in Oracle


Oracle comes with in-built database user like system and sys. But situation may arise where you want to create a separate user. You may want to create application specific users which may not need all privileges system and sys users have.
Step 1: Connect to oracle using system user with sysdba privilege.
SQLPLUS SYSTEM/password@sid AS SYSDBA;



Step 2 : Once your are connected to oracle, issue following command to create user
CREATE USER username IDENTIFIED BY password;


Replace username and password with your desired username and password.

Step 3: Once you have created user successfully, it may require certain permissions to do its job. You use GRANT statement to assign privileges.
Grant connect to test;
Grant resource to test;
Grant dba to test;
Grant create session to test;
Grant unlimited tablespace to tset;
Grant create view to test;
Grant create table to test;
Grant select on tableName to test;
Grant update on tableName to test;
Grant insert on tableName to test;
Grant delete on tableName to test;

Please comment if you find anything incorrect, or you want to improve the topic discussed above.