Procedure for Restoring a Package - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
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 Teradata 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