I have to migrate from MS SQL Server and now creating a new ORACLE database with the data partially got from my old tables.

For that I need to get the data from dozens of tables as unicode CSV or TXT files, with fields separated by "|".

The bad thing is the default export master of MS SQL Server can export only single table at a time, and it takes a considerable time to configure export options for each table. I started to export them manually but I got an attack of nerves at the 10th table.

Do you know the way how to export ALL the tables into csv or txt from SQL server?


A more robust solution is to use the Oracle Migration Workbench. This used to be a separate utility from Oracle, but is now included in Oracle SQL Developer . If you and CLOB/BLOB data types then this is the way to go. You should also read the Oracle documentation on how to migrate as the SQL Developer migration interface is not very intuitive.

If you do want to go down the road of exporting all tables to csv you can use BCP or SSIS. There is a very good article on simple-talk on using some t-sql and to generate bcp export commands for all tables in a database. You can also create simple SSIS package to export all the tables to csv by using a flat file destination task.

here's something quick & dirty that will generate the BCP commands for you. Run it in SSMS, the run the output at the command prompt.

            USE AdventureWorks
SELECT 'bcp ' +
            + '.'
            + '.'
            + ' '+'out'+' '
            + name + '.csv -w -t"|" -E -S '
            + @@servername
            + ' -T'
    FROM sys.objects
    WHERE TYPE='u'
        AND is_ms_shipped=0

If you have access to SQL Management Studio (I believe even the free express version has the feature as well), you can right click on the data base and choose Tasks -> Export Data. As your destination, select the 'Flat File' destination and you can tweak the format (Fixed width, csv, etc).

  • 1
    I can't export all my tables this way, only 1 by 1. I have to pass "Tasks -> Export Data -> ... -> Flat file -> settings -> select single table for export" for each table. It's too damn big database, I need a bit faster solution. – Andrew Dec 8 '10 at 19:09

There is a tool called Oracle Migration Workbench that you can get from Oracle that is designed for exactly what you want. This tool can take entire schemas including users and migrate them from MS Sql to Oracle.

I have used it heaps of times and it is excellent.

Here is some more info http://download.oracle.com/docs/html/B10259_01/toc.htm



You can try dbForge Studio for SQL Server and Oracle for this purpose. Start page, Menu "Database", then Export Data, next choose "CSV" in the wizard and other options for your database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.