The COPY statement copies a database or table from an archived file to the same or different Teradata Database from which it was archived.
Use COPY to move data from an archived file back to the Teradata Database. The target database must exist on the target Teradata Database, however COPY creates a new table if it does not already exist on the target database. If a copy of selected partitions is requested, the target table must exist on the target Teradata Database.
COPY between the same database version is supported. COPY from an older database version to a newer database version is supported. COPY of a newer database version back to an older database version is not supported.
Note: Beginning with TTU 13.00.00, there is support for copying all objects as individual objects. Triggers cannot be copied. For a complete list of objects supported by Teradata ARC, see “Appendix A Database Objects” on page 265.
where:
Syntax Element |
Description |
DATA TABLE or DATA TABLES |
Copies data tables. |
DICTIONARY TABLE or DICTIONARY TABLES |
Copies dictionary tables. |
JOURNAL TABLE or JOURNAL TABLES |
Copies journal tables. |
NO FALLBACK TABLE or NO FALLBACK TABLES |
Copies non-fallback tables to specific AMPs. |
ALL FROM ARCHIVE |
Copies all databases/tables in the given archive file |
EXCLUDE |
Prevents specified databases from being copied |
(dbname) |
Name of database to exclude from copy |
ALL |
Excludes the named database and all descendants |
(xdbname1) TO (xdbname2) |
Alphabetical list of client databases to exclude from the copy The delimiting database names need not identify actual databases. Database DBC is not part of a range. |
(dbname) or (dbname.tablename) |
Name of the target object Teradata ARC replaces the target object with the object from the archive. |
FROM |
Name of the source object when copying to a different location or name on the target system |
NO FALLBACK |
Copies fallback tables into non-fallback tables If the archived table is already non-fallback, this option has no effect. |
REPLACE CREATOR |
Replaces the LastAlterUID, creator name, and Creator ID of the tables in the target database with the user ID and the current user name, i.e., the user name specified in the LOGON command |
NO JOURNAL |
Copies all tables with journaling disabled, whether journaled in the archive or not |
WITH JOURNAL TABLE |
Specifies that a copied database has journaling for the specified database and journal table |
APPLY TO |
Identifies the tables in the target system where the change images apply |
NO BUILD |
Prevents the Fallback and Secondary Index rows from being created If NO BUILD is requested when restoring database DBC, the request is ignored. If the NO BUILD keywords are used during a RESTORE statement, a separate BUILD statement must be run for all databases and/or tables that were restored. The tables will not be accessible until a BUILD statement is run. |
ABORT |
Aborts the copy operation if an AMP to which a non-fallback or journal table to restore is offline This option affects only an all-AMPs copy. |
RELEASE LOCK |
Releases client utility locks when the copy operation completes |
FILE |
Copies a file |
name |
Name of the file that contains the archive to copy |
EXCLUDE TABLE or EXCLUDE TABLES |
Prevents individual objects in the listed database from being copied For a list of individual object types that can be specified in the EXCLUDE TABLES clause for Copy, see Appendix C. |
(xtablename) |
Name of an individual object in the designated database to exclude Multiple objects are separated by commas. This form, without a database name prefix, is used only when ALL has not been specified for the current object. |
(xdbname.xtablename) |
List of fully qualified objects (prefixed by database name) to exclude |
PARTITIONS WHERE |
Specifies the conditional expression for partition-level operations |
(!conditional expression!) |
The conditional expression for specifying selected partitions |
LOG WHERE |
Specifies the rows that are logged to an error table for manual insertion and deletion |
(!conditional expression!) |
The conditional expression for specifying rows to log to the error table when copying selected partitions |
ALL PARTITIONS |
Restores all archived partitions for an archived PPI object See “ALL PARTITIONS Keyword” on page 206 for conditions that must be met. |
QUALIFIED PARTITIONS |
Copies the same partitions specified in a previous selected-partition copy |
ERRORDB and ERRORTABLES |
Specifies the location of the error log for partition-level operations |
SKIP JOIN INDEX |
Skip the creation of join and hash indexes |
SKIP STAT COLLECTION |
Skip the copy of Stat Collections |