ALTER SCHEMA
Function
ALTER SCHEMA changes the attributes of a schema.
Precautions
- Only the owner of a schema or users with the ALTER permission for the schema can run the ALTER SCHEMA statement. System administrators have this permission by default.
- To change the owner of a schema or its storage limit, a non-admin user must be directly or indirectly part of the new role and have CREATE permission on the database.
Syntax
- Rename a schema.
1 2
ALTER SCHEMA schema_name RENAME TO new_name;
- Changes the owner of a schema.
1 2
ALTER SCHEMA schema_name OWNER TO new_owner;
- Changes the storage space limit of the permanent table in the schema.
1 2
ALTER SCHEMA schema_name WITH PERM SPACE 'space_limit';
Parameter Description
Parameter |
Description |
Value Range |
---|---|---|
schema_name |
Specifies the name of the schema to be modified. |
Name of an existing schema. |
new_name |
Specifies the new schema name. |
A string compliant with the identifier naming rules. |
new_owner |
Specifies the new schema owner. |
Name of an existing user or role. |
WITH PERM SPACE 'space_limit' |
The upper limit of the permanent table storage space of the schema. |
A string consists of an integer and unit. The unit can be K/M/G/T/P. The parsed value is in kilobytes (K) and must stay within the 1 KB to 9,007,199,254,740,991 KB range. |
Examples
Create an example schema schema_test and a user user_a.
1 2 |
CREATE SCHEMA schema_test; CREATE USER user_a PASSWORD '{Password}'; |
Rename schema_test to schema_test1.
1
|
ALTER SCHEMA schema_test RENAME TO schema_test1; |
Change the owner of schema_test1 to user_a.
1
|
ALTER SCHEMA schema_test1 OWNER TO user_a; |
Helpful Links
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot