dbidumper.pl - Man Page

dump database to delimited file

Synopsis

        dbidumper [OPTION]...

        << meanwhile in your control file >>
        OPTIONS (export=100,rows=100)
        EXPORT DATA REPLACE INTO FILE 'test.dat'
        FIELDS TERMINATED BY TAB ENCLOSED BY '"' AND '"'
        WITH HEADER FROM
        SELECT * FROM MY_TABLE

Description

Dumps data from a select statement into an output file. dbidumper tries to mirror the functionality and behavior of sql*loader. The control file syntax is similar, and dbidumper utilizes a subset of the sql*loader options. Options can also be specified in the control file. The command line versions take precedence.

userid=username/password@sid

Login information for database connection.

Note: For security reasons, it is customary to place this option inside the control file.

If the sid includes a colon, the full string will be used as the DBI dsn. For example:

        userid=username/password@mysql:database

Will connect to mysql's 'database' database as username.

If the environment variable ORACLE_SID is available, it will be used if not specified here.

control=filename

Input control filename. Defaults to standard input. See "Control File" for layout and description.

output=filename

Output filename for data. Defaults to standard output. If rows is given, can contain template consisting of three or more Xs. The Xs will be replaced with the file sequence number. If the template does not contain three or more Xs, the sequence number will be appended to the filename with a dot. Examples:

rows=1000 output=outputXXXXX.dat

Data will be written to output00001.dat, output00002.dat, etc.

rows=1000 output=output.dat

Data will be written to output.dat.0001, output.dat.0002, etc.

output=outputXXXXX.dat

Data will be written to outputXXXXX.dat

rows=n

Number of rows per output file. Defaults to all rows in one output file.

export=n

Total number of rows to export. Use to limit output or restart dump.

skip=n

Number of rows to skip from beginning. File sequence number will be preserved, so if rows=n is set, this can be used to restart a job.

writesize=n

Block size to write file. Defaults to write each record as returned from database. If set, dbidumper will collect rows into a buffer at most n bytes large before writing to file.

silent=true

Suppress normal logging information. dbidumper will only report errors.

Dependencies

This program depends on the following perl modules, available from a CPAN mirror near you:

Parse::RecDescent - Recursive parser

DBI - Standard database interface

Control File

The control file used for dbidumper is very similar to sql*loader's. The full specification is:

        [ OPTIONS ([option], ...) ]
        EXPORT DATA [ REPLACE | APPEND ] [ INTO FILE 'filename' ]
        [ FIELDS
                [ TERMINATED [BY] {TAB | 'string' | X'hexstring'} ] |
                [ ENCLOSED [BY] {'string' | X'hexstring'} 
                        [AND] ['string' | X'hexstring'] ]
        ]
        [ WITH HEADER ]
        FROM
        select_statement

Author

Written by Warren Smith (warren.smith@acxiom.com)

Bugs

None yet.

Info

2024-07-18 perl v5.40.0 User Contributed Perl Documentation