Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. 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.

Saturday, 23 March 2019

How to create new database connection in SQL Developer

Oracle SQL Developer is a free, integrated development environment(IDE) that simplifies the development and management of Oracle Database in both traditional and Cloud deployments. SQL Developer offers complete end-to-end development of your PL/SQL applications, a worksheet for running queries and scripts, a DBA console for managing the database, a reports interface, a complete data modeling solution, and a migration platform for moving your 3rd party databases to Oracle.
In this article, we will walk through on creating a new database connection in SQL Developer.
Step 1: Open SQL Developer and Click on + sign on left pane of working window.


Step 2: Once you click on + sign, following popup will come up.


Enter values for following parameters:
Connection Name  :  Meaningful database connection name. I prefer username_databaseName
Username : database user you are going to connect to database
Password : password for above username
Connection Type: choose connection type based on your configuration.
  If connection  type is TNS, Select Network Alias from dropdown list.


If connection type is basic, Enter SID.


Once all the necessary inputs are done, click Test button. If everything is OK, connection should be successful.
Once connection is successful, Click Connect button. Your newly created connection should be available in left pane of working window.