Granting privileges with the GRANT statement
You can assign privileges to an ID or a role by issuing the GRANT statement.
About this task
Suppose that the Spiffy Computer Company wants to create a database to hold information that is usually posted on hallway bulletin boards. For example, the database might hold notices of upcoming holidays and bowling scores.
To create and maintain the tables and programs that are needed for this application, the Spiffy Computer Company develops the security plan shown in the following diagram.
The Spiffy Computer Company's system of privileges and authorities associates each role with an authorization ID. For example, the System Administrator role has the ADMIN authorization ID.
GRANT PACKADM ON COLLECTION BOWLS TO PKA01 WITH GRANT OPTION;
This statement grants to PKA01 the CREATE IN privilege on the collection BOWLS and BIND, EXECUTE, and COPY privileges on all packages in the collection. Because ADMIN used the WITH GRANT OPTION clause, PKA01 can grant those privileges to others.
GRANT CREATEDBA TO DBA01;
This statement grants to DBA01 the privilege to create a database and to have DBADM authority over that database.
GRANT USE OF STOGROUP SG1 TO DBA01 WITH GRANT OPTION;
This statement allows DBA01 to use storage group SG1 and to grant that privilege to others.
GRANT USE OF BUFFERPOOL BP0, BP1 TO DBA01 WITH GRANT OPTION;
This statement allows DBA01 to use buffer pools BP0 and BP1 and to grant that privilege to others.
GRANT CREATE IN COLLECTION DSN8CC91 TO ROLE ROLE1;
This statement grants to ROLE1 the privilege to create new packages in collections DSN8CC91.
The package administrator, PKA01, controls the binding of packages into collections. PKA01 can use the CREATE IN privilege on the collection BOWLS and the BIND, EXECUTE, and COPY privileges on all packages in the collection. PKA01 also has the authority to grant these privileges to others.
The database administrator, DBA01, using the CREATEDBA privilege, creates the database DB1. When DBA01 creates DB1, DBA01 automatically has DBADM authority over the database.
The database administrator at Spiffy Computer Company wants help with running the COPY and RECOVER utilities. Therefore DBA01 grants DBCTRL authority over database DB1 to DBUTIL1 and DBUTIL2.
GRANT DBCTRL ON DATABASE DB1 TO DBUTIL1, DBUTIL2;