ALTER DATABASE
May 28, 2026 ยท View on GitHub
ALTER DATABASE configures the properties of the specified database.
:::tip
This operation requires the ALTER privilege on the target database. You can follow the instructions in GRANT to grant this privilege.
:::
Syntax
-
Set database data quota in B/K/KB/M/MB/G/GB/T/TB/P/PB.
ALTER DATABASE <db_name> SET DATA QUOTA <quota>; -
Rename a database.
ALTER DATABASE <db_name> RENAME <new_db_name>; -
Set database replica quota.
ALTER DATABASE <db_name> SET REPLICA QUOTA <quota>; -
Set database storage volume
ALTER DATABASE <db_name> SET ("storage_volume" = "<new_storage_volume_name>");
Note:
- After renaming the database, use REVOKE and GRANT commands to modify the corresponding user permission if necessary.
- The database's default data quota and the default replica quota are $2^{63}$-1.
- The database's default storage volume is the default storage volume when the database is created if the "storage_volume" property is not explicitly provided.
Examples
-
Set data quota for a database.
ALTER DATABASE example_db SET DATA QUOTA 10995116277760B; -- The above unit is bytes, equivalent to the following statement. ALTER DATABASE example_db SET DATA QUOTA 10T; ALTER DATABASE example_db SET DATA QUOTA 100G; ALTER DATABASE example_db SET DATA QUOTA 200M; -
Rename the database
example_dbasexample_db2.ALTER DATABASE example_db RENAME example_db2; -
Set database replica quota.
ALTER DATABASE example_db SET REPLICA QUOTA 102400; -
Set database storage volume.
ALTER DATABASE example_db SET ("storage_volume" = "aws_s3_storage_volume");