سؤال

Is there a way to change the owner of a read-only database which is configured with Log Shipping without actually re setting up LS?

Per this link it's not, but I'm checking if anything has changed since then.

هل كانت مفيدة؟

المحلول

When you say "without re setting up LS", are you able to have an outage to fix this?

If so, then look at using tail-log backups and recovering the secondary database to make this change. The high-level process would be:

  1. Stop LSBackup, LSCopy and LSRestore (after ensuring there are no pending copies or restores)
  2. Perform a tail-log backup. The primary DB will now be in recovery and inaccessible
  3. Restore the tail-log backup on the secondary and recover the database. It will now be online.
  4. Change the database owner as required.
  5. Perform a tail-log backup on the secondary. It will now be in recovery and unavailable.
  6. Restore the tail-log to the primary and recover it.
  7. Re-enable your log shipping jobs and manually execute LSBackup, LSCopy and LSRestore

After this, your primary should be back online and your secondary back in a read-only state. As stated, this will cause an outage on your primary but this may be preferable to reinitialising log shipping on a large DB. Also, make sure you test this process in a non-Production environment first, and have the entire process scripted. SQLCMD mode is a great way to run this as you can script the whole process and run from a single script using the CONNECT option to change between your primary and secondary machine.

Tail-Log Backups

SSMS in SQLCMD Mode

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى dba.stackexchange
scroll top