ALTER DATABASE
Descriptionβ
This statement is used to set properties of the specified database. (administrator only)
- 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;
- Rename the database
ALTER DATABASE db_name RENAME new_db_name;
- 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.
- Modify the properties of an existing database
ALTER DATABASE db_name SET PROPERTIES ("key"="value", ...);
Exampleβ
- 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;
- Rename the database example_db to example_db2
ALTER DATABASE example_db RENAME example_db2;
- Set the quota for the number of copies of the specified database
ALTER DATABASE example_db SET REPLICA QUOTA 102400;
- Modify the default replica distribution policy for tables in db (this operation only applies to newly created tables and will not modify existing tables in db)
ALTER DATABASE example_db SET PROPERTIES("replication_allocation" = "tag.location.default:2");
- Cancel the default replica distribution policy for tables in db (this operation only applies to newly created tables and will not modify existing tables in db)
ALTER DATABASE example_db SET PROPERTIES("replication_allocation" = "");
Keywordsβ
ALTER,DATABASE,RENAME