HiveBrain v1.2.0
Get Started
← Back to all entries
patternModerate

what is the penalty for NOT setting Disconnect users in the database when restoring backups?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
thebackupspenaltywhatrestoringdatabasesettingforwhenusers

Problem

setting up Log shipping between 2 sql server 2016 servers
I want my databases read-only standby on the secondary server.

there is a tick box saying Disconnect users in the database when restoring backups.

what if I don't tick this box?
The restore of the log would not come trough because it could not get exclusive lock on the database?

But then, what if someone is logged in for hours? Hours without restoring the logs?

Solution

From this page in the MS documentation:


There are two options for configuration when you place the secondary
database in standby mode:


You can choose to have database users disconnected when transaction
log backups are being restored. If you choose this option, users will
be disconnected from the database each time the log shipping restore
job attempts to restore a transaction log to the secondary database.
Disconnection will happen on the schedule you set for the restore job.


You can choose not to disconnect users. In this case, the restore job
cannot restore transaction log backups to the secondary database if
there are users connected to that database. Transaction log backups
will accumulate until there are no user connections to the database.

So yes, it could be hours, days, weeks, or years without a restore if users are still connected to the secondary.

Context

StackExchange Database Administrators Q#224918, answer score: 10

Revisions (0)

No revisions yet.