linux/unix script to dump csv files for each table in db

From: syd_p <sydneypuente_at_yahoo.com>
Date: Tue, 30 Nov 2010 04:45:09 -0800 (PST)
Message-ID: <605c3e29-769b-47ae-aa2d-1fa7135595f9_at_p1g2000yqm.googlegroups.com>



Hi,

I am using a very simple script to dump out some csv files from all the tables in a mysql db.
Well actually they are psv files cos they are separted by a pipe symbol.

But anyway I want to do the same thing with oracle 10G. Any ideas on how to do this?
Please help if you can!

-Syd

#!/bin/bash

db=nb276
user=root
pass=xxxx

for table in $(mysql -u$user -p$pass $db -Be "SHOW tables" | sed 1d); do \
 echo "exporting $table.."
 mysql $db -u$user -p$pass -e "SELECT * FROM $table" | sed 's/\t/|/g'
> $db.$table.psv

done Received on Tue Nov 30 2010 - 06:45:09 CST

Original text of this message