ALTER DATABASE statement

The ALTER DATABASE statement changes the characteristics of a database.

Use the SET OWNER clause to transfer the ownership of the database from the current owner to another user or a role.

The user who creates a database automatically receives the OWNER rank. When object ownership is enabled in Ranger, the database owner holds implicit privileges, such as ALL privilege with or without GRANTauthority, assigned automatically during database creation (CREATE DATABASE). Ranger uses the term OWNER to distinguish these implicit creator privileges from explicit privileges granted using the GRANT statement, such as GRANT ALL.

Use the SET DBPROPERTIES clause to add or update the user-defined key-value properties associated with the database. Impala stores the properties in the metastore. Display them by using the DESCRIBE DATABASE EXTENDED or DESCRIBE DATABASE FORMATTED statement.

Syntax:


ALTER DATABASE database_name SET OWNER USER user_name;
ALTER DATABASE database_name SET OWNER ROLE role_name;
ALTER DATABASE database_name SET DBPROPERTIES ('key1'='value1', 'key2'='value2', ...);

Statement type: DDL

Cancellation: Cannot be cancelled.

Added in: The SET OWNER clause was added in Impala 3.1. The SET DBPROPERTIES clause was added in Impala 5.0.