I’m looking for a Unix shell script that will truncate all tables in a schema. A similar question was already asked, but I have some additional requirements which makes none of the provided answers satisfactory:
- Must be a Unix shell script (i.e. no python, perl, PHP)
- The script must truncate the tables in an order which respects foreign key constraints
- I’d prefer not to have to use a stored proc
Thanks in advance, Don
How about something cheeky like this:
Gets a dump of the schema and replays it into the database!
Alternatively, check out mk-find in Maatkit, you should be able to do something like this:
Description of mk-find: