Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Wait for Mirror treshold

By Wilfred van Dijk,

This procedure is very handy if you want to control the load on a mirrored database. For example rebuilding indexes on the principal database generates a lot of load on the mirrored database (especially with a snapshot).

In order to control the load on a mirrored server, create this procedure (on the principal) and insert a call to this procedure between each "heavy" (statement on the principal).

For example, I rebuild my indexes by a cursor loop and just before I fetch the next index, I call this procedure. This procedure takes the mirror tresholds from SQL. NOTE: By using this procedure, you still might get messages in your errorlog about mirror tresholds. This procedure only slows down your statements (in order to give the mirrored database more breath).

In order to prevent an infinite execution of this statement, @MaxWaitSeconds determines the number of seconds before this procedure aborts (a returncode is set).
@Checkdelay is the delaytime before the tresholds are checked again.

Total article views: 459 | Views in the last 30 days: 1
 
Related Articles
FORUM

Database Mirroring

Database Mirroring - Index on Principal

FORUM

Mirrored Database

Mirrored Database

FORUM

database mirroring

database mirroring

FORUM

Database Mirroring

Database Mirroring

FORUM

Database mirroring

Database mirroring

Tags
administration    
database mirroring    
t-sql    
 
Contribute