Changing Owner or Mirrored DBs

  • houming1982 (4/16/2013)


    If we need to do modifications on mirror database, we must make it writable (set partner off + restore with recovery). But if the mirroring should be reset, we must restore the last backup of the principal database, then the log, then the mirroring, which means all the modifications we did on mirror database is meaningless...

    Assume that the dbowner of the principal database is "A", and your SQL account is "B". when you restore the backup of the principal database to the DR instance, the dbowner of the mirror database will be "B". How could we change "B" to "A" on the mirror database if we do not want to do the failover, please?

    regards

    Easiest way, connect to the mirror server as "A", rather than yourself, and run the restores.

  • Gazareth (4/16/2013)


    Easiest way, connect to the mirror server as "A", rather than yourself, and run the restores.

    What if we do not know the password of the login "A"?

  • houming1982 (4/17/2013)


    Gazareth (4/16/2013)


    Easiest way, connect to the mirror server as "A", rather than yourself, and run the restores.

    What if we do not know the password of the login "A"?

    Unfortunately, in that case you'll need to go through the failover process.

    Wish you could specify the owner as part of the restore statement but no joy. Not sure if 'execute as' would work but I wouldn't count on it 🙂

  • Unfortunately, in that case you'll need to go through the failover process.

    Wish you could specify the owner as part of the restore statement but no joy. Not sure if 'execute as' would work but I wouldn't count on it 🙂

    Thank you very much for your reply, Gazareth. I tried with "execute as login = 'A'", then restore backup and log by commands (the prerequisite is that login "A" has the same permissions on both servers), and it works! 😀

  • houming1982 (4/19/2013)


    Unfortunately, in that case you'll need to go through the failover process.

    Wish you could specify the owner as part of the restore statement but no joy. Not sure if 'execute as' would work but I wouldn't count on it 🙂

    Thank you very much for your reply, Gazareth. I tried with "execute as login = 'A'", then restore backup and log by commands (the prerequisite is that login "A" has the same permissions on both servers), and it works! 😀

    Cool, did not expect that to work! Good one to remember! 🙂

    Cheers

    Gaz

Viewing 5 posts - 16 through 19 (of 19 total)

You must be logged in to reply to this topic. Login to reply