Using a template database to initialize in-memory and relaxed-durability databases

You can use the same disk-resident database as a template to initialize multiple in-memory or relaxed-durability databases.

StepsSetting up replication for the first time using a template database

  1. Create the template database. The template database uses the name of the database with the outbound connection to Replication Server which is usually the replicate database name.

    create database tokyo_db on publicdev=10 log on publicdevlog=10
    go
    
  2. Use rs_init to add the replicate database to the replication system.

  3. Suspend the DSI thread to the template database by stopping RepAgent on the template database. For example:

    suspend connection to TOKYO_DS.tokyo_db
    
  4. Rename the template database to template1:

    use master
    go
    sp_dboption tokyo_db, single, true
    go
    sp_renamedb tokyo_db, template1
    go
    sp_dboption template1, single, false
    go
    
  5. Create the in-memory or relaxed durability database with durability set to no_recovery using the template created in step 1:

    create inmemory database tokyo_db
    use template1 as template
    on imdb_cache_dev = '50' log on imdb_cache_dev_log='50'
    with DURABILITY=NO_RECOVERY
    go
    
  6. Connect to Replication Server and resume the connection to the replicate database:

    resume connection to TOKYO_DS.tokyo_db
    

Recreating in-memory and relaxed-durability databases after an Adaptive Server shutdown

After a shutdown or termination and a subsequent restart of Adaptive Server, Adaptive Server recreates the in-memory or relaxed-durability database automatically from the template. When Replication Server resumes the connection to the replicate in-memory or relaxed-durability database that you created, Replication Server may reapply commands, as the information used by Replication Server to detect the latest command that was applied is lost when you restart Adaptive Server.