patternMinor
DROP SCHEMA in db2
Viewed 0 times
dropschemadb2
Problem
How do I drop a schema in db2 if it has got some objects in it?
For some reason I am not able to drop the tables in the schema, so how can I force to drop the schema itself?
db2 DROP SCHEMA SCHEMA_NAME For some reason I am not able to drop the tables in the schema, so how can I force to drop the schema itself?
Solution
If there are some objects in the schema, or depend on it.
It is not allowed to drop the schema in db2.
We must drop the objects first. and then
db2 "drop schema schema_name RESTRICT"
And there is another way to drop the schema and all objects in it.
ADMIN_DROP_SCHEMA procedure - Drop a specific schema and its objects.
such as:
db2 "CALL SYSPROC.ADMIN_DROP_SCHEMA('schema_name', NULL, 'ERRORSCHEMA', 'ERRORTABLE')"
by the way:
You need to have sufficient permission to drop object.
It is not allowed to drop the schema in db2.
We must drop the objects first. and then
db2 "drop schema schema_name RESTRICT"
And there is another way to drop the schema and all objects in it.
ADMIN_DROP_SCHEMA procedure - Drop a specific schema and its objects.
such as:
db2 "CALL SYSPROC.ADMIN_DROP_SCHEMA('schema_name', NULL, 'ERRORSCHEMA', 'ERRORTABLE')"
by the way:
You need to have sufficient permission to drop object.
Context
StackExchange Database Administrators Q#14526, answer score: 2
Revisions (0)
No revisions yet.