ALTER DATABASE - Amazon Redshift


Changes the attributes of a database.


ALTER DATABASE database_name | RENAME TO new_name | OWNER TO new_owner | CONNECTION LIMIT { limit | UNLIMITED } ]



Name of the database to alter. Typically, you alter a database that you are not currently connected to; in any case, the changes take effect only in subsequent sessions. You can change the owner of the current database, but you can't rename it:

alter database tickit rename to newtickit; ERROR: current database may not be renamed

Renames the specified database. For more information about valid names, see Names and identifiers. You can't rename the dev, padb_harvest, template0, or template1 databases, and you can't rename the current database. Only the database owner or a superuser can rename a database; non-superuser owners must also have the CREATEDB privilege.


New database name.


Changes the owner of the specified database. You can change the owner of the current database or some other database. Only a superuser can change the owner.


New database owner. The new owner must be an existing database user with write privileges. See GRANT for more information about user privileges.


The maximum number of database connections users are permitted to have open concurrently. The limit is not enforced for superusers. Use the UNLIMITED keyword to permit the maximum number of concurrent connections. A limit on the number of connections for each user might also apply. For more information, see CREATE USER. The default is UNLIMITED. To view current connections, query the STV_SESSIONS system view.


If both user and database connection limits apply, an unused connection slot must be available that is within both limits when a user attempts to connect.

Usage notes

ALTER DATABASE commands apply to subsequent sessions not current sessions. You need to reconnect to the altered database to see the effect of the change.


The following example renames a database named TICKIT_SANDBOX to TICKIT_TEST:

alter database tickit_sandbox rename to tickit_test;

The following example changes the owner of the TICKIT database (the current database) to DWUSER:

alter database tickit owner to dwuser;