AUTH_GET_INSTANCE_AUTHID - Get the instance owner authorization ID

The AUTH_GET_INSTANCE_AUTHID scalar function returns the authorization ID of the instance owner

Syntax

Read syntax diagramSkip visual syntax diagramAUTH_GET_INSTANCE_AUTHID()

The schema is SYSPROC.

Authorization

EXECUTE privilege on the AUTH_GET_INSTANCE_AUTHID scalar function.

Default PUBLIC privilege

In a non-restrictive database, EXECUTE privilege is granted to PUBLIC when the function is automatically created.

Information returned

This function returns a value of type VARCHAR(128) that specifies the authorization ID of the instance owner.

Usage notes

A user who holds SYSADM authority does not have implicit DBADM authority. As a result, applications that run under the instance owner account and that perform operations that are not within the scope of SYSADM authority might experience authorization errors such as SQL1092N, SQL0551N, or SQL0552N.

The UPGRADE DATABASE and RESTORE DATABASE commands no longer grant DBADM authority to the SYSADM group.

To obtain a list of the authorities held by the instance owner authorization ID:
  1. Use the SYSPROC.AUTH_GET_INSTANCE_AUTHID() scalar function to determine the instance owner authorization ID. For example:
    db2 "VALUES SYSPROC.AUTH_GET_INSTANCE_AUTHID()"
    This command returns.
    1
    --------------------------------------
    BOB
    
      1 record(s) selected.
  2. Get a list of the authorities for this authorization ID. For example:
    SELECT * FROM 
       TABLE (SYSPROC.AUTH_LIST_AUTHORITIES_FOR_AUTHID ('BOB', 'U') ) AS T 
       ORDER BY AUTHORITY
  3. If necessary, grant any missing authorities. For example:
    GRANT DBADM ON DATABASE TO USER BOB

Example

The following example shows how to use the command line processor (CLP) to obtain the authorization ID of the instance owner:
db2 "values SYSPROC.AUTH_GET_INSTANCE_AUTHID()"
The following is an example of output for this command.
1
-------------------------...-------------
ZURBIE

  1 record(s) selected.