Heterogeneous Database Replication Randy Dyess Mentor [email_address]
About Me <ul><li>Solid Quality Learning Mentor </li></ul><ul><li>Transact-SQL Performance Tuning Mentoring and Training </...
An association of SQL Server experts from around the world <ul><li>Solid Quality Learning is the trusted global provider o...
Snapshot Replication
Snapshot <ul><li>Full data refresh </li></ul><ul><ul><li>Bulk copy of schema and data </li></ul></ul><ul><ul><li>Locking i...
Snapshot Distributor Clients Transactions Distribution Publisher Subscriber napshot  folder Repl_commands
Questions?
Transactional Replication
Transactional <ul><li>One way data movement </li></ul><ul><li>Copies rows across environment </li></ul><ul><ul><li>From pu...
Transactional Replication Change Tracking – Log Reader <ul><li>SQL Server engine marks transactions for replication  </li>...
Transactional Replication Forwarding – Distribution Agent <ul><li>Retrieve the last transaction received by the subscriber...
Transactional Distributor Clients Transactions Publisher Subscriber Distribution DB log Logread.exe Distrib.exe
Change Tracking - Updating Subscribers Immediate Updating  Subscriber 2PC, RPC Publisher Distributor Read-Only Subscriber ...
Change Tracking – Immediate Updating Subscribers <ul><li>Immediate means  immediate </li></ul><ul><li>Log based change tra...
Change Tracking – Queued Updating Subscribers <ul><li>Primarily for failover from immediate updating mode </li></ul><ul><l...
Questions?
Merge Replication
Merge <ul><li>Disconnected processing </li></ul><ul><li>Rich Conflict Detection and Resolution </li></ul><ul><li>Rich Filt...
Distributor Clients Clients Transactions Transactions Distribution Publisher Subscriber MSmerge_contents MSmerge_contents
BI-Directional Replication
Bi-directional Replication <ul><li>Can be effective in scaling writes </li></ul><ul><li>Requires careful planning </li></u...
Distributor Clients Clients Transactions Publisher/ Subscriber Subscriber/ Publisher Transactions Distribution
Questions?
Oracle Replication Supported Features
Supported Features <ul><li>SQL Server 2005 supports both snapshot replication and transactional replication to and from Or...
Supported Features <ul><li>Data can be publish from Oracle </li></ul><ul><ul><li>Oracle serves as the publisher – SQL Serv...
Supported Features <ul><li>Data can be publish to Oracle </li></ul><ul><ul><li>Oracle serves as the subscriber – SQL Serve...
Supported Features <ul><li>Snapshot Replication </li></ul><ul><ul><li>Operates the same as standard SQL Server Snapshot Re...
Supported Features <ul><li>Transactional Replication </li></ul><ul><ul><li>An Oracle Publisher cannot have the same name a...
Supported Features <ul><li>Transactional Replication </li></ul><ul><ul><li>Collate clauses are added to the CREATE TABLE s...
Supported Features <ul><li>Transactional Replication </li></ul><ul><ul><li>Oracle publications do not support all of the s...
Questions?
How to Configure Oracle Replication
Configuring <ul><li>Publisher </li></ul><ul><ul><li>Created the same way as SQL Server based publishers with a few steps t...
Configuring a Publisher <ul><li>Create a replication administrative user within the Oracle database using the script suppl...
Configuring a Publisher <ul><li>Install the Oracle client software and OLE DB provider on the Microsoft SQL Server Distrib...
Configuring a Publisher <ul><li>Use the Net Configuration Assistant to configure network connectivity  </li></ul><ul><ul><...
Configuring a Publisher <ul><li>Configure the Oracle database as a Publisher at the SQL Server Distributor. </li></ul><ul>...
Publications <ul><li>Use SQL Server Management Studio to connect to the distributor used for your Oracle replication and c...
Configuring a Subscriber <ul><li>Install the Oracle client software and OLE DB provider on the Microsoft SQL Server Distri...
Configuring a Subscriber <ul><li>Considerations for Oracle Home </li></ul><ul><ul><li>Set Oracle Home binaries </li></ul><...
Configuring a Subscriber <ul><li>Create a TNS name for the subscriber </li></ul><ul><li>Use the Net Configuration Assistan...
Subscriptions <ul><li>Use SQL Server Management Studio to connect to the publisher and create your subscriptions to a publ...
Questions?
A few administrative notes
Administration <ul><li>Oracle Import: When the  ignore  option set to ‘n’ Oracle Import will drop and recreate the table –...
Administration <ul><li>You must drop and rebuild a publication if you: </li></ul><ul><ul><li>Truncate a published table. <...
Administration <ul><li>Oracle replication will create a linked server to the Oracle server from SQL Server. </li></ul><ul>...
Questions?
Upcoming SlideShare
Loading in …5
×

Heterogeneous Database Replication (0.80 MB)

854 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
854
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
17
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • See sp_addarticle (Transact-SQL) ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/0483a157-e403-4fdb-b943-23c1b487bef0.htm Validating Replicated Data ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/rpldata9/html/f7500a2b-61cb-41b5-816d-27609a6c58e7.htm
  • Heterogeneous Database Replication (0.80 MB)

    1. 1. Heterogeneous Database Replication Randy Dyess Mentor [email_address]
    2. 2. About Me <ul><li>Solid Quality Learning Mentor </li></ul><ul><li>Transact-SQL Performance Tuning Mentoring and Training </li></ul><ul><li>SQL Server Performance Tuning Mentoring and Training </li></ul><ul><li>Author of articles for SQLServerCentral.com, SSWUG.Org, SQL Server Standard magazine, and others </li></ul><ul><li>Director of Membership for PASS </li></ul><ul><li>www.SolidQualityLearning.com </li></ul><ul><li>[email_address] </li></ul>
    3. 3. An association of SQL Server experts from around the world <ul><li>Solid Quality Learning is the trusted global provider of advanced education and solutions for the entire Microsoft database platform. </li></ul><ul><li>Helping you get the best out of your SQL Server: </li></ul><ul><ul><li>Training </li></ul></ul><ul><ul><li>Consulting </li></ul></ul><ul><ul><li>Mentoring </li></ul></ul>www.solidqualitylearning.com
    4. 4. Snapshot Replication
    5. 5. Snapshot <ul><li>Full data refresh </li></ul><ul><ul><li>Bulk copy of schema and data </li></ul></ul><ul><ul><li>Locking implications </li></ul></ul><ul><li>No incremental transaction flow </li></ul><ul><li>No structural impact </li></ul><ul><li>First step of transactional and merge </li></ul><ul><ul><li>Not exactly </li></ul></ul><ul><ul><li>Different paths depending upon method </li></ul></ul>
    6. 6. Snapshot Distributor Clients Transactions Distribution Publisher Subscriber napshot folder Repl_commands
    7. 7. Questions?
    8. 8. Transactional Replication
    9. 9. Transactional <ul><li>One way data movement </li></ul><ul><li>Copies rows across environment </li></ul><ul><ul><li>From publisher to distributor (logread.exe) </li></ul></ul><ul><ul><li>From distribution to subscriber (distrib.exe) </li></ul></ul><ul><li>No schema change required </li></ul>
    10. 10. Transactional Replication Change Tracking – Log Reader <ul><li>SQL Server engine marks transactions for replication </li></ul><ul><li>Log Reader retrieves last transaction id processed for a publisher from distribution database </li></ul><ul><li>Retrieve commands for next N transactions from publisher </li></ul><ul><li>Write commands to distribution database </li></ul><ul><ul><li>Formatted as TSQL or stored proc execution </li></ul></ul><ul><li>Advance replication watermark in the log to coordinate with the log manager of the database engine </li></ul><ul><li>Write history and error information into the distribution database </li></ul>
    11. 11. Transactional Replication Forwarding – Distribution Agent <ul><li>Retrieve the last transaction received by the subscriber </li></ul><ul><li>Retrieve the next set of N transactions from the distribution database </li></ul><ul><li>Deliver to subscriber and update the last transaction received </li></ul>
    12. 12. Transactional Distributor Clients Transactions Publisher Subscriber Distribution DB log Logread.exe Distrib.exe
    13. 13. Change Tracking - Updating Subscribers Immediate Updating Subscriber 2PC, RPC Publisher Distributor Read-Only Subscriber Queued Updating Subscriber Queue NETWORK Queue Queue Reader Agent
    14. 14. Change Tracking – Immediate Updating Subscribers <ul><li>Immediate means immediate </li></ul><ul><li>Log based change tracking at publisher </li></ul><ul><li>Change tracking triggers at subscriber </li></ul><ul><li>Trigger captures change and initiates 2pc with publisher </li></ul><ul><li>Conflicts detected </li></ul><ul><li>Loopback detection </li></ul><ul><li>Requires schema change </li></ul><ul><li>Binds subscriber to publisher </li></ul>Immediate Updating Subscriber 2PC, RPC Publisher Distributor Read-Only Subscriber
    15. 15. Change Tracking – Queued Updating Subscribers <ul><li>Primarily for failover from immediate updating mode </li></ul><ul><li>Change tracking triggers at subscriber </li></ul><ul><li>Trigger captures change and writes to local queue </li></ul><ul><li>QueueReader Agent delivers to subscriber </li></ul><ul><li>Limited Conflict Detection and Resolution </li></ul><ul><li>Requires a schema change </li></ul>Read-Only Subscriber Queued Updating Subscriber Queue NETWORK Queue Queue Reader Agent
    16. 16. Questions?
    17. 17. Merge Replication
    18. 18. Merge <ul><li>Disconnected processing </li></ul><ul><li>Rich Conflict Detection and Resolution </li></ul><ul><li>Rich Filtering capabilities </li></ul><ul><ul><li>Static </li></ul></ul><ul><ul><li>Dynamic </li></ul></ul><ul><ul><li>Join </li></ul></ul><ul><li>Data latency </li></ul><ul><li>Requires schema change </li></ul><ul><li>Performance issues </li></ul>
    19. 19. Distributor Clients Clients Transactions Transactions Distribution Publisher Subscriber MSmerge_contents MSmerge_contents
    20. 20. BI-Directional Replication
    21. 21. Bi-directional Replication <ul><li>Can be effective in scaling writes </li></ul><ul><li>Requires careful planning </li></ul><ul><li>Requires intimate understanding of data flow </li></ul><ul><li>Requires control over applications </li></ul><ul><li>Can be utilized </li></ul><ul><ul><li>Must be regulated </li></ul></ul>
    22. 22. Distributor Clients Clients Transactions Publisher/ Subscriber Subscriber/ Publisher Transactions Distribution
    23. 23. Questions?
    24. 24. Oracle Replication Supported Features
    25. 25. Supported Features <ul><li>SQL Server 2005 supports both snapshot replication and transactional replication to and from Oracle </li></ul><ul><li>Oracle database can reside on any operating system that Oracle supports </li></ul>
    26. 26. Supported Features <ul><li>Data can be publish from Oracle </li></ul><ul><ul><li>Oracle serves as the publisher – SQL Server the subscriber </li></ul></ul><ul><ul><ul><li>Supported on Enterprise Edition (32-bit and 64-bit) </li></ul></ul></ul><ul><ul><li>Must use a remote distributor </li></ul></ul>
    27. 27. Supported Features <ul><li>Data can be publish to Oracle </li></ul><ul><ul><li>Oracle serves as the subscriber – SQL Server the publisher </li></ul></ul><ul><ul><ul><li>Supported on Enterprise Edition (32-bit and 64-bit) </li></ul></ul></ul><ul><ul><ul><li>Supported on Standard Edition (32-bit and 64-bit) </li></ul></ul></ul><ul><ul><li>Only push subscriptions are allowed with distributor agent running on the distributor </li></ul></ul><ul><ul><li>Only character mode subscriptions are allowed </li></ul></ul><ul><ul><li>Cannot use immediate updating or queued updating subscriptions, or be nodes in a peer-to-peer topology. </li></ul></ul><ul><ul><li>Cannot be automatically initialized from a backup. </li></ul></ul>
    28. 28. Supported Features <ul><li>Snapshot Replication </li></ul><ul><ul><li>Operates the same as standard SQL Server Snapshot Replication </li></ul></ul>
    29. 29. Supported Features <ul><li>Transactional Replication </li></ul><ul><ul><li>An Oracle Publisher cannot have the same name as: its SQL Server Distributor; any of the SQL Server Publishers that use the Distributor; or any Subscribers that receive the publication. Publications serviced by the same Distributor must each have a unique name. </li></ul></ul><ul><ul><li>Primary key to foreign key relationships in the Oracle database are not replicated to Subscribers. However, the relationships are maintained in the data as changes are delivered. </li></ul></ul><ul><ul><li>Standard transactional publications support tables of up to 1000 columns. Oracle transactional publications support 995 columns (replication adds five columns to each published table). </li></ul></ul>
    30. 30. Supported Features <ul><li>Transactional Replication </li></ul><ul><ul><li>Collate clauses are added to the CREATE TABLE statements to enable case sensitive comparisons, which is important for primary keys and unique constraints. This behavior is controlled with the schema option 0x1000, which is specified with the @schema_option parameter of sp_addarticle (Transact-SQL). </li></ul></ul><ul><ul><li>If you use stored procedures to configure or maintain an Oracle Publisher, do not put the procedures inside an explicit transaction. This is not supported over the linked server used to connect to the Oracle Publisher. </li></ul></ul><ul><ul><li>If you use stored procedures to propagate changes to Subscribers (the default), be aware that the MCALL syntax is supported, but it has different behavior when the publication is from an Oracle Publisher. Typically MCALL provides a bitmap that shows which columns were updated at the Publisher. With an Oracle publication, the bitmap always shows that all columns were updated. </li></ul></ul>
    31. 31. Supported Features <ul><li>Transactional Replication </li></ul><ul><ul><li>Oracle publications do not support all of the schema options that SQL Server publications support. </li></ul></ul><ul><ul><ul><li>Log based and procedure based </li></ul></ul></ul><ul><ul><li>Oracle Publishers only support Row Count validation </li></ul></ul><ul><ul><ul><li>Only validates that the published table and subscribed table have same number of rows of data – does not validate actual data. </li></ul></ul></ul>
    32. 32. Questions?
    33. 33. How to Configure Oracle Replication
    34. 34. Configuring <ul><li>Publisher </li></ul><ul><ul><li>Created the same way as SQL Server based publishers with a few steps that must take place before creating the publication </li></ul></ul><ul><li>Subscriber </li></ul><ul><ul><li>Created the same way as SQL Server based publishers with a few steps that must take place before creating the subscriber </li></ul></ul>
    35. 35. Configuring a Publisher <ul><li>Create a replication administrative user within the Oracle database using the script supplied in SQL Server 2005 Books Online. </li></ul><ul><ul><li>Found in directory: <drive> :rogram FilesMicrosoft SQL Server <Instancefolder> MSSQLInstalloracleadmin.sql. </li></ul></ul><ul><ul><li>Also in BOL article: Script to Grant Oracle Permissions </li></ul></ul><ul><li>For the tables that you will publish, grant SELECT permission directly on each of them (not through a role) to the Oracle administrative user you created in step one. </li></ul>
    36. 36. Configuring a Publisher <ul><li>Install the Oracle client software and OLE DB provider on the Microsoft SQL Server Distributor, and then stop and restart the SQL Server instance. </li></ul><ul><ul><li>If the Distributor is running on a 64 bit platform, you must use the 64 bit version of the Oracle OLE DB provider. </li></ul></ul><ul><ul><li>You must set permissions to the folders on which the software is installed </li></ul></ul><ul><ul><ul><li>Described in BOL Article: Configuring an Oracle Publisher </li></ul></ul></ul>
    37. 37. Configuring a Publisher <ul><li>Use the Net Configuration Assistant to configure network connectivity </li></ul><ul><ul><li>Test network connectivity </li></ul></ul><ul><ul><ul><li>Described in BOL Article: Configuring an Oracle Publisher </li></ul></ul></ul><ul><li>Considerations for Oracle Home </li></ul><ul><ul><li>Set Oracle Home binaries </li></ul></ul><ul><ul><ul><li>Only one set of binaries can be used by replication at a given time. </li></ul></ul></ul><ul><ul><ul><li>These binaries are in the directory %ORACLE_HOME%in. </li></ul></ul></ul><ul><ul><ul><li>You must ensure that these binaries are used when replication makes connections to the Oracle Publisher. </li></ul></ul></ul><ul><ul><li>Configure Distributor </li></ul></ul><ul><ul><ul><li>Log into the Distributor with the accounts used by the SQL Server service and the SQL Server Agent service and set the appropriate environment variables. </li></ul></ul></ul><ul><ul><ul><li>The %ORACLE_HOME% variable should be set to refer to the installation point you specified when you installed the client networking software. </li></ul></ul></ul><ul><ul><ul><li>The %PATH% must include the %ORACLE_HOME% in directory as the first Oracle entry that is encountered. </li></ul></ul></ul>
    38. 38. Configuring a Publisher <ul><li>Configure the Oracle database as a Publisher at the SQL Server Distributor. </li></ul><ul><ul><li>Two options are available: Complete or Oracle Gateway. </li></ul></ul><ul><ul><ul><li>The Complete option is designed to provide snapshot and transactional publications with the complete set of supported features for Oracle publishing. </li></ul></ul></ul><ul><ul><ul><li>The Oracle Gateway option provides specific design optimizations to improve performance for cases where replication serves as a gateway between systems. </li></ul></ul></ul>
    39. 39. Publications <ul><li>Use SQL Server Management Studio to connect to the distributor used for your Oracle replication and create your publications </li></ul>
    40. 40. Configuring a Subscriber <ul><li>Install the Oracle client software and OLE DB provider on the Microsoft SQL Server Distributor, and then stop and restart the SQL Server instance. </li></ul><ul><ul><li>If the Distributor is running on a 64 bit platform, you must use the 64 bit version of the Oracle OLE DB provider. </li></ul></ul><ul><ul><li>You must set permissions to the folders on which the software is installed </li></ul></ul><ul><ul><ul><li>Described in BOL Article: Configuring an Oracle Publisher </li></ul></ul></ul>
    41. 41. Configuring a Subscriber <ul><li>Considerations for Oracle Home </li></ul><ul><ul><li>Set Oracle Home binaries </li></ul></ul><ul><ul><ul><li>Only one set of binaries can be used by replication at a given time. </li></ul></ul></ul><ul><ul><ul><li>These binaries are in the directory %ORACLE_HOME%in. </li></ul></ul></ul><ul><ul><ul><li>You must ensure that these binaries are used when replication makes connections to the Oracle Subscriber. </li></ul></ul></ul><ul><ul><li>Configure Distributor </li></ul></ul><ul><ul><ul><li>Log into the Distributor with the accounts used by the SQL Server service and the SQL Server Agent service and set the appropriate environment variables. </li></ul></ul></ul><ul><ul><ul><li>The %ORACLE_HOME% variable should be set to refer to the installation point you specified when you installed the client networking software. </li></ul></ul></ul><ul><ul><ul><li>The %PATH% must include the %ORACLE_HOME% in directory as the first Oracle entry that is encountered. </li></ul></ul></ul>
    42. 42. Configuring a Subscriber <ul><li>Create a TNS name for the subscriber </li></ul><ul><li>Use the Net Configuration Assistant to configure network connectivity </li></ul><ul><ul><li>Test network connectivity </li></ul></ul><ul><ul><ul><li>Described in BOL Article: Oracle Subscribers </li></ul></ul></ul>
    43. 43. Subscriptions <ul><li>Use SQL Server Management Studio to connect to the publisher and create your subscriptions to a publication </li></ul><ul><li>Make sure you understand the data mappings between your SQL Server and Oracle databases </li></ul><ul><ul><li>Described in BOL Article: Oracle Subscribers </li></ul></ul>
    44. 44. Questions?
    45. 45. A few administrative notes
    46. 46. Administration <ul><li>Oracle Import: When the ignore option set to ‘n’ Oracle Import will drop and recreate the table – this will remove replication objects created on the table for transactional replication. </li></ul><ul><li>SQL*Loader: When the direct option is set to ‘true’ – replication triggers will not fire on insert. This option must be set to ‘false’ (default) to fire replication triggers. </li></ul>
    47. 47. Administration <ul><li>You must drop and rebuild a publication if you: </li></ul><ul><ul><li>Truncate a published table. </li></ul></ul><ul><ul><li>Rename a published table. </li></ul></ul><ul><ul><li>Add a column to a published table. </li></ul></ul><ul><ul><li>Drop or modify a column that is published for replication. </li></ul></ul><ul><ul><li>Perform non-logged operations. </li></ul></ul>
    48. 48. Administration <ul><li>Oracle replication will create a linked server to the Oracle server from SQL Server. </li></ul><ul><ul><li>This linked server can only be used for replication – you must configure additional linked servers if you wish to interact with Oracle from SQL Server for any other purpose. </li></ul></ul>
    49. 49. Questions?

    ×