Monday, June 11, 2018

Migrate Generic Templates between databases

Generic Templates can be migrated from one database to another using Datamover export and import scripts. Which Template ID that are exported and imported can be controlled with WHERE clause.

1. Verify data to export, with SQL similar to this;
SELECT * FROM PS_WL_TEMPLATE_GEN WHERE WL_TEMPLATE_ID = 'custom template name';
SELECT * FROM PS_WL_TEMPL_GEN_TK WHERE WL_TEMPLATE_ID = 'custom template name';
SELECT * FROM PS_WL_TEMPL_GEN_RS WHERE WL_TEMPLATE_ID = 'custom template name';


2. Example Data Mover Export Script to export Generic Templates;
SET LOG C:\TEMP\GEN_TEMPLATE.LOG;
SET OUTPUT C:\TEMP\GEN_TEMPLATE.DAT;
EXPORT PS_WL_TEMPLATE_GEN WHERE WL_TEMPLATE_ID = 'custom template name';
EXPORT PS_WL_TEMPL_GEN_TK WHERE WL_TEMPLATE_ID = 'custom template name';
EXPORT PS_WL_TEMPL_GEN_RS WHERE WL_TEMPLATE_ID = 'custom template name';


3. Example Data Mover Import Script to import Generic Templates into another Database;

SET LOG C:\TEMP\DATAMOVE.LOG;
DELETE FROM PS_WL_TEMPLATE_GEN WHERE WL_TEMPLATE_ID = 'custom template name';
DELETE FROM PS_WL_TEMPL_GEN_TK WHERE WL_TEMPLATE_ID = 'custom template name';
DELETE FROM PS_WL_TEMPL_GEN_RS WHERE WL_TEMPLATE_ID = 'custom template name';

SET LOG C:\TEMP\IMP_TEMPLATE.LOG;
SET INPUT C:\TEMP\GEN_TEMPLATE.DAT;
SET NO SPACE;
SET NO RECORD;
SET NO INDEX;
IMPORT *;



4. Example of this running in a Demo system for Generic Template named 'THOMAS'.

EXPORT Script;
SET LOG D:\User\LThomas\3-1713987231\EXP_TEMPLATE.LOG;
SET OUTPUT D:\User\LThomas\3-1713987231\GEN_TEMPLATE.DAT;
EXPORT PS_WL_TEMPLATE_GEN WHERE WL_TEMPLATE_ID = 'THOMAS';
EXPORT PS_WL_TEMPL_GEN_TK WHERE WL_TEMPLATE_ID = 'THOMAS';
EXPORT PS_WL_TEMPL_GEN_RS WHERE WL_TEMPLATE_ID = 'THOMAS';

Started: Tue May 25 14:42:30 2010
Data Mover Release: 8.49.22
Database: Q900ZXYX (ENG)
Exporting WL_TEMPLATE_GEN
Export WL_TEMPLATE_GEN 1
Exporting WL_TEMPL_GEN_TK
Export WL_TEMPL_GEN_TK 1
Exporting WL_TEMPL_GEN_RS
Export WL_TEMPL_GEN_RS 0
Ended: Tue May 25 14:42:31 2010
Successful completion
Script Completed.


5. Example of this running in a Demo system for Generic Template named 'THOMAS'.

IMPORT Script;
SET LOG D:\User\LThomas\3-1713987231\DATAMOVE.LOG;
DELETE FROM PS_WL_TEMPLATE_GEN WHERE WL_TEMPLATE_ID = 'THOMAS';
DELETE FROM PS_WL_TEMPL_GEN_TK WHERE WL_TEMPLATE_ID = 'THOMAS';
DELETE FROM PS_WL_TEMPL_GEN_RS WHERE WL_TEMPLATE_ID = 'THOMAS';

SET LOG D:\User\LThomas\3-1713987231\IMP_TEMPLATE.LOG;
SET INPUT D:\User\LThomas\3-1713987231\GEN_TEMPLATE.DAT;
SET NO SPACE;
SET NO RECORD;
SET NO INDEX;
IMPORT *;

Started: Tue May 25 14:51:12 2010
Data Mover Release: 8.49.22
Database: Q900GXAE (ENG)
SQL Successful - DELETE FROM PS_WL_TEMPLATE_GEN WHERE WL_TEMPLATE_ID = 'THOMAS'
SQL Successful - DELETE FROM PS_WL_TEMPL_GEN_TK WHERE WL_TEMPLATE_ID = 'THOMAS'
SQL Successful - DELETE FROM PS_WL_TEMPL_GEN_RS WHERE WL_TEMPLATE_ID = 'THOMAS'
Ended: Tue May 25 14:51:12 2010
Successful completion
Started: Tue May 25 14:51:12 2010
Data Mover Release: 8.49.22
Database: Q900GXAE (ENG)
Input file: D:\User\LThomas\3-1713987231\GEN_TEMPLATE.DAT (ENG)
Commit done at end of record
Importing WL_TEMPLATE_GEN
Import WL_TEMPLATE_GEN 1
Records remaining: 2
Importing WL_TEMPL_GEN_TK
Import WL_TEMPL_GEN_TK 1
Records remaining: 1
Importing WL_TEMPL_GEN_RS
Import WL_TEMPL_GEN_RS 0
Ended: Tue May 25 14:51:13 2010
Successful completion
Script Completed.