Thử thêm cái coi lào
Feb 14

Backup SQL Server Database to another SQL server [Part3]

Choose the pubs database and click the Next button, as shown in Figure 15.
 
 

Figure 15.
 
Select Snapshot publication and click the Next button, as shown in Figure 16.
 
 

Figure 16.
 
Select all of the types of Subscribers that you expect to subscribe to this publication and click the Next button, as shown in Figure 17.
 
 

Figure 17.
 
Choose authors table to publish as article and click the Next button, as shown in Figure 18.
 
 

Figure 18.
 
Specify pubs_article as the publication name and click the Next button, as shown in Figure 19.
 
 

Figure 19.
 
You can specify data filters on this step, but in this example, we don't use any data filters. Check No, create the publication as specified and click the Next button, as shown in Figure 20.
 
 

Figure 20.
 
Click the Finish button to create the publication, as shown in Figure 21.
 
 

Figure 21.
 
Now the 'pubs_article' publication was created, so click the Close button, as shown in Figure 22.
 
 

Figure 22.
 
Now you can create new subscription. Click the Push New Subscription button, as shown in Figure 23.
 
 

Figure 23.
 
This will launch the Push Subscription wizard shown in Figure 24. Click the Next button.
 
 

Figure 24.
 
Select CHIGRIK to select all subscribers in that group and click the Next button, as shown in Figure 25.
 
 

Figure 25.
 
Select pubs_copy database as the subscription database and click the Next button, as shown in Figure 26.
 
 

Figure 26.
 
Specify how frequently Distribution Agent updates the subscription (in this example, every 1 day(s), every 20 minute(s) between 9:00:00 and 18:00:00) and click the Next button, as shown in Figure 27.
 
 

Figure 27.
 
Check Start the Snapshot Agent to begin the initialization process immediately and click the Next button, as shown in Figure 28.
 
 

Figure 28.
 
Click the Next button, as shown in Figure 29.
 
 

Figure 29.
 
Click the Finish button to subscribe with the options you specified on the previous steps, as shown in Figure 30.
 
 

Figure 30.
 
Click the Close button, as shown in Figure 31.
 
 

Figure 31.
 
Click the Close button to close the Create and Manage Publication dialog, as shown in Figure 23.
 
Note. On the last step we got the following message:
 
The subscription at Subscriber 'CHIGRIK' cannot be initializedimmediately because the snapshot for this publication is not yetavailable. To initialize the subscription, start the DistributionAgent after the snapshot is available.To work around it, you should start the Distribution Agent after the snapshot is available. See Figure 32.
 
 

Figure 32.
 
Backup and restore strategies
 
The backup and restore strategies are differ for each replication types. Here, I want to describe the backup and restore strategies for the Snapshot replication.
 
There are four main strategies for backing up and restoring Snapshot replication:
 
 

  • Backup Publisher, master and model databases.
  • Backup Publisher, Distributor, master and model databases.
  • Backup Publisher, Subscriber(s), master and model databases.
  • Backup Publisher, Distributor, Subscriber(s), master and model databases.
Backing up Publisher, master and model databases is a simplest strategy. This strategy has its own advantages and disadvantages. The advantages are that it requires the least amount of storage resources and does not require coordinating the backup with the backup of any other servers. The main disadvantage of this strategy is that you may need to setup replication from the beginning in the event of a Publisher or Distributor failure. With this strategy, you should backup publication database after changing existing publications or after the new publications were added.
 
Backing up Publisher, Distributor, master and model databases is a more frequently used strategy, than the first one, because in this case you don't need to reestablish replication in the event of a Publisher or Distributor failure. The main disadvantage of this strategy is that you should backup Publisher and Distributor's databases simultaneously (or as closely as possible). It also requires more computing and storage resources than the first way.
 
Backing up Publisher, Subscriber(s), master and model databases let you to reduce the amount of time required to recover a Subscriber(s) by avoiding the need to reinitialize the Subscriber(s) with a new snapshot, but in the event of a Distributor failure, you should setup replication from the beginning.
 
Backup Publisher, Distributor, Subscriber(s), master and model databases is a most complex backup strategy. The main advantage of this strategy is that in the event of a Publisher, Distributor or Subscriber(s) failure, you can quickly restore fail database without setting up replication from the beginning. The disadvantage of this strategy is that you should backup Publisher and Distributor's databases simultaneously (or as closely as possible), and this strategy requires most computing and storage resources.
 
For each strategy, you should backup msdb and master databases on the Publisher, Distributor and Subscriber(s). msdb database is used by SQL Server Agent for scheduling alerts and jobs (it contains also snapshot jobs), and master database is a main system database contains entries for each Subscriber(s), each login account, about system configuration settings and so on.