Authentication answers “who are you?” Privileges answer “what may you do?” In DB2 for z/OS you grant those rights with GRANT and take them away with REVOKE. This page is a map of privilege classes (tables, schemas, databases, packages, plans, sequences, routines, variables, types, buffer pools, storage groups, table spaces, collections), the special grantee PUBLIC, ownership and TRANSFER OWNERSHIP, and the administrative authorities SYSADM, SYSCTRL, SYSOPR, SECADM, DBADM, DBCTRL, DBMAINT, PACKADM, SQLADM, and System DBADM.
A privilege is a single right, usually on one object: SELECT on HR.EMPLOYEE, EXECUTE on a package, USE of buffer pool BP2. An authority is a named bundle. GRANT DBADM ON DATABASE PAYROLL is shorter and clearer than fifty table GRANTs plus LOAD and REORG. Beginners should still learn the individual privileges, because that is what shows up in SQLCODE -551 messages and in SYSIBM.SYSTABAUTH.
Grantees can be an authorization ID, a ROLE, or PUBLIC. Granting to a RACF group that is a secondary ID, or to a role in a trusted context, scales better than granting to every TSO user.
Each object class has its own GRANT form. You can list several privileges, several objects, and several grantees. WITH GRANT OPTION lets the grantee pass the same privilege on. Granting SYSADM or SYSCTRL with GRANT OPTION is valid but redundant, because those authorities already imply the ability to grant.
12345678910GRANT SELECT ON DEPT TO PUBLIC; GRANT UPDATE (EMPNO, WORKDEPT) ON TABLE HR.EMPLOYEE TO NATZ; GRANT ALL ON TABLE HR.EMPLOYEE TO KWAN, ALONZO WITH GRANT OPTION; GRANT CREATEIN, ALTERIN, DROPIN ON SCHEMA HR TO ROLE HR_DDL;
If you GRANT on a table, package, schema, or other object that does not exist, Db2 rejects the grant. Schema names are an exception: you can GRANT ON SCHEMA for a schema that does not exist yet, including SCHEMA *.
REVOKE removes an explicit grant. The same ID that granted a privilege can revoke it. If two grantors granted SELECT to STEVE, one REVOKE leaves the other grant in place. Authorities such as SECADM or ACCESSCTRL (and SYSADM/SYSCTRL when SEPARATE_SECURITY is NO) can revoke another ID’s grant with BY.
12345REVOKE SELECT ON TABLE HR.EMPLOYEE FROM NATZ; REVOKE CREATETAB ON DATABASE DB1 FROM PGMR01 BY ALL; REVOKE CREATETAB, CREATETS ON DATABASE DB1 FROM PGMR01 BY DBUTIL1;
Cascading revoke: if you granted WITH GRANT OPTION and then revoke, dependent grants can disappear depending on REVOKE DEP PRIV. An ID that still has the privilege from another source keeps it. Installation SYSADM IDs are protected from some cascade effects. Plan revokes before you pull SYSADM from an ID that granted half the shop.
| Privilege | Meaning |
|---|---|
| SELECT | Read rows; required to create a view on the table |
| INSERT | Insert rows (not on auxiliary tables) |
| UPDATE | Update rows; may list columns |
| DELETE | Delete rows |
| INDEX | CREATE INDEX on the table (not on views) |
| ALTER | ALTER TABLE |
| REFERENCES | Use the table as a parent of a referential constraint |
| TRIGGER | CREATE TRIGGER on the table |
| UNLOAD | UNLOAD utility (function-level dependent; not on views) |
Views get SELECT, INSERT, UPDATE, and DELETE as applicable; INDEX, REFERENCES, and TRIGGER do not apply to views. Auxiliary tables reject several of these privileges. Granting on a view is how you expose two columns of EMPLOYEE without granting SELECT on the base table.
GRANT ... ON DATABASE names a Db2 database (the CREATE DATABASE object), not a whole subsystem.
CREATEIN, ALTERIN, and DROPIN on a schema control distinct types, sequences, stored procedures, triggers, and user-defined functions in that schema. GRANT ON SCHEMA * covers every schema, including future ones. SYSPUBLIC is the reserved schema for public aliases.
1234GRANT EXECUTE ON PACKAGE PAYROLL.PAYCALC TO ROLE PAY_USERS; GRANT BIND, EXECUTE ON PLAN PAYPLAN TO PAYBIND; GRANT CREATE IN COLLECTION PAYROLL TO PAYBIND; GRANT PACKADM ON COLLECTION PAYROLL TO PAYDBA;
If a plan issues INSERT and SELECT, you grant those to the owner at bind time and grant EXECUTE to end users. That is the classic z/OS pattern: users never receive ad-hoc table privileges for production data.
1234GRANT USAGE ON SEQUENCE HR.EMPNO_SEQ TO ROLE HR_APP; GRANT EXECUTE ON PROCEDURE HR.UPD_SALARY TO ROLE HR_APP; GRANT READ, WRITE ON VARIABLE HR.GV_DEPT TO ROLE HR_APP; GRANT USAGE ON TYPE HR.MONEY TO ROLE HR_DDL;
Creating a table space or index that uses a buffer pool, storage group, or (for tables) an existing table space requires USE of that resource, unless a covering authority implies it.
123GRANT USE OF BUFFERPOOL BP2 TO HRDBA; GRANT USE OF STOGROUP HRSTO TO HRDBA; GRANT USE OF TABLESPACE HRDB.HRTS TO HRDBA;
| Authority | What it is for |
|---|---|
| SYSADM | Almost all subsystem privileges, including data; install SYSADM is stronger still |
| SYSCTRL | Most SYSADM operations without reading or changing user data |
| SYSOPR | Operator commands (start/stop/display traces and subsystem operations) |
| SECADM | Security objects, GRANT/REVOKE; no inherent user-table data access |
| System DBADM | Create/alter/drop objects across the subsystem without inherent data access |
| DBADM / DBCTRL / DBMAINT | Database-level bundles: data+DDL, utilities without data, maintenance utilities |
| PACKADM | Package administrator on a collection (BIND, COPY, EXECUTE on packages there) |
| SQLADM | EXPLAIN, monitoring, and performance without inherent user data access |
Related system privileges include DATAACCESS (read/write user data, execute routines, use sequences and global variables), ACCESSCTRL (grant/revoke without being SECADM), BINDAGENT, ARCHIVE, CREATESG, CREATETMTAB, CREATE_SECURE_OBJECT, DISPLAY, RECOVER, STOPALL, STOSPACE, and TRACE. GRANT them ON SYSTEM.
123GRANT SYSCTRL ON SYSTEM TO OPSLEAD; GRANT SQLADM ON SYSTEM TO TUNER1; GRANT DBADM ON DATABASE PAYROLL TO PAYDBA;
When SEPARATE_SECURITY=YES, only SECADM (not SYSADM) grants ACCESSCTRL, System DBADM, DATAACCESS, and CREATE_SECURE_OBJECT, and only SECADM activates row or column access control. Know that parameter before you copy a GRANT script from an older subsystem.
The owner of an object holds implicit privileges on it, including the ability to GRANT. Dynamic CREATE typically makes the SQL authorization ID the owner (subject to schema rules). Static CREATE follows bind QUALIFIER/owner rules.
TRANSFER OWNERSHIP moves ownership to another ID or role so you are not stuck with a departed employee as OWNER. Revoking SYSADM from that employee does not always change OWNER; transfer explicitly.
123TRANSFER OWNERSHIP OF TABLE HR.EMPLOYEE TO ROLE HR_OWNER REVOKE PRIVILEGES;
REVOKE PRIVILEGES on the transfer drops the old owner’s implicit rights. Omit it only when you intend the old owner to keep access.
PUBLIC means every user at the current server. Catalog and sample objects sometimes come with PUBLIC SELECT. Production employee tables should not. Implicit PUBLIC CREATETAB on a work-file database for declared temporary tables is not a normal catalog grant you REVOKE.
Privileges are permission slips. GRANT writes a slip that says “Nat may update these two columns.” REVOKE tears up a slip you wrote. If two teachers both wrote a slip, you must tear up both. PUBLIC is a slip taped to the classroom door for everyone. Authorities are a whole binder of slips (the “database teacher” binder). Ownership is “this is my backpack,” which includes the right to hand out slips about that backpack. TRANSFER OWNERSHIP gives the backpack to someone else. EXECUTE on a plan is a ticket to ride a bus the driver already has licenses for—you do not need your own driver’s license for every street (table) the bus uses.
1. What can REVOKE remove?
2. What does GRANT SELECT ON DEPT TO PUBLIC do?
3. Which authority manages security objects and has no inherent table data access?
4. What are schema privileges ALTERIN, CREATEIN, and DROPIN for?
5. Why grant EXECUTE on a plan instead of SELECT on every table?