- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to provide & remove user access to/from DB2 object? Give the DB2 commands?
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.
- Related Articles
- What are the ways to calculate DB2 database size using DB2 utility and other methods?
- How to get the list of all COBOL-DB2 programs using a DB2 table TAB1?
- Usage and example of Multi-index and Index-only access path in DB2
- How to precompile a COBOL-DB2 program?
- How to delete a DB2 table TAB1?
- Give the panel command to start a specific tablespace within a DB2 database.
- Write a DB2 query to find out all the duplicate INVOICE_ID in ORDERS DB2 table?
- Write the DB2 SQL query to find the third highest ORDER_TOTAL in a ORDERS DB2 table
- How to reorganize the DB2 tablespace TABSPAC1 to reclaim fragmented space?
- How can you revert all the DB2 table changes done in a COBOL-DB2 program?
- How to delete all the DB2 packages in collection COLL1?
- How to find the access path selected by an optimizer for a SQL statement used in a DB2 program?
- How to store a NULL value in a particular column of a DB2 table using COBOL-DB2 program?
- How to create a DB2 bufferpool with pagesize 4096?
- Give and explain the panel command to display all the components of DB2 database DSNDB01 along with their status?
