473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to delete a schema by using db2 -tvf file.sql command?

I want to delete a schema using just one command.

there are many object are dependent objects like triggers,views and tables on this schema.

can i prepare a single file which contains all the commands and it deletes all the objects followed by the schema.

So can anyone tell me the steps to follow?
Mar 23 '11 #1
1 5977
Ya i got it and providing a solution here.

Scenario:Suppose there is one schema as TEMP and this schema having the object table as T1,T2 i.e. TEMP.T1 & TEMP.T2

now i want to delete the schema TEST and if i fire a command as:

db2 DROP SCHEMA TEMP RESTRICT;

it will give me an error as

SQL0478N DROP, ALTER, TRANSFER OWNERSHIP or REVOKE on object type "SCHEMA" cannot be processed because there is an object "TEMP.T1","TEMP.T2". of type "TABLE".
which depends on it. SQLSTAE=42893

so solution to this i have to fire three commands through CLP.

so i can create a file and write the commands as

DROP TABLE TEMP.T1;
DROP TABLE TEMP.T2;

DROP SCHEMA TEMP RESTRICT;

and save the file as DROP_TEMP.sql and then fire a single command as

db2 -tvf DROP_TEMP.sql

it will drop the tables and followed by the schema.


Thank you all.
Mar 23 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Jasmin Wason | last post by:
Hi, Does anyone know if it is possible to validate some XML with an in-memory schema using Xerces-J? I have a schema that exists as a String in my Java code. I would like to validate some XML...
0
by: Andrius | last post by:
Hello, having some problems by writing XML file by XML schema. using strongly typed datasets. Schema: <?xml version="1.0" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">...
4
by: Sindarian | last post by:
This just seems like the most basic thing, but I can't find a simple description of this process anywhere and in here, everone is talking about going the other way :( I had .NET create an XML...
1
by: Mike | last post by:
Hi, Class File contains Sub Delete. I can delete one file: File.Delete(1.txt) But I can not delete a few files : File.Delete(*.txt) Of course I can use loop and delete every file :...
1
by: schaf | last post by:
Hi ! I have a simple question. I have to delete a read-only file within my application. I do it by removing the read-only flag before I delete the file. Is it possible to do in a easier way ?...
0
by: nithyasri | last post by:
How to Parse Xml schema using .NET and get an object model? I need to parse an Xml schema and display it as a tree structure in dot net. How do i do it? Any help will be appreciated.
2
by: raghutumma | last post by:
Hi, How can we execute SQL Scripts using Batch file??? i think Batch file should contain Username,Password,Database and Scripts... Using that file scripts should run... How can i give...
7
by: Shani Aulakh | last post by:
Hi there, I have a FolderWatcher.cs class that will monitor a given folder and delete files older than X number of days. I have the following methods. I need to add/show delete mothod using date...
2
by: bibek24 | last post by:
Hi all, The following problem is occuring for a particular user who doesn't have full permissions to the shared folder. Microsoft Office Access cann't delete the original mdb file after...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.