Oracle to CSV
Latest version 2.1 released 10/16/2017
Oracle-to-CSV is a free program to export Oracle data into comma
separated values (CSV) files. The program has high performance due to
direct connection to source databases and writing into .csv files (it
does not use ODBC or any other middleware software). Command line support
allows to script, automate and schedule the conversion process.
To perform batch conversion or call the conversion procedure from an automation script you can use console version of Oracle-to-CSV O2CAGENT.EXE. Find this file in Oracle-to-CSV installation folder. You can either run this tool directly from command line or call it from any script as well. The program supports the following command-line options:
|--dest=...||path to the folder with .csv files|
|--help||display help message and exit|
|--host=...||Oracle server IP address or network name|
|--inc_fnames||include Oracle field names into CSV files|
|--logfile=...||path to the log file where execution traces will be written|
|--mode=...||how to process an existing CSV folder (0 - overwrite the entire folder, 1 - overwrite existing files only, 2 - skip existing files)|
|--n_delim=...||delimiter symbol to use in the resulting CSV file (0 - tab, 1 - semicolon, 2 - comma)|
|--profile=...||path to the file to load conversion settings from|
|--pswd=...||Oracle user password|
|--silent||use this option to disable program output|
|--src=...||Oracl3 database name|
|--tab_file=...||file containing the list of tables to convert
(one table name per line)
|--user=...||Oracle user name|
In the following example the program converts Oracle database "db1" on the remote Oracle server "oraclehost" into .csv files in folder "c:\from oracle" using table names file "c:\tabfile1.txt":
O2CAGENT.EXE --src=db1 --dest="c:\from oracle" --host=oraclehost --user=SYSTEM --pswd=the_passsword --tab_file=c:\tabfile1.txt
Table names file should be formatted as follows:
Queries give you the ability to extract partial data for converting into .csv format. The following examples are provided to illustrate how to use queries for particular purposes. Assume that we have table "Table1" as below:
Table1( ID INT NOT NULL AUTO_INCREMENT, FName NVARCHAR(50), LName NVARCHAR(50), Birthday DATE, Notes CLOB );
Example 1. Convert certain records.
SELECT * FROM Table1 WHERE ID > 1000
Example 2. Choose and rename columns.
SELECT FName as FirstName, LName as LastName FROM Table1
Example 3. Skip records containing NULL values.
SELECT * FROM Table1 WHERE Notes IS NOT NULL