Release locked tables and delete error tables in case of failed multi- load script automatically

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
Enthusiast

Release locked tables and delete error tables in case of failed multi- load script automatically

Hi ,

 

is there any way to release locked table and delete error tables in case of failed mload script automatically using some command in same script.

 

Thanks,

Anuj Kumar

1 REPLY
Enthusiast

Re: Release locked tables and delete error tables in case of failed multi- load script automatically

You can call below bteq script before the start of your mload job.

 

bteq<<!MLOAD_CLEANUP

.logon logonfile;

--Check for existense of mload err tables

SELECT * FROM dbc.tablesV
WHERE databasename = '<DB_ERR>'
AND tablename in ('<tbname>_ET1','<tbname>_ET2','<tbname>_LT','<tbname>_WT');

.IF ACTIVITYCOUNT = 0 THEN .GOTO SUCCESS;

--Remove of mload err tables and release the lock

.SET ERRORLEVEL 3807 SEVERITY 0;
.SET ERRORLEVEL 2572 SEVERITY 0;
.SET ERRORLEVEL 2580 SEVERITY 0;

DROP TABLE <DB_ERR>.<tbname>_ET1;
DROP TABLE <DB_ERR>.<tbname>_ET2;
DROP TABLE <DB_ERR>.<tbname>_LT;
DROP TABLE <DB_ERR>.<tbname>_WT;
RELEASE MLOAD <DB_NAME>.<tbname>;
RELEASE MLOAD <DB_NAME>.<tbname> in apply;

.LABEL SUCCESS;

.logoff
.quit 0
!MLOAD_CLEANUP