How to grant user access to a database?
In a database it is very necessary to control the roles of a user; User in a database can have multiple roles. Roles can be either just for accessing the database like reading or writing or it can be read only role as well. The role a user is granted depends on the functionality it performs. Now before creating a database it is necessary to define roles of a user, it helps the dba to understand the users who can access and who cannot access the database.
We use the command >>grant, To grant access to users. We can even identify the users with their name and password. SO, whenever a user wants to link to the database, the user has to connect using username and password.
>>Connect Username/password.
For e.g.: we create a user by name scott and who can access the database with a password tiger, for this, we write:
>>Connect scott/tiger;
Or >> connect scott
Password tiger
To create a new user we write the command >>create
>>create user scott identified by tiger;
This creates a user named scott and who can access the database using password tiger.
In order to grant access to the user we write;
>>Grant connect, resource, dba to user 1;
For e.g.; >>grant connect, resource, dba to scott;
Using this granting the user scott can connect to the database, access the resources and access the database as well.
Hit like if you found this post useful.