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

From: Mark D Powell <Mark.Powell2_at_hp.com>
Date: Wed, 1 Dec 2010 06:52:26 -0800 (PST)
Message-ID: <5466ce8e-2c21-4007-960b-f7e8e81b2d2a_at_i18g2000yqn.googlegroups.com>



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 -- Received on Wed Dec 01 2010 - 08:52:26 CST

Original text of this message