Procedure for Restoring a Package - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantage™

Here is a synopsis of the steps you take to restore a package that has previously been saved in the demddl and dempart system tables using the savepkg stored procedure.

  1. Start lobteq on your Windows client system.

    The interface and commands are similar to BTEQ.

  2. Log on to the target database.

    Use the same LOGON command that you use in BTEQ. For details on the BTEQ LOGON command, see Basic Teradata® Query Reference, B035-2414.

  3. Use the lobteq .exportfiles command to open a file to store the script that the next call to loadpkg returns.

    The syntax for the .exportfiles command is as follows:

    .exportfiles  filename
  4. Call the loadpkg stored procedure, setting the value of the U_InfoType argument to 'DDL'.

    To handle the script OUT argument, which is passed by locator, precede the CALL statement with the lobteq .cursor command.

  5. Use a SELECT statement and USING modifier that defines a CLOB AS LOCATOR parameter to export the script data to the file that was opened with the .exportfiles command.
  6. Repeat steps 3 to 5, setting the U_InfoType argument of the loadpkg stored procedure to 'PART'.
  7. Exit lobteq.
  8. Run the second script that was retrieved through lobteq to redistribute the package.
  9. Run the first script that was retrieved through BTEQ to submit the DDL statements to reinstall the package.

Example: Restoring a Package

Here is an example of how to restore version 1.0 of a package called libcstd2.so.

First, call the loadpkg stored procedure twice: once to retrieve a script of the DDL statement that installs the package onto the server and again to retrieve a script of the lobteq commands to retrieve the package from the SYSLIB tables.

lobteq << EOF
.logon slugger/adm455,sn6Y24
   
.exportfiles cstdlib2_DDL.txt
.cursor
CALL SYSLIB.loadpkg('cstdlib2','1.0','SYSLIB','slugger','DDL',
script);
USING (a CLOB AS LOCATOR)
SELECT :a;
.exportfiles cstdlib2_lobload.txt
.cursor
CALL loadpkg('cstdlib2','1.0','SYSLIB','slugger','PART',script);
USING (a CLOB AS LOCATOR)
SELECT :a;

EOF
Next, redistribute Version 1.0 of the libcstd2.so package by executing the cstdlib2_lobload.txt script:
lobteq < cstdlib2_lobload.txt
Finally, submit the DDL statements to reinstall Version 1.0 of the libcstd2.so package by executing the xmlib_DDL.txt script:
bteq < cstdlib2_DDL.txt