Removing a schema and all its contents in DB2 8.x

How can I delete a schema and all its contents using SQL in DB2 8.x without knowing what the content is?

+1
source share
2 answers

I don't have a scheme that can fall at hand, but the info center ( http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin /t0005230.htm ) says that a DROP SCHEMA [schema name] will work on DB2 8.x

EDIT: Well, Infocenter also says: "Before dropping a schema, all objects that were in this schema must be reset themselves or moved to another schema"

So, first you need to delete all the objects in the circuit. Objects (tables, views, triggers, procedures, indexes ...) can be specified in catalog requests in the SYSIBM schema.

eg. to get all tables belonging to the schema, do:

 select table_name from sysibm.tables where table_schema = '[your schema name]' 

Check other sysibm views to get all objects that belong to the schema. views: sysibm.views, sysibm.triggers, sysibm.routines, sysibm.indexes, ... - see IBM Infocenter (link above) for details.

+3
source

use comand center-GUI to delete all contents of the schema, then DROP SCHEMA

+1
source

Source: https://habr.com/ru/post/888201/


All Articles