Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

How do I drop a schema in db2 if it has got some objects in it? 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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
@Nachikethas - here are the links to the documentation for what Peter Ji refered too. publib.boulder.ibm.com/infocenter/db2luw/v9/topic/… and then publib.boulder.ibm.com/infocenter/db2luw/v9/topic/… –  Chris Aldrich Mar 7 '12 at 13:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.