VeloDB Cloud
SQL Manual
SQL Statements
DDL
Alter
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;
  1. Rename the database
ALTER DATABASE db_name RENAME new_db_name;
  1. 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.

  1. Modify the properties of an existing database
ALTER DATABASE db_name SET PROPERTIES ("key"="value", ...); 

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;
  1. 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");
  1. 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

Best Practice