Quantcast
Channel: Data Warehousing (DWH) Wiki » CSV
Viewing all articles
Browse latest Browse all 5

Export All Tables of a DB2 Database

$
0
0

The availability of historical data is an important prerequisite of successful data warehouse projects. This article describes how to archive data from operational DB2 databases on a frequent schedule, e.g., daily. This article uses EMS Data Export for DB2 to export the data.

EMS Data Export for DB2 is a powerful program to export your data quickly from DB2 databases to any of 19 available formats, including MS Access, MS Excel, MS Word (RTF), HTML, XML, PDF, TXT, CSV, DBF, ODF and others. Data Export for DB2 includes a wizard, which allows you to set export options for each table visually (destination filename, exported fields, data formats, and much more) and a command line utility to export data from tables and queries in one-touch.

Welcome Page

After starting the application, the wizard presents the following welcome screen:

Select Next to start the export process.

Set DB2 Server Connection Options

The first step is to connect to the DB2 instance where the database is located:

After setting up your user name, password and the database alias, select Next to continue.

Select Tables for Data Export

This page allows you to select the tables to be exported:

In addition, you have to provide the output directory, where the generated files will be stored. Hit the Next button to continue.

Create Queries for Data Export

In addition to the tables selected in the previous dialog, you can also provide custom queries, for example to add normalized files, often a requirement in data warehousing:

After setting up your queries, select the Next button to continue.

Specify Output Data Format to Export

After setting up your tables and queries as data sources, you can now define the output format of the data:

The following file formats are available:

For best interoperability with ETL tools, select the CSV file format and check Apply to all exported objects. Select Next to continue.

Select Fields to Export and Set Order of Exported Fields

For each table (and query), you can define which columns should be exported using the next dialog:

Best practice is to select the option Export all fields of all tables and hit the Next button.

Set Export Options for the Selected Objects

Each file format has specific export options which can be configured in the following dialog:

For CSV files, you should check Quote Strings and set a quote character and comma separator. Do not specify a header or footer.

Hit Next to continue.

Set Base Formats of Data Types

This dialog allows you to specify the output format for various data types, such as dates and times:

Leave the default options and select the Next button.

Set Export Final Options

This dialog allows you to limit the number of records to be exported:

As a general practice, you should select the Export all records option.

If you want to schedule the export, use the Tools / Save Template menu item (next to the help button on the bottom left of the screen) to save the settings. You can use the command line tool for scheduling the export using the Windows Scheduler.

Hit the Next button to continue.

Export Progress

When you hit the Export button in the last dialog, the export starts and the progress is shown in the following dialog:

Export Log

After the export has finished, you can save the export log with the Save button:

For buying this tool, check out the EMS web site for the product. You should also check out EMS SQL Manager for DB2 if you’re frequently working with DB2 databases, for example for developing or other tasks, such as creating tables or stored procedures.

If you like this how to document or have an idea for improvement, please leave a comment below.


Viewing all articles
Browse latest Browse all 5

Trending Articles