ALTER SCHEMA
Changes the definition of an existing schema. Use this command to rename a schema or change the owner of a schema.
For example, rename an existing schema to preserve a backup copy of that schema when you plan to create a new version of that schema. For more information about schemas, see CREATE SCHEMA.
Syntax
ALTER SCHEMA schema_name { RENAME TO new_name | OWNER TO new_owner }
Parameters
- schema_name
-
The name of the database schema to be altered.
- RENAME TO
-
A clause that renames the schema.
- new_name
-
The new name of the schema. For more information about valid names, see Names and Identifiers.
- OWNER TO
-
A clause that changes the owner of the schema.
- new_owner
-
The new owner of the schema.
Examples
The following example renames the SALES schema to US_SALES.
alter schema sales rename to us_sales;
The following example gives ownership of the US_SALES schema to the user DWUSER.
alter schema us_sales owner to dwuser;