UNLOAD - Advanced SQL Engine - Teradata Database

Database Utilities

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
xha1591998860283.ditamap
dita:ditavalPath
xha1591998860283.ditaval
dita:id
B035-1102
lifecycle
previous
Product Category
Teradata Vantage™

The UNLOAD command moves dump data from a system-generated table on the database to a file on a host or directly to removable media.

Syntax

UNLOAD [ database. ] table FILE = filepath [ f ] ;

Syntax Elements

database
The name of the database in which the table resides and the separator between the database name and table name. Use a period (.) to separate the database name from the table name.

The default database is crashdumps.

table
The name of the table that contains the dump data.
filepath
The path of the file into which the dump data is unloaded.

filepath is specified as directory/filename.

Dul saves files in a compressed, gzip format, and appends a file extension of .gz to the file name automatically, if the specified name does not include .gz.
f
An option for unloading dumps from a foreign database.

Usage Notes

Before you can perform a dump/unload operation, you must have the following privileges:
  • CREATE, DROP, and SELECT on the tables in the crashdumps database
  • SELECT on the DBC.SW_EVENT_LOG system table

The UNLOAD command selects dump data according to the selection criteria specified in a previous SELECT command. If you do not specify a SELECT command, the entire dump table is searched. You should always type a SELECT command before an UNLOAD command.

Before you perform an unload operation, dul displays summary information, such as which processors are selected and error dates about the selection criteria that is set. After the load operation, dul displays event codes, if any exist, for the specified processors. For information on setting selection criteria, see SELECT.

In moving dump data, the _C, _L, and _M files are always included. If the _C or _L table is not found, it is generated.

If you load the unloaded data back into some other Teradata system, the table created by the LOAD command is called dump data in a foreign database and will be one of the following tables:
  • tname_C
  • tname_L
  • tname_M

When you enter the UNLOAD command without the F option, dul unloads the data specified in tname from the DBC.SW_EVENT_LOG table.

The F option is required to unload the dump data from the foreign database. Dul unloads data from the table specified in the UNLOAD command and the corresponding tname_C, tname_L, and tname_M tables.

Dul uses the FastExport utility to improve transfer speed for unloading dumps. However, you can still unload dumps using BTEQ.

To use the UNLOAD command, you must have CREATE, DROP, and SELECT privileges on the following:
  • Dump table (Crashdumps.Crash_YYYYMMDD_HHMMSS_NN)
  • System table DBC.SW_EVENT_LOG

For more information about the FastExport utility, see Teradata® FastExport Reference, B035-2410.

For information about BTEQ, see Basic Teradata® Query Reference, B035-2414.

For additional information on access privileges, see Teradata Vantage™ - Database Administration, B035-1093.

Example: Unloading dump data from Vantage tables

The following example assumes that a system failure occurred on 6/6/00 at 2:36 p.m. To confirm that a dump table has been created, you would examine the crashdumps databases using the following command:

HELP DATABASE crashdumps ;

Since dump tables are named according to the date and time that the system failure occurred, you should be able to find the correct dump table. In this example, the table named crash_200000606_143623_01 contains the dump information.

To display the contents of the dump table, use the SEE command:

SEE crash_20000606_143623_01 ;

The SEE command displays summary information about all of the processors and error codes that were captured in the dump. Some of the processors might not contain any information. Generally, only processors that contain errors are needed for an unload operation.

By typing a SELECT command next, you can choose the processors for the unload operation. To select only the processors that contain error codes, type the following command:

SELECT ERROR ;

Dul responds with this message:

*** Processor selection set to list of processors.

Now you are ready to unload the dump data from table crash_20000606_143623_01 on the crashdumps database onto your host using the following command:

UNLOAD crash_20000606_143623_01 file=filepath;

Dul responds with these messages:

*** Unloading data from crash_20000606_143623_01 for processor(s) 1-6.
*** Query completed. 263 rows found. 3 columns returned.

*** Processor 1-6

*** Number of rows = 263
*** Unloading Procedure Information
*** Query completed. 200 rows found. 4 columns returned.
*** Number of rows = 200

*** Unloading Errorlog Information
*** Query completed. 413 rows found. 6 columns returned.
*** Number of rows = 413

*** Unloading Memo Information
*** Query completed. 123 rows found. 5 columns returned.
*** Number of rows = 123

   Event = 2490:

On 6/6/96 at 09:26:27 in processor 1-6, partition 14,
task SEMTSK.

   Severity = UserError
   Category = User
   HostEvent = None

*** Number of rows = 263
If the dump data is copied to the local hard disk on your host, you must copy the data to a removable medium for shipment.