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

From: Matthias Hoys <anti_at_spam.com>
Date: Tue, 30 Nov 2010 20:59:58 +0100
Message-ID: <4cf5570c$0$14253$ba620e4c_at_news.skynet.be>


"syd_p" <sydneypuente_at_yahoo.com> wrote in message news: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

Replace "SHOW tables" by "SELECT table_name FROM user_tables"?

Matthias Received on Tue Nov 30 2010 - 13:59:58 CST

Original text of this message