Requirement is that I need to clean up my database in which my application has extensively tested on, and now I will have to clean up the data and have a database which will be ready to go live. By clean up, I mean the metadata of the tables, users will stay but their data will have to cleaned. What is the fastest and the best method to go about with? Truncate? Any help would be appreciated.

  • I'm not sure that I understand what "By clean up, I mean the metadata of the tables" means. Perhaps you mean that you want to retain the metadata but remove all the data? From every table? Or just some tables (it seems likely that you'd need some tables to remain populated). I'm not sure why you would test on a production database. But presumably you can just do a fresh install of your application which will, presumably, install whatever lookup data you need. – Justin Cave Sep 22 '15 at 20:22

Unless you have a storage snapshot, restore point or backup of the database before the testing started, TRUNCATE is a way to go. You may need to disable FK constraints for that. Another way is to run expdp with CONTENT=METADATA_ONLY, drop the schema, and import the metadata back.

| improve this answer | |
  • May i know why i need to disable fk constraints before export – tesla747 Sep 23 '15 at 2:30
  • @tesla747 Not before export. Before truncate. – Balazs Papp Sep 23 '15 at 6:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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