Conditions for Using the COPY Statement - TARA/ABU

Teradata Archive/Recovery Utility Reference

Product
TARA/ABU
Release Number
15.00
Language
English (United States)
Last Update
2018-09-25
dita:id
B035-2412
lifecycle
previous
Product Category
Teradata Tools and Utilities

Conditions for Using the COPY Statement

A COPY statement allows the creation of objects and giving them different names. In database‑level copy operations, the statement allows copying to a database with a different name.

To use the COPY statement, these conditions must be met:

  • Restore access privileges on the target database or table are required.
  • A target database must exist to copy a database or an individual object.
  • When copying a single table that does not exist on the target system, you must have CREATE TABLE and RESTORE database access privileges for the target database.
  • If the archived database contains a journal table that needs to be copied, the target database must also have a journal table.
  • Copying Database DBC

    Do not use database DBC as the target database name in a COPY statement. Using DBC as the source database in a COPY FROM statement is allowed, but specifying a target database name that is different than DBC is required. This allows DBC to be copied from a source system to a different database on a target system. When used as the source database in a COPY FROM statement, database DBC is not linked to database SYSUDTLIB. Therefore, only database DBC is copied.

    Copying Database SYSUDTLIB

    Do not use database SYSUDTLIB as the target database name in a COPY statement. Using SYSUDTLIB as the source database in a COPY FROM statement is allowed, but specifying a target database name that is different than SYSUDTLIB is required. This allows SYSUDTLIB to be copied from a source system to a different database on a target system. When used as the source database in a COPY FROM statement, database SYSUDTLIB is not linked to database DBC. Therefore, only database SYSUDTLIB is copied.

    Copying Data Table Archives

    Always copy data tables before copying any associated journal tables. When a data table is copied to a new environment, Teradata ARC creates a new table or replaces an existing table on the target Teradata Database. COPY only replaces existing permanent journal tables; it cannot create permanent journal tables. For data table archives, note the following:

  • If the target database does not have tables with the intended names, the copy operation creates them.
  • If the target database has tables with the intended names, they are replaced by the archived table data. The existing table data and table definition are replaced by the data from the archive.
  • When copying data tables, these operations are allowed:

  • Disabling journaling
  • Specifying a journal table in a database different from the database that is receiving the table
  • Changing a fallback table to a nonfallback table
  • Copying Selected Partitions

    Copying selected partitions in a PPI table works the same way as restoring selected partitions. For more information, see “Restoring Selected Partitions” on page 56.

    HUT Locks in Copy Operations

    Copy operations apply exclusive utility (HUT) locks on the object to be copied. Therefore, if a full database is copied from a complete database archive, Teradata ARC locks the entire database. Similarly, if a single table is copied from a table-level archive, Teradata ARC locks that table (but only that table). To copy selected partitions, Teradata ARC applies a HUT write lock.

    When an SQL-UDF is copied, the corresponding DBC.DBASE row is locked with a write hash lock. This prevents the user from doing any DDL on that database for the duration of the copy operation.

    Copying Large Objects (LOBs)

    Teradata ARC supports copying tables that contain large object columns as long as the database systems are enabled for large object support and the copy is not for selected partitions. Starting with Teradata ARC 14.00, large object columns can be copied to a system that uses a hash function that is different from the one used for the archive. To copy an archive of selected partitions of LOBs, perform a full-table copy.

    Copying System Join Indexes (SJIs)

    Teradata ARC now supports copying System Join Indexes (SJIs) to a different database. This feature requires logic in both ARC and the DBS. This logic is integrated in the 15.00 versions (and higher) of both products so that no additional changes need to be made to use the feature when those versions are used. Any time that an earlier version of either product is used, the logic to copy SJIs to a different database must be enabled on both sides. If the logic is not enabled on either side, the SJIs will not be copied to its intended target database. Both sets of changes must be enabled during both the ARCHIVE step and the COPY FROM step.

    The ARC changes have also been released into ARC 14.10 (but not to earlier ARC releases) and must be enabled by specifying the COPYSJI runtime parameter. The DBS changes have also been released into versions 14.0 and 14.10 and must be enabled by setting the general DBSControl flag #361 (DumpSJIWithoutDBName) to TRUE.