Using a Template Database to Set Up Replication for a Primary In-Memory Database

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

Note: 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.
  1. Create the template database. The template database uses the name of the database with the inbound connection from Replication Server which is usually the primary database name.
    For example, to create the template database named ny_db in the NY_DS data server:
    create database ny_db on publicdev=10 log on publicdevlog=10
    go
  2. Use rs_init to add the primary and replicate databases to the replication system.
  3. Stop RepAgent on the template database:
    sp_stop_rep_agent ny_db
    go
  4. Suspend the connection from Replication Server to the database.
  5. Rename the template database to template1:
    use master
    go
    sp_dboption ny_db, single, true
    go
    sp_renamedb ny_db, template1
    go
    sp_dboption template1, single, false
    go
  6. Create the in-memory or relaxed durability database with durability set to no_recovery using the template created in step 1:
    create inmemory database ny_db
    use template1 as template
    on imdb_cache_dev = '50' log on imdb_cache_dev_log='50'
    with DURABILITY=NO_RECOVERY
    go
  7. Configure RepAgent to start automatically after Adaptive Server shuts down and restarts:
    use template1
    go
    sp_config_rep_agent template1, 'auto start', true
  8. Resume the connection from Replication Server to the database.