Lesson 6: Creating and modifying a synchronization model

This lesson assumes you have completed all preceding lessons. See Lesson 1: Designing the schemas.

In this lesson, you create a synchronization model for your consolidated database. The Create Synchronization Model Wizard provides step by step instructions for setting up synchronization between the consolidated database and remote database.

 Create and modify a synchronization model
  1. On the Welcome page, type sync_oracle in the What Do You Want To Name The New Synchronization Model field, and click Next.

  2. On the Primary Key Requirements page, select all three checkboxes. Click Next.

  3. Select the oracle_cons consolidated database from the list, and click Next.

  4. Click No, Create A New Remote Database Schema, and click Next.

  5. On the New Remote Database Schema page, in the Which Consolidated Database Tables And Columns Do You Want To Have In Your Remote Database list, choose the following tables:

    • CUSTOMERS
    • ORDERS
    • ORDER_ITEMS
    • PRODUCT_INFORMATION
  6. Click Next.

  7. Click Timestamp-based Download, and click Next.

    Timestamp-based downloads minimize the amount of data that is transferred because only data that has been updated since the last download is transmitted.

  8. On the Timestamp Download Options page, click Use Shadow Tables To Hold Timestamp Columns, and click Next.

    Using shadow tables is often preferred because it does not require any changes to existing tables.

  9. Perform the following tasks on the Download Deletes page:

    1. Click Yes on the Do You Want Data Deleted On The Consolidated Database To Be Deleted On The Remote Databases option.

    2. Click Use Shadow Tables To Record Deletions.

      MobiLink creates shadow tables on the consolidated database to implement deletions that need to be synchronized.

    3. Click Next.

  10. Click Yes, Download the Same Data to Each Remote, and click Next.

    You specify how to download specific data to a remote database by using custom logic when editing the synchronization model.

  11. Click No Conflict Detection, and click Next.

    Although this tutorial specifies no conflict detection, many applications require conflict detection.

  12. Perform the following tasks on the Publication, Script Version and Description page:

    1. In the What Do You Want To Name The Publication field, type sync_oracle_publication.

    2. In the What Do You Want To Name The Script Version field, type sync_oracle_scriptversion.

      The publication is the object on the remote database that specifies what data is synchronized. MobiLink server scripts define how uploaded data from remotes should be applied to the consolidated database, and script versions group scripts. You can use different script versions for different applications, allowing you to maintain a single MobiLink server while synchronizing different applications.

    3. Click Finish.

  13. In Sybase Central, click View » Folders.

  14. In the left pane of Sybase Central under MobiLink 12, expand oracle_project, Synchronization Models, sync_oracle.

  15. Set the direction that data is synchronized for each table in the synchronization model.

    Click the Mappings tab in the right pane, and set the rows in the Dir column as follows:

    • The ORDERS and ORDER_ITEMS tables should be set to Bi-directional (both upload and download).
    • The remaining tables should be set to Download To Remote Only.
  16. If a window appears indicating that loading the consolidated schema for all owners may take a long time, choose to load the database schema for the HR and OE users.

  17. Filter the rows downloaded to the remote database by remote ID.

    1. For the row containing the ORDERS table, change the Download Subset column to Custom.

    2. Click the Download Subset tab at the bottom of the right pane.

    3. Filter the rows by remote ID, which uniquely identifies the remote database, by adding a restriction to the WHERE clause of the download_cursor script.

      Type a search condition in the SQL Expression To Use In The Download Cursor's WHERE Clause field. For example, the following SQL script can be used for the ORDERS table:

      OE.ORDERS.SALES_REP_ID = {ml s.remote_id}

      The download cursor script specifies what columns and rows are downloaded from each table to the remote database. The search condition ensures that you only download information about one sales representative, namely, the sales representative that has an identifier that equals the remote ID for the database.

    4. Change the Delete Subset column from Same to None.

  18. Save the synchronization model.

    Click File » Save.

    The synchronization model is complete and ready for deployment.

  19. Proceed to Lesson 7: Deploying the synchronization model.

 See also