SAND CDBMS Tools Reference Guide
Data Loader (ndlm)

 

Previous Topic:
Verifying and Filtering Data Using the PIC Clause
Chapter Index
Next Topic:
Importing Data from a CSV File

 

Importing Data from an SCT File


SCT Import Overview

When the SCTIMPORT keyword appears at the beginning of the specification script, ndlm uncompresses and loads the data stored in an existing SCT File into the specified database. To receive the data, the database must contain a table structure that corresponds to the one in the SCT File.

Unlike a standard import operation, the data from the SCT File cannot be filtered or otherwise manipulated at load time. All or none of the data in the SCT File is copied to the database.


Creating an SCTIMPORT Specification Script

The SCTIMPORT script has the following format:

SCTIMPORT @SCT-path
{
TABLE:[schema-name.]Table-name
}

SCTIMPORT
Instructs ndlm to perform an SCT import operation. Make sure a space character separates the SCTIMPORT keyword and the @ symbol.

@SCT-path
Identifies the SCT File containing the data that will be imported. Include the full path specification if the file is not located in the current directory. The path and file name cannot exceed 260 characters, and must be prefixed by the "at" symbol ( @ ). Note that if the path contains any spaces, it must be enclosed in double quotation marks: "<path with spaces>".

Multiple SCT Files (up to a maximum of 16,384) can be specified for a single SCTIMPORT operation. The table structure in each SCT File must be identical. Each file name is preceded by the "at" sign ( @ ), and separated from the other file specifications by one or more spaces, or by a line feed character. Note that when a specified input file is not found by ndlm, processing continues with the next specified file that is present.

Wildcard characters may also be used in the input file name specification: '?' represents a single variable character in the file name; '*' represents zero or more variable characters in the file name. All SCT Files with names corresponding to the file name mask will be used for the import (up to the maximum of 16,384 files). For example, including the following at the beginning of the specification file:

SCTIMPORT @*sample?.sct

instructs ndlm to load data from all SCT Files in the execution directory that have in their name the substring 'sample' followed by any single character, a dot (.), and the 'sct' extension.

This file name mask will load data from these files:

but not from these files:

A note about 8.3 file names and wildcards:
Windows server 8.3 file name creation should be disabled if wildcards are used to reference files in loader scripts. When 8.3 file name creation is turned on, the "?" wildcard character is treated as a "*" by the operating system. To avoid unexpected loader results from this Windows feature, disable 8.3 file name creation through the Windows registry. This can be accomplished by changing the value of the following registry entry to 1 (from the default 0).

HKLM\system\CurrentControlSet\Control\FileSystem\NtfsDisable8dot3NameCreation

Note that files created on or transferred to the Windows server while 8.3 file name creation was enabled are still susceptible to this wildcard issue, even after 8.3 file name creation is turned off. One way to correct this problem is to rename each relevant file that has an 8.3 file name, then change each file back to its original name.


TABLE:[schema-name.]Table-name

The TABLE parameter specifies the destination table in the database, optionally preceded by the name of the schema to which the table belongs. If schema-name is absent, the table will be assumed to exist in the schema recorded in the SCT File. If the SCT File does not store a schema name, the destination table will be assumed to reside in the user’s default schema. A specified schema-name will override the schema stored in the SCT File.


Executing the SCT Import Operation

To load data from an SCT File into an existing database:

  1. Start an instance of the database that will receive the SCT data. The table in the source SCT File must have a matching table in the database. Ensure that the corresponding column domains/data types are the same before attempting this load operation.
  2. Create a load specification file that describes an SCTIMPORT operation. For example:

SCTIMPORT @C:\Public\sct\x1.sct
{
TABLE:s2.x1tab
}

  1. Execute the load operation in Parallel Loader mode, enabled by including the -k flag in the ndlm invocation. The full syntax is the following:

ndlm -b -k n connection-name instance-name user-name[/user-password] spec-file-name


When the load operation concludes, the destination table will contain the same data as the source SCT.

 

Previous Topic:
Verifying and Filtering Data Using the PIC Clause
Chapter Index
Next Topic:
Importing Data from a CSV File