'db2 database owner

How to get/change db2 database owner?

db2


Solution 1:[1]

In DB2 there is no direct database owner, but there is the concept of database administrator. Here is an overview of DB2 database authorities. Those are per database and can be granted and revoked. In order to get or change the "database owner" you would revoke the DBADM authority or grant it. You could even have multiple users who have that authority.

All users with DBADM authority can be obtained this way:

SELECT DISTINCT GRANTEE, GRANTEETYPE FROM SYSCAT.DBAUTH
      WHERE DBADMAUTH = 'Y'

In order to create a database, you would need the SYSADM or SYSCTRL authority on the system (instance) level.

Solution 2:[2]

In DB2 that is one of the strangest things, to take care of that, after restore you have to run following command and recycle the instance which causes outage.

db2set DB2_RESTORE_GRANT_ADMIN_AUTHORITIES=ON

This may not be ideal if the instance where you restore the DB is sort of cannot take outage. So avoid this situation as part of instance setup I set this variable to begin with.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 data_henrik
Solution 2 gvphubli.blogspot.com