Bulk Copy Data Using the ttBulkCp Utility
The ttBulkCp
utility enables you to copy data between TimesTen
tables and ASCII files.
You can manage certain aspects of existing tables in the database with the ttBulkCp
utility. With the ttBulkCp
utility, you can add rows of data to an existing table, save data to an ASCII file, and load the data rows into a table in a TimesTen database.
The rows you are adding must contain the same number of columns as the table, and the data in each column must be of the type defined for that column.
Because the ttBulkCp
utility works on data stored in ASCII files, you can also use this utility to import data from other applications, provided the number of columns and data types are compatible with those in the table in the TimesTen database and that the file found is compatible with ttBulkCp
.
Copying Data from a TimesTen Table to an ASCII File
Run the ttBulkCp
utility with the -o
option to copy
data from a TimesTen table to an ASCII file.
Note:
Ensure that your TimesTen user has SELECT
privilege on the tables it copies information from.
This example copies the data from the hr.employees
table of the database1
database to the employees.dmp
file using the ttBulkCp -o
mode.
ttBulkCp -o -connstr "DSN=database1;UID=HR;PWD=hr" hr.employees > employees.dmp
See ttBulkCp in the Oracle TimesTen In-Memory Database Reference.
Copying Data from an ASCII File into a TimesTen Table
The ttBulkCp
utility enables you to copy data from an ASCII file
into a database table. The ttBulkCp
utility does not copy duplicate rows
into a table.
Running ttBulkCp with the -i Option
The ttBulkCp
utility with the -i
option enables you
to load data from a file.
This option uses standard INSERT
SQL statements to load
data into a specific table of a TimesTen database.
On TimesTen Scaleout, the ttBulkCp
utility inserts each row into its
corresponding element based on the distribution scheme of the table. For TimesTen
Scaleout, you can populate a table from a single location or from several locations. See
Bulk Loading
Data into a Database in Oracle TimesTen In-Memory Database Scaleout User's
Guide.
Note:
Ensure that your TimesTen user has INSERT
privilege on the tables it copies information into.
This example copies the data from the employees.dmp
file into the hr.employees
table of the database1
database using the ttBulkCp -i
mode.
% ttBulkCp -i -connstr "DSN=database1;UID=HR;PWD=hr" hr.employees employees.dmp employees.dmp: 107 rows inserted 0 duplicate rows not inserted 107 rows total
See ttBulkCp in Oracle TimesTen In-Memory Database Reference.
Running ttBulkCp with the -directLoad Option on TimesTen Classic
Run the ttBulkCp
utility with the -directLoad
option to copy data from an ASCII file into a TimesTen Classic database table.
The -directLoad
option loads data with standard
INSERT
SQL statements. The ttBulkCp -directLoad
option can only be used by applications using direct connections, which avoids some of
the overhead required when using client/server connections resulting in better
performance than the -i
option.
For improved performance, consider dropping indexes before loading data with the
-directLoad
option. Use the ttSchema
utility to
view the definition of all the indexes that are created on the tables of a TimesTen
Classic database. Once the load operation is complete, manually re-create the indexes on
your table. See ttSchema in the Oracle TimesTen In-Memory Database
Reference.
Note:
Ensure that your TimesTen user has INSERT
privilege on the tables it copies information into.
This example copies the data from the employees.dmp
file into the hr.employees
table of the database1
database using the ttBulkCp -directLoad
option.
% ttBulkCp -directLoad -connstr "DSN=database1;UID=HR;PWD=hr" hr.employees employees.dmp employees.dmp: 107 rows inserted 0 duplicate rows not inserted 107 rows total
See ttBulkCp in the Oracle TimesTen In-Memory Database Reference.