How to Drop all data in a database?

Hi There,
I'm use to dropping all the objects in a database, however, how do I drop ONLY the DATA in the database? Is all data in the database stored in tables? Do I have to TRUNCATE all the tables in the database only? Thanks in advanced.
J

You can try to:
1. disable foreign key constraints instead of dropping them.
2. truncate all tables in any order
3. enable foreign key constraints.
Short example:
SQL> truncate table parent;
truncate table parent
ERROR at line 1:
ORA-02266: unique/primary keys in table referenced by enabled foreign keys
SQL> select constraint_name, table_name from user_constraints where r_constraint_name is not null;
CONSTRAINT_NAME                TABLE_NAME
SYS_C0011060                   CHILD
JHIST_JOB_FK                   JOB_HISTORY
JHIST_EMP_FK                   JOB_HISTORY
JHIST_DEPT_FK                  JOB_HISTORY
EMP_DEPT_FK                    EMPLOYEES
EMP_JOB_FK                     EMPLOYEES
EMP_MANAGER_FK                 EMPLOYEES
DEPT_LOC_FK                    DEPARTMENTS
DEPT_MGR_FK                    DEPARTMENTS
LOC_C_ID_FK                    LOCATIONS
COUNTR_REG_FK                  COUNTRIES
11 rows selected.
SQL> alter table child disable constraint sys_c0011060;
Table altered.
SQL> truncate table parent;
Table truncated.
SQL> truncate table child;
Table truncated.
SQL> alter table child enable constraint sys_c0011060;
Table altered.
SQL>

Similar Messages

  • How can I clean all data in a database but keep all datafile still same nam

    hi,
    How can I get a easy way to clean all data in a database but keep all datafiles still same name and location just like a new created database?
    dbca has two choice: create templet without datafile or with all datafiles but not empty datafiles.
    thanks

    What version is your database? DBCA in 10gR2 allows you to create a template from an existing database using only the structure. From DBCA
    From an existing database (structure only)
    The template will contain structural information about the source database including database options, tablespaces, datafiles, and initialization parameters specified in the source database. User defined schemas and thier data will not be part of the created template.

  • How to get all INDEXes from a database

    How to get all INDEXes in a database? I need to store them in script file (.SQL). My database version is 10.2.0.3.0.
    Edited by: Iniyavan on Sep 18, 2009 1:39 PM

    --Thanks, Koppelaars. The second query works. But I'm unable to store in spool file. May be it's due to CLOBs in the output. I did the following:
    set head off
    set feedback off
    set linesize 32727
    set pagesize 50000
    spool c:\indexes.sql
    select dbms_metadata.get_ddl('INDEX',INDEX_NAME,'MYSCHEMA')
    from user_indexes;
    spool off
    --In the spool file, I find only this
    CREATE UNIQUE INDEX "MYSCHEMA"."A" ON "MYSCHEMA"."BNK_DEALID" ("DEAL_ID")
    PCTF
    CREATE INDEX "MYSCHEMA"."ACCENT_RAC_REPORT" ON "MYSCHEMA"."ACCENT" ("SCHEME", "VAL
    CREATE INDEX "MYSCHEMA"."ACCENT_REPORT" ON "MYSCHEMA"."ACCENT" ("SCHEME", "APP_REF
    CREATE UNIQUE INDEX "MYSCHEMA"."ACCENT_X" ON "MYSCHEMA"."ACCENT" ("DEAL_ID")
    P
    CREATE UNIQUE INDEX "MYSCHEMA"."ACCNAV_X" ON "MYSCHEMA"."ACCNAV" ("SCHEME", "ACCNA
    --How to get all the DMLs in one SQL file?
    --Nagappan, I'm using WIN.

  • How to get all data from nokia to i5s

    how to get all data from nokia E71 to i5s???

    if you can put those data in your computer then add it in iTunes. your iPhone 5s should get it thru syncing.

  • How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    If the data is on a remote server (for example, PHP running on a web server, talking to a MySQL server) then you do this in an AIR application the same way you would do it with any Flex application (or ajax application, if you're building your AIR app in HTML/JS).
    That's a broad answer, but in fact there are lots of ways to communicate between Flex and PHP. The most common and best in most cases is to use AMFPHP (http://amfphp.org/) or the new ZEND AMF support in the Zend Framework.
    This page is a good starting point for learning about Flex and PHP communication:
    http://www.adobe.com/devnet/flex/flex_php.html
    Also, in Flash Builder 4 they've added a lot of remote-data-connection functionality, including a lot that's designed for PHP. Take a look at the Flash Builder 4 public beta for more on that: http://labs.adobe.com/technologies/flashbuilder4/

  • Me and my partner are currently using the same apple id and have no space left on our devices. We are currently waiting on the iphone 6 plus to arrive and don't know how to transfer all data to the new phones.

    Me and my partner are currently using the same apple id and have no space left on our devices. We are currently waiting on the iphone 6 plus to arrive and don't know how to transfer all data to the new phones.?

    I don't know if I'm asking this all in a way that can be understood? Thanks ED3K, however that part I do understand (in the link you provided!)
    What I need to know is "how" I can separate or rather create another Apple ID for my son-who is currently using "my Apple ID?" If there is a way to let him keep "all" his info on his phone (eg-contacts, music, app's, etc.) without doing a "reset?') Somehow I need to go into his phone's setting-create a new Apple ID and possibly a new password so he can still use our combined iCloud & Itunes account?
    Also then letting me take back my Apple ID & password, but again allowing us (my son and I) to use the same iCloud & Itunes account? Does that make more sense??? I'm sincerely trying to get this cleared up once and for all----just need guidance from someone who has a true understanding of the whole Apple iCloud/Itunes system!
    Thanks again for "anyone" that can help me!!!

  • How to erase all data on macbook pro and reinstall operating system

    how to erase all data on macbook pro and reinstall operating system

    OS X Snow Leopard
    https://support.apple.com/en-us/HT3910
    http://www.thesafemac.com/how-to-reinstall-mac-os-x-from-scratch/
    OS X Yosemite
    https://support.apple.com/kb/PH18869?locale=en_US&viewlocale=en_US
    Best.

  • How can i get data from another database SQL Server use database link from

    I have a database link from Oracle connect to SQL Server database with user cdit connect default database NorthWind.How can I get data from another database(this database in this SQL Server use this database link)?

    hi,
    u should see following documentation:
    Oracle9i Heterogeneous Connectivity Administrator's Guide
    Release 1 (9.0.1)
    Part Number A88789_01
    in it u just go to chapter no. 4 (using the gateway),,u'll find ur answer there.
    regards
    umar

  • How to retrieve all datas that lost when i update my iphone4 to that 6.10 ios. i tried to look at may i tunes in my computer but it seems that i forgot to perform back ups since i purchased this phone 2yirs ago.. pls send me an advice..thank u.

    how to retrieve all datas that lost when i update my iphone4 to that 6.10 ios. i tried to look at may i tunes in my computer but it seems that i forgot to perform back ups since i purchased this phone 2yirs ago.. pls send me an advice..thank u.

    All of the data should be on your computer, simply sync it back.
    If the update was done via iTunes on the computer, the first step in the process is a backup of the device.

  • How to I convert data from oracle database into excel sheet

    how to I convert data from oracle database into excel sheet.
    I need to import columns and there datas from oracle database to microsoft excel sheet.
    Please let me know the different ways for doing this.
    Thanks.

    asktom.oracle.com has an excellent article on writing a PL/SQL procedure that dumps data to an Excel spreadsheet-- search for 'Excel' and it'll come up.
    You can also use your favorite connection protocol (ODBC, OLE DB, etc) to connect from Excel to Oracle and pull the data out that way.
    Justin

  • How to view all table of a database

    How to view all table of a database created on a oracle 9.2/10g database management system.
    How to view available tables of oracle dbms which comes by default with package.
    Thank you so much in advance!
    With Regards,
    Niks

    You posted the same question twice.
    How to view all table of a database

  • How to erase all datas and reset default

    How to erase all datas and factory reset in iMac

    Boot into the Recovery HD (restart holding down Command+r). Launch Disk Utility and erase the drive (all data will be gone forever so make sure you have a reliable copy of any valuable data). Quit out of Disk Utility when formatting is complete and select re-install OS X (you'll need an Internet connection).
    Fuller details here: http://support.apple.com/kb/ph11273

  • How to drop all scheduled jobs

    Hi,
    in 8i, how to drop all oracle scheduled jobs ?
    Many thanks before.

    SELECT job FROM user_jobs;
    exec dbms_job.remove(23);
    To remove all jobs, you can write a pl/sql block to loop through all jobs and remove them.
    http://www.psoug.org/reference/dbms_job.html
    Aalap Sharma :)

  • How to save the data on the database

    Please tells me how to save the data on the database as soon as posible.
    Thank!!
    Michael

    Michael,
    What database? Citadel, or something that has an SQL?
    If the latter, use the SQL toolkit. You can get it from NI.
    Please elaborate if this is not your situation.
    Thank you

  • How to download all data (music.contacts,apps) from iPhone to a new PC ?

    How to download all data (music.contacts,apps) from iPhone to a new PC ?
    I mean to say that I downloaded mp3 songs from websites (not from iTunes) which I synced in my iPhone 4 using ''Manaually Manage Music''.
    Now I am in my homecountry for vacations and don't have the laptop in which my iTune library is synced and I need to add more songs to my iPhone but when I put more songs to my iPhone it tells me that all current data from iPhone will be deleted.
    Please help!

    The iphone is not a backup device.  The music sync is one way - computer to iphone.  The only exception is itunes purchases.  Without syncing:  File>Transfer Purchases.
    " I need to add more songs to my iPhone but when I put more songs to my iPhone it tells me that all current data from iPhone will be deleted."
    That is correct.

Maybe you are looking for

  • X86 via patchsvr, "Failed to validate the digital signature(s)"

    Been running very well for a while, now I'm getting these errors after an smpatch update/ bash-3.00# smpatch update com.sun.patchpro.util.Percentage@96b5c2 119146-05 has been validated. com.sun.patchpro.util.Percentage@5db5ae 119253-05 has been valid

  • Flushing & Cathicng Exceptions

    Hello ABAP-Experts, I have a problem in understanding how to catch exceptions after calling method cl_gui_cfw=>flush. Why calling "flush": Well, otherwise if there is no FLUSH after directory_create (for example) is called, the value of rc (methods i

  • FI-CA SD billing generated Reconciliation Key Correction

    Hello Friends: I would appreciate your pointers on the following situation: - SD Billing generated recon key has been closed - GL trf for this key is failing, reason being a wrong profit center got defaulted for a billing document for a revenue accou

  • Start oc4j

    Dear Friends, I have installed Oracle 9iDS. When i try to run the batch file startinst.bat in <<ORACLE-HOME>>/j2ee/Oracle9iDS/startinst.bat i get the following error. I m puzzled of the same.. i m stuck up with the problem for the past 2 days.. kindl

  • Visual Composer Export to Excel/PDF..

    Hello all, I have a question regarding using Visual Composer's Web API commands to export to excel/pdf etc. I've read the document "How to Export Data from Visual Composer" (https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/47fe4fef