Database Administration · Unit 6
User Security and Privilege Management
Exam-focused notes for User Security and Privilege Management (Database Administration, BIT352): what the TU syllabus asks and how it has actually been tested, with 9 solved past questions from this unit.
User Security and Privilege Management in short
This chapter shows how a DBA creates users, controls what they can do, and sets password rules. It is the base of database security.
What this unit covers
- User creation and management commands
- Privilege definition and importance
- System privileges and object privileges
- Grant privilege commands
- Revoke privilege commands
- Drop user commands
- Role definition and purpose
- Role creation and assignment
- Role in privilege management
- User profiles and profile assignment
Privilege definition and importance
2081 · 5 marks
What is privilege? Write commands to create user, grant privilege, revoke privilege and drop user in oracle database. [5]
Show solved answerHide answer
Privilege in Oracle Database
What is Privilege?
A privilege is a right or permission granted to a database user to perform a specific operation or to access a specific database object. Privileges control what actions a user can perform in the database system.
There are two types of privileges in Oracle:
- System Privileges - Allow users to perform specific database operations (e.g., CREATE TABLE, CREATE SESSION)
- Object Privileges - Allow users to perform operations on specific database objects like tables, views, etc. (e.g., SELECT, INSERT, UPDATE, DELETE on a table)
Oracle Database Commands
1. Create User
CREATE USER username IDENTIFIED BY password;
Example:
CREATE USER john IDENTIFIED BY john123;
2. Grant Privilege
GRANT privilege_name TO username;
Example (System Privilege):
GRANT CREATE SESSION TO john;
GRANT CREATE TABLE TO john;
Example (Object Privilege):
GRANT SELECT, INSERT ON employees TO john;
The
WITH GRANT OPTIONallows the user to further grant the privilege to others:
GRANT SELECT ON employees TO john WITH GRANT OPTION;
3. Revoke Privilege
REVOKE privilege_name FROM username;
Example (System Privilege):
REVOKE CREATE TABLE FROM john;
Example (Object Privilege):
REVOKE SELECT, INSERT ON employees FROM john;
4. Drop User
DROP USER username;
Example:
DROP USER john;
If the user owns database objects (tables, views, etc.), use
CASCADEto drop the user along with all their objects:
DROP USER john CASCADE;
Summary Table
| Operation | Command Syntax |
|---|---|
| Create User | CREATE USER name IDENTIFIED BY password; |
| Grant Privilege | GRANT privilege TO user; |
| Revoke Privilege | REVOKE privilege FROM user; |
| Drop User | DROP USER name [CASCADE]; |
2080 · 10 marks
What is the importance of privileges in database security? Explain about role in oracle datanse and write command to do following: a. Create role b. Grant system and object privileges to role c. Create user d. Assign role to user e. Drop role[10]
2081.1 · 5 marks
What is privilege? Write commands to create user, grant privilege, revoke privilege and drop user in oracle database. [5]
Show solved answerHide answer
Privilege in Oracle Database
What is Privilege?
A privilege is a right or permission granted to a database user to perform a specific operation or to access a specific database object. Privileges control what actions a user can perform in the database system.
There are two types of privileges in Oracle:
- System Privileges - Allow users to perform specific database operations (e.g., CREATE TABLE, CREATE SESSION)
- Object Privileges - Allow users to perform operations on specific database objects like tables, views, etc. (e.g., SELECT, INSERT, UPDATE, DELETE on a table)
Oracle Database Commands
1. Create User
CREATE USER username IDENTIFIED BY password;
Example:
CREATE USER john IDENTIFIED BY john123;
2. Grant Privilege
GRANT privilege_name TO username;
Examples:
-- Grant system privilege
GRANT CREATE SESSION TO john;
GRANT CREATE TABLE TO john;
-- Grant object privilege
GRANT SELECT, INSERT ON employees TO john;
-- Grant all privileges
GRANT ALL PRIVILEGES TO john;
The
WITH GRANT OPTIONallows the user to further grant the privilege to others:
GRANT SELECT ON employees TO john WITH GRANT OPTION;
3. Revoke Privilege
REVOKE privilege_name FROM username;
Examples:
-- Revoke system privilege
REVOKE CREATE TABLE FROM john;
-- Revoke object privilege
REVOKE SELECT, INSERT ON employees FROM john;
4. Drop User
DROP USER username;
Example:
DROP USER john;
-- To drop user along with all their objects (tables, views, etc.)
DROP USER john CASCADE;
The
CASCADEoption is used when the user owns database objects; it removes the user and all associated objects.
Summary Table
| Operation | Command |
|---|---|
| Create User | CREATE USER name IDENTIFIED BY password; |
| Grant Privilege | GRANT privilege TO user; |
| Revoke Privilege | REVOKE privilege FROM user; |
| Drop User | DROP USER name [CASCADE]; |
0 · 5 marks
What is privilege? Write commands to create user, grant privilege, revoke privilege and drop user in oracle database. [5]
Show solved answerHide answer
Privilege in Oracle Database
What is Privilege?
A privilege is a right or permission granted to a database user to perform a specific action on the database or on a specific database object. Privileges control what a user can do within the Oracle database system.
There are two types of privileges in Oracle:
- System Privileges - Allow users to perform specific actions on the database (e.g., CREATE TABLE, CREATE SESSION).
- Object Privileges - Allow users to perform specific actions on specific database objects like tables, views, sequences (e.g., SELECT, INSERT, UPDATE, DELETE on a table).
Oracle Database Commands
1. Create User
CREATE USER username IDENTIFIED BY password;
Example:
CREATE USER john IDENTIFIED BY john123;
2. Grant Privilege
GRANT privilege_name TO username;
Example (System Privilege):
GRANT CREATE SESSION TO john;
GRANT CREATE TABLE TO john;
Example (Object Privilege):
GRANT SELECT, INSERT ON employees TO john;
The
WITH GRANT OPTIONallows the user to further grant the privilege to others:
GRANT SELECT ON employees TO john WITH GRANT OPTION;
3. Revoke Privilege
REVOKE privilege_name FROM username;
Example (System Privilege):
REVOKE CREATE TABLE FROM john;
Example (Object Privilege):
REVOKE SELECT, INSERT ON employees FROM john;
4. Drop User
DROP USER username;
Example:
DROP USER john;
If the user owns database objects (tables, views, etc.), use
CASCADEto drop the user along with all their objects:
DROP USER john CASCADE;
Summary Table
| Operation | Command Syntax |
|---|---|
| Create User | CREATE USER name IDENTIFIED BY password; |
| Grant Privilege | GRANT privilege TO user; |
| Revoke Privilege | REVOKE privilege FROM user; |
| Drop User | DROP USER name [CASCADE]; |
Role definition and purpose
2081 · 5 marks
What is Role? Explain its role in privilege management with suitable example. [5]
2081.1 · 5 marks
What is Role? Create a Role called “general” and grant privileges to the role general and assign that role to a user in oracle. [5]
0 · 5 marks
What is Role? Explain its role in privilege management with suitable example. [5]
User profiles and profile assignment
2081 · 5 marks
What is user profile? Create a simple user profile and assign the profile to new user in oracle. [5]
0 · 5 marks
What is user profile? Create a simple user profile and assign the profile to new user in oracle. [5]
Make Unit 6 stick
Practice BIT352 with flashcards & quizzes