Skip to main content
Skip to main content

ALTER-DATABASE

ALTER-DATABASE​

Name​

ALTER DATABASE

Description​

This statement is used to set properties of the specified database. (administrator only)

1) Set the database data quota, the unit is B/K/KB/M/MB/G/GB/T/TB/P/PB

ALTER DATABASE db_name SET DATA QUOTA quota;

2) Rename the database

ALTER DATABASE db_name RENAME new_db_name;

3) Set the quota for the number of copies of the database

ALTER DATABASE db_name SET REPLICA QUOTA quota;

illustrate: After renaming the database, use the REVOKE and GRANT commands to modify the appropriate user permissions, if necessary. The default data quota for the database is 1024GB, and the default replica quota is 1073741824.

Example​

  1. Set the specified database data volume quota
ALTER DATABASE example_db SET DATA QUOTA 10995116277760;
The above unit is bytes, which is equivalent to
ALTER DATABASE example_db SET DATA QUOTA 10T;

ALTER DATABASE example_db SET DATA QUOTA 100G;

ALTER DATABASE example_db SET DATA QUOTA 200M;
  1. Rename the database example_db to example_db2
ALTER DATABASE example_db RENAME example_db2;
  1. Set the quota for the number of copies of the specified database
ALTER DATABASE example_db SET REPLICA QUOTA 102400;

Keywords​

ALTER,DATABASE,RENAME

Best Practice​