Overview
Understanding SQL Server Replication
Setting Up Replication
Understanding Agents in Replication
Securing Replication
Lesson: Understanding SQL Server Replication
Business Problems That Require Replication
The Publisher-Subscriber Metaphor (Articles and Publications; Subscriptions)
Autonomy and Latency
Contrasting Replication with Other Data Distribution Methods
Course Scenario: The Needs of Northwind Traders
Business Problems That Require Replication
Multiple users or locations need copies of the same data
Remote users at distant locations
Mobile disconnected users
Need to improve local performance
Physically separate data based on usage
Improve response time by data aggregation
Distribute database processing across multiple servers
Scale out read-only data
Partition data based on business unit needs
Multimedia: Microsoft SQL Server Replication
This animation reviews the concepts behind SQL Server replication.
Snapshot replication
Transactional replication
Merge replication
The Publisher-Subscriber Metaphor
PublisherPublisherPublisherPublisher
Maintains source databases
Makes data available for replication
DistributorDistributorDistributorDistributor
Receives data changes
Stores metadata, history, and receives and stores changes
May forward changes to Subscribers
Holds copy of data
SubscriberSubscriberSubscriberSubscriber
Publications and Articles
Articles
All tables or parts of tables
Views
Stored procedures
User-defined functions
Publications
One or more articles
Basis of subscription
One or more per database
SubscriptionSubscriptionSubscriptionSubscription
PublicationPublication
Articles
Publication B
Publication A
Subscriptions
Push subscription
Push subscription
Push subscription
Push subscription
Push subscription
Push subscription
Push subscription
Push subscription
Push subscriptionPush subscriptionPush subscriptionPush subscription
Pull subscriptionPull subscriptionPull subscriptionPull subscription
Autonomy and Latency
Snapshot replication
Transactional replication
Updatable snapshot replication
Updatable transactional replication
Lower autonomyLower latency
Lower autonomyLower latency
Higher autonomyHigher latency
Higher autonomyHigher latency
Merge replication
Distributed transactions
Contrasting Replication with Other Data Distribution Methods
MethodMethodMethodMethod
ReplicationReplication
Distributed transactionsDistributed transactions
Distributed queriesDistributed queries
Back up and restoreBack up and restore
AutonomyAutonomyAutonomyAutonomy
VariableVariable
LowLow
LowLow
HighHigh
Data Transformation Services (DTS)Data Transformation Services (DTS) Special use onlySpecial use only
LatencyLatencyLatencyLatency
Variable, depending on typeVariable, depending on type
LowLow
LowLow
HighHigh
Special use onlySpecial use only
Course Scenario: The Needs of Northwind Traders
Distribute their product catalog to regional centers
Mobile disconnected sales force must take orders
Sales information is reported to headquarters
Lesson: Setting Up Replication
Preparing SQL Server for Replication
Locating the Distribution Database
What Is Snapshot Replication?
What Is Transactional Replication?
What Is Merge Replication?
Guidelines for Choosing a Replication Type
Creating Subscriptions by Using SQL Server Enterprise Manager Scripting
Preparing SQL Server for Replication
Limit domain permissions to prevent unauthorized access.
Configure the SQL Server Service account
Need not be run under local or domain administrator account
Configure the SQL Server Agent account
Need not be run under local or domain administrator account
Must have access to each SQL Server involved in replication
Assign additional permissions
Create a file system share on the Distributor
Practice: Create a Shared Folder for Replication Snapshots
Create a shared folder for the replication snapshots
Locating the Distribution Database
locallocalDistributorDistributor
locallocalDistributorDistributor
SubscribersPublisher/Distributor
remoteremoteDistributorDistributor
remoteremoteDistributorDistributor
SubscribersDistributorPublisher
Practice: Locating the Distribution Database
Select and register a replication partner
Install replication, locating the replication database
What Is Snapshot Replication?
Distributes data as it appears at a moment in time
Does not monitor for updates to the data
Takes longer to propagate data modifications
A point in time snapshot image
What Is Transactional Replication?
Permits immediate replication of data modifications
Uses the following steps:
Initial snapshot propagation
Data modified at Publisher
Individual transactions captured
Transactions propagated to Subscribers
What Is Merge Replication?
Allows sites to work autonomously
Merges the updates between sites when they are connected
Guidelines for Choosing a Replication Type
Snapshot replication
Data does not change often New data need not be immediately distributed
Transactional replication
Data modifications propagated in seconds Transactions applied completely or not at all
Merge replication
Multiple Subscribers need to update at various times Site autonomy is critical
Creating Subscriptions By Using SQL Server Enterprise Manager Scripting
Replication supports Transact-SQL scripting
Use SQL Server Enterprise Manager scripting menus
Lesson: Understanding Agents in Replication
Replication Agents
SQL Server Agent
Scheduling Replication with SQL Server Agent
Agent Profiles
Replication Agents
SnapshotSnapshotSnapshotSnapshot
Snapshot AgentSnapshot Agent
Distribution AgentDistribution Agent
TransactionalTransactionalTransactionalTransactional
Snapshot AgentSnapshot Agent
Distribution AgentDistribution Agent
Log Reader AgentLog Reader Agent
Queue Reader AgentQueue Reader Agent
MergeMergeMergeMerge
Snapshot AgentSnapshot Agent
Merge AgentMerge Agent
SQL Server Agent
Starting Agents
Scheduled jobs
Command line
ActiveX controls
sqlinitx.dll
sqldistx.dll
sqlmergx.dll
Scheduling Replication with SQL Server Agent
Continuous Least latency Suitable for well-connected
Subscribers with available network bandwidth
Scheduled Any frequency Suitable for synchronizing
data during off-peak hours
On-demand Administrator or application
explicitly invokes Suitable for mobile
disconnected users
Lesson: Securing Replication
The Role of Agents in Securing Replication
Troubleshooting Security Context Issues
Securing Replication By Using SQL Server Roles
Gaining Access to a Publication
Securing the distributor_admin Login
The Role of Agents in Securing Replication
SQL Server Agent account provides the security context for running jobs
Replication is a series of jobs
Initial security context is job owner account
Job runs under SQL Server Agent account
Managing validation failure
SQL Server Service security context
User-based security for Windows 9x
Troubleshooting Security Context Issues
Finding information about security context issues
SQL Server Agent error log Windows event log
Recognizing security context issues
Replication Agent does not start Error 8198
Resolving security context issues
Change the owner of the replication job Use another login
Securing Replication by Using SQL Server Roles
sysadmin can: Enable, modify, or drop a Distributor, Publisher, or Subscriber Enable a database for replication Configure an agent profile Monitor a replication agent
sysadmin or db_owner can: Create, drop, modify, or grant access to a publication Create, or delete a subscription Enable snapshots for File Transfer Protocol downloading using the
Internet. Initiate cleanup of the distribution database Schedule jobs (db_owner of the msdb database)
Securing the distributor_admin Login
Distributor_admin is a special-purpose login
Set a password for the distributor_admin account
Change password with:
sp_changedistributor_password
Distributor tab of the Publisher and Distributor Properties in SQL Server Enterprise Manager