Oracle: GRANT Statement

What is Grant Statement in Oracle?

In Oracle, GRANT Statement is used to Provide privileges to the existing users. There is various kind of privileges that is granted by DBA( database administrator) to the users. Like what happens is, there is a lot of data present in the database. It contains some confidential information too, that we want to hide for certain users. Obviously, only that amount of information is granted to a user, that is of use for them. 

Some of the Privilates we can GRANT is shown below:

  1. Create Session
  2. Alter Session
  3. Create Table
  4. Alter Table
  5. Delete Table
  6. Create Views
  7. Create Sequence
  8. Create Synonyms

and many more. So, to GRANT the privileges to the Users follow the syntax below:

Syntax

GRANT Privilage_type to user;

Example

We want to create a user named NEW_USER so to create a new user we got output as:

GRANT command

The above output states that the CREATE SESSION Privilage has been denied by NEW_USER. That means first we need to provide CREATE SESSION privilate to the user then, we can create it. Follow the code for the same:

Grant create session to NEW_USER;

Output

GRANT command

In the below pasted diagram, you will see that now the User named NEW_USER will be generated. 

GRANT command

NOTE: The status is displaying Success.