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.
- Start lobteq on your Windows client system.
The interface and commands are similar to BTEQ.
- 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.
- 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
- 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.
- 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.
- Repeat steps 3 to 5, setting the U_InfoType argument of the loadpkg stored procedure to 'PART'.
- Exit lobteq.
- Run the second script that was retrieved through lobteq to redistribute the package.
- 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
lobteq < cstdlib2_lobload.txt
bteq < cstdlib2_DDL.txt