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

From: syd_p <sydneypuente_at_yahoo.com>
Date: Wed, 1 Dec 2010 10:42:49 -0800 (PST)
Message-ID: <06baab79-3aa0-41e6-b2b5-c276f2d3f2a3_at_n10g2000yqd.googlegroups.com>



On 1 Des, 15:52, Mark D Powell <Mark.Powe..._at_hp.com> wrote:
> On Nov 30, 7:45 am, syd_p <sydneypue..._at_yahoo.com> wrote:
>
>
>
> > 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
>
> How do I export a database table to a flat file ?
>
>        http://www.jlcomp.demon.co.uk/faq/flatfile.html
>
> HTH -- Mark D Powell --

Actually the question is how to export all the tables in a database to a flat file per table Received on Wed Dec 01 2010 - 12:42:49 CST

Original text of this message