Wednesday, February 8, 2017

Copy Objects Scripts using ARCMAIN utility in Teradata


Note that "Copy Objects" in Teradata Administrator only copies the definition.

(In effect does SHOW on one system and submits the resulting DDL on the other).

 It does not copy the data. There are many possible ways to move the data,including via ARCHIVE and COPY with the Teradata ARC utility.

 If u have access to unix command prompt then....invoke arcmain. --Command-line

Invocation of Teradata ARC from Solaris, MPRAS,HP-UX, and AIX:

arcmain outlog=arcall.out

--The above command line calls the ARCMAIN executable.

--The default is archive to disk if no IOMODULE or IOPARM are specified.

The input file named arcall.

In contains ARCMAIN commands.

The “<“ redirects the input file to ARCMAIN.

--The following example illustrates how a database is copied:

COPY DATA TABLE (Personnel)(FROM (OldPersonnel), NO FALLBACK),
FILE = ARCHIVE;

--The database named Personnel is restored from an archived database named OldPersonnel with all tables defined as nonfallback after the copy operation.

The above information is there in Teradata manual "Teradata Archive/Recovery Utility Reference"

arcmain outlog=arcall.out --The above command line calls the ARCMAIN executable.

arcmain outlog=arcall.out < arcall.in

 If you want to transfer the table with in the same node,you can use following syntax.
 suppose you have db1 with t1 and you want to transfer t1 into db2,then you can create a  new table t1 in db2 as follows.

Create table db2.t1 as db1.t1 with data;

after create table completes, you can delete db1.t1.

Use following script for Teradata Archive

logon servername/dbc,dbc;
DUMP DATA TABLES(Database)
(USE READ LOCK,
RELEASE LOCK,
FILE=NVDSID1;

logon servername /dbc,dbc;
COPY DATA TABLES(Database)
(RELEASE LOCK,
FILE=NVDSID1;
.logoff;
.quit;

 Save these two scripts are different and run @ command propmt with the following syntax

ARCMAIN SESSIONS=8 CATALOG OUTLOG=ARCALL.OUT <ARCALL.IN(MENCTION HERE FIRST SCRIPT) DO SAME FOR WITH COPY SCRIPT


2 comments: