> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# ALTER DATABASE

> ALTER DATABASE configures the properties of the specified database.

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](/documents/4.2/sql-reference/sql-statements/account-management/GRANT.md) to grant this privilege.

## Syntax

1. Set database data quota in B/K/KB/M/MB/G/GB/T/TB/P/PB.

   ```sql theme={null}
   ALTER DATABASE <db_name> SET DATA QUOTA <quota>;
   ```

2. Rename a database.

   ```sql theme={null}
   ALTER DATABASE <db_name> RENAME <new_db_name>;
   ```

3. Set database replica quota.

   ```sql theme={null}
   ALTER DATABASE <db_name> SET REPLICA QUOTA <quota>;
   ```

4. Set database storage volume

   ```sql theme={null}
   ALTER DATABASE <db_name> SET ("storage_volume" = "<new_storage_volume_name>");
   ```

Note:

```plain text theme={null}
- 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

1. Set data quota for a database.

   ```SQL theme={null}
   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;
   ```

2. Rename the database `example_db` as `example_db2`.

   ```SQL theme={null}
   ALTER DATABASE example_db RENAME example_db2;
   ```

3. Set database replica quota.

   ```SQL theme={null}
   ALTER DATABASE example_db SET REPLICA QUOTA 102400;
   ```

4. Set database storage volume.

   ```SQL theme={null}
   ALTER DATABASE example_db SET ("storage_volume" = "aws_s3_storage_volume");
   ```

## References

* [CREATE DATABASE](/documents/4.2/sql-reference/sql-statements/Database/CREATE_DATABASE.md)
* [USE](/documents/4.2/sql-reference/sql-statements/Database/USE.md)
* [SHOW DATABASES](/documents/4.2/sql-reference/sql-statements/Database/SHOW_DATABASES.md)
* [DESC](/documents/4.2/sql-reference/sql-statements/table_bucket_part_index/DESCRIBE.md)
* [DROP DATABASE](/documents/4.2/sql-reference/sql-statements/Database/DROP_DATABASE.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.