Friday, February 17, 2017

Teradata Fast Load Script to load data from text file to Table


Teradata Fast Load Script to load data from text file to Table

Step1:- Create one sample text file  Lokesh.txt
Type: vi Lokesh.txt
= i
à write the text file with below sample data
101,Mike,James,1980-01-05,2010-03-01,1
102,Robert,Williams,1983-03-05,2010-09-01,1
103,Peter,Paul,1983-04-01,2009-02-12,2
104,Alex,Stuart,1984-11-06,2014-01-01,2
105,Robert,James,1984-12-01,2015-03-09,3
= :wq (will save the file data and close)
Step2:- Create one shell script Lokesh.sh
type= vi Lokesh.sh
= i
à Write the script like
fastload<<EOF
.logmech ldap;
.LOGON (Server Name)/(User Name),(Password); (ServerNM:PROD.welg.com,UN:Lokesh,PWD:12345)
      SET RECORD VARTEXT ",";
      DEFINE in_EmployeeNo (VARCHAR(10)),
         in_FirstName (VARCHAR(30)),
         in_LastName (VARCHAR(30)),
         in_BirthDate (VARCHAR(10)),
         in_JoinedDate (VARCHAR(10)),
         in_DepartmentNo (VARCHAR(02))

         FILE ="/opt/samples/lokesh.txt";  (File Path)

         BEGIN LOADING DBPROD.TBLEMPLOYEE (DATABASE.TABLENAME)
         ERRORFILES DBPROD.Employee_ERR1, DBPROD.Employee_ERR2
         CHECKPOINT 10; 

      INSERT INTO " DBPROD "." TBLEMPLOYEE" (
         EmployeeNo,
         FirstName,
         LastName,
         BirthDate,
         JoinedDate,
         DepartmentNo
      )
      VALUES (
         :in_EmployeeNo,
         :in_FirstName,
         :in_LastName,
         :in_BirthDate (FORMAT 'YYYY-MM-DD'),
         :in_JoinedDate (FORMAT 'YYYY-MM-DD'),
         :in_DepartmentNo
      );
   END LOADING;
.LOGOFF;
Type= :wq
Will save the shall script
Step3:- Execute the shell script to load text file data to teradata table
Ksh Lokesh.sh
Read More »

Unix login process and accessing steps

Unix login process and accessing steps
-- Go to Putty software – Give Host Name (Connection Type:-SSH)à Click Load àWill open black screen
-- Give credentials to login
Once login to UNIX type like below
1)  su – (user name)
Ex:  - su – WDIF
2) To go for specific environment
Prod (Production)
3) Change the location path
Cd (folder name)
4) To see the list of all files in the folder
ls –ltr
5) Creating Text file
vi Lokesh.txt
 file will open for edit, to insert data type – i
to switch command mode – Esc
to save the file type - :wq (it will save the file data)
6) view the data in the file
Cat Lokesh.txt
7) Rename file name
Mv OldFileName NewFileName
8) To execute shall script file
-ksh Filename.ksh
 
 
Read More »