Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: deleating a database

Re: deleating a database

From: Mark D Powell <markp7832_at_my-deja.com>
Date: Mon, 12 Feb 2001 14:46:47 GMT
Message-ID: <968t0k$2rp$1@nnrp1.deja.com>

In article <981809237.156454_at_news2.bigplanet.com>,   "albrrat" <albrrat_at_hotmail.com> wrote:
> I created a small database with very little to nothing in it. How can
 I
> deleate or clear the entire database in one shot without constraint
 errors.
> I would like to spoool the DDL and DML to a new file to show the
 professor
> the steps taken but cannot do it, if some data is already there. I
 have all
> the data on file and would be realy easy to run if nothing existed.
 Is there
> a way to do this?
>

Clearing out all existing data isn't quite the same thing as deleteing a database but to clear out the data here is what you do:

  1. Break all the foreign keys
  2. Truncate all the application tables
  3. Restore all the foreign keys

You can use sql to generate the sql necessary to do the above: select 'truncate table '||owner||'.'||table_name||';' from sys.dba_tables where owner = 'APPLOWNER';

Another method would be to run a full export with rows=n so no data is exported, delete the database, rebuild it, and import the object definitions out of the export file.

--
Mark D. Powell  -- The only advice that counts is the advice that
 you follow so follow your own advice --


Sent via Deja.com
http://www.deja.com/
Received on Mon Feb 12 2001 - 08:46:47 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US