ALTER SCHEMA changes the attributes of a schema.
Only the owner of an index can execute this command. By default, a system administrator also can execute this command.
ALTER SCHEMA schema_name RENAME TO new_name;
ALTER SCHEMA schema_name OWNER TO new_owner;
Indicates the name of the current schema.
Value range: An existing schema name.
Renames a schema.
new_name: new name of the schema
Value range: A string. It must comply with the naming convention.
Changes the owner of a schema. To do this as a non-administrator, you must be a direct or indirect member of the new owning role, and that role must have CREATE permission in the database.
new_owner: new owner of a schema
Value range: An existing user name/role.
-- Create the ds schema: CREATE SCHEMA ds; -- Rename the ds schema to ds_new: ALTER SCHEMA ds RENAME TO ds_new; -- Create user jack: CREATE USER jack PASSWORD 'Bigdata123@'; -- Change the owner of ds_new to jack: ALTER SCHEMA ds_new OWNER TO jack; -- Delete user jack and the ds_new schema: DROP SCHEMA ds_new; DROP USER jack;