Cloning a Datacom SQL database structure
search cancel

Cloning a Datacom SQL database structure

book

Article ID: 10334

calendar_today

Updated On:

Products

Datacom

Issue/Introduction

An SQL database structure using a certain Database-ID (DBID) needs to be cloned .

The cloned database needs to have the same database structure but a new DBID.

This article gives some ways to create that cloned database.

Environment

Datacom 

Resolution

  1. Run DDBTGLM on the database entity name  

    //BTG EXEC PGM=DDBTGLM,REGION=4096K
    //STEPLIB DD DSN=your 15.1 Datacom CUSLIB,
    // DISP=SHR
    // DD DSN=your 15.1 CABDLOAD,
    // DISP=SHR
    // DD DSN=your IPC 15.1 CAVQLOAD,
    // DISP=SHR
    //SYSPRINT DD SYSOUT=*
    //SYSOUT DD SYSOUT=*
    //SYSPUNCH DD SYSOUT=*
    //DDSNAP DD SYSOUT=*
    //SNAPER DD SYSOUT=*
    //SYSUDUMP DD SYSOUT=*
    //AUXOUT DD DSN=your dsn ,DISP=(NEW,CATLG,KEEP),
    // DCB=(RECFM=FB,LRECL=80,BLKSIZE=4000),UNIT=SYSDA,
    // SPACE=(CYL,(2,1),RLSE)
    //SYSIN DD *
    -USR DATACOM-INSTALL,NEWUSER
    -DEF PATH,STANDARD
    -END
    -BTG AUXOUT
    -BTG START,DATABASE,database entity name (PROD),STANDARD
    -END

  2. Edit the AUXOUT dataset . In card 2009 under -BTG DATABASE the database-id needs to be changed to the new DBID. .
    A new database name is also needed so change the current database name in that -BTG DATABASE card to another name like database name -CLONE. Put another SQLNAME in card 2901 in that -BTG DATABASE group.  Another AREA name and TABLE name is needed too so change the names in -BTG AREA and -BTG TABLE and change the 1000 CONNECT card to refer to the new database and area occurrences names.
    Put in another unique AUTHID and Table SQLNAME in card 3152 .                                                                                                                                                                                                   

  3. Run DDUPDATE with that AUXOUT dataset in input.                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  4. Step 3 adds the new cloned database in status T001 in DATA-DICT .
    In DDOL run SET BAS on that new database followed by VER BAS .
    If OK then copy the T001 database structure to PROD status , catalog the database and enable the database. 

  5. Allocate new data sets for the index and data areas for the new database areas.                                                                                                                                                                                                                                                                                                                                                                                       
  6. Initialize the index and data areas and run a load using DBUTLTY.

Additional Information

In some cases the DDUPDATE 1000 MODEL transaction can be used . 

See the online documentation here :Creating a Replica Database Accessible by SQL

Note that if the table has been created via an SQL CREATE TABLE statement in the past then add the new database and area entities and run  CREATE TABLE ... IN  new area name DATACOM NAME name (same three-character Datacom table name that is used in the source database). DDTRSLM EXPORT TABLE  can be run to see the CREATE TABLE statement cards to CREATE the cloned table. 

Note that DBUTLTY functions CXXCLONE and CXXMAINT OPTION=DDPROD,NEWDBID= cannot be used to clone an SQL Database. For an SQL database the DDD-DATABASE needs to be populated and that only happens during a database catalog process.