
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Provide and Remove User Access to DB2 Objects
DB2 has a concept of DCL, through which we can control the access to DB2 objects like table, plan, etc. DCL stands for Data Control Language and using this we can provide and remove user access to the DB2 objects.
GRANT command will give the user access to the mentioned object and REVOKE command will remove the user access.
For example, if we have to provide SELECT and UPDATE access on the ORDERS table to user REL123X then we will fire below command.
GRANT SELECT, UPDATE ON ORDERS TO REL123X
If we want to provide INSERT access, then we will use the below command.
GRANT INSERT ON ORDERS TO REL123X
If we want to revoke all the access on the ORDERS table for user REL123X then we will use the below command.
REVOKE ALL ON ORDERS FROM REL123X
If we want to revoke UPDATE access on the ORDERS table for user REL123X then we will use the below command.
REVOKE UPDATE ON ORDERS FROM REL123X
If we want to revoke INSERT access on the ORDERS table for user REL123X then we will use the below command.
REVOKE INSERT ON ORDERS FROM REL123X
The important point to note here is that not all users of DB2 can execute the Data control language (DCL) GRANT and REVOKE statement. We need special DBA privileges on our userid to use DCL statements. In a real world scenario, there is a dedicated team which provides access to the database objects based on the roles assigned to the individuals.