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:
- Create Session
- Alter Session
- Create Table
- Alter Table
- Delete Table
- Create Views
- Create Sequence
- Create Synonyms
and many more. So, to GRANT the privileges to the Users follow the syntax below:
GRANT Privilage_type to user;
We want to create a user named NEW_USER so to create a new user we got output as:
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;
In the below pasted diagram, you will see that now the User named NEW_USER will be generated.
NOTE: The status is displaying Success.