Docsity

Using GRANT and REVOKE, Assignments of Database Programming

Toggle sidebar
bg1
UsingGRANTandREVOKE
Data Control Language(DCL) is used to control privileges in
Database. To perform any operation in the database, such as
for creating tables, sequences or views, a user needs
privileges. Privileges are of two types,
System:This includes permissions for creating session,
table, etc and all types of other system privileges.
Object:This includes permissions for any command or
query to perform any operation on the database tables.
In DCL we have two commands,
GRANT: Used to provide any user access privileges or
other priviliges for the database.
REVOKE: Used to take back permissions from any user.
Allow a User to create session
When we create a user in SQL, it is not even allowed to login
and create a session until and unless proper
permissions/priviliges are granted to the user.
Following command can be used to grant the session creating
priviliges.
GRANT CREATE SESSION TO username;
pf3

Partial preview of the text

Download Using GRANT and REVOKE and more Assignments Database Programming in PDF only on Docsity!

Using GRANT and REVOKE

Data Control Language(DCL) is used to control privileges in Database. To perform any operation in the database, such as for creating tables, sequences or views, a user needs privileges. Privileges are of two types,  System: This includes permissions for creating session, table, etc and all types of other system privileges.  Object: This includes permissions for any command or query to perform any operation on the database tables. In DCL we have two commands,  GRANT: Used to provide any user access privileges or other priviliges for the database.  REVOKE: Used to take back permissions from any user. Allow a User to create session When we create a user in SQL, it is not even allowed to login and create a session until and unless proper permissions/priviliges are granted to the user. Following command can be used to grant the session creating priviliges. GRANT CREATE SESSION TO username;

Allow a User to create table To allow a user to create tables in the database, we can use the below command, GRANT CREATE TABLE TO username; Provide user with space on tablespace to store table Allowing a user to create table is not enough to start storing data in that table. We also must provide the user with priviliges to use the available tablespace for their table and data. ALTER USER username QUOTA UNLIMITED ON SYSTEM; The above command will alter the user details and will provide it access to unlimited tablespace on system. NOTE: Generally unlimited quota is provided to Admin users. Grant all privilege to a User sysdba is a set of priviliges which has all the permissions in it. So if we want to provide all the privileges to any user, we can simply grant them the sysdba permission. GRANT sysdba TO username