SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Mirroring failover via T-SQL


Mirroring failover via T-SQL

Author
Message
jimkern
jimkern
SSC Veteran
SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)

Group: General Forum Members
Points: 202 Visits: 79
I have a mirrored database and I would like to create (or use, if they already exist) a set of stored procedures that "Front" the tasks in the Mirror properties dialog - (Pause, resume, failover).

Several questions - do such procs already exist somewhere that I can tap into or will I have to create them myself, assuming that there are T-SQL statements that can be called to perform those actions? Where would they be and/or where should I create them? MSDB? Elsewhere?

Can I create a database user that is NOT the SA user (or dbowner at all for my database) but has authority to perform those operations?

I would like to build into my existing front-end "dashboard" application, the ability to call these functions and perform those operations, but I do not want to have to use SA to get those done.

Any thoughts? Did I pose the question clearly enough?

Thanks in advance for any help!

Jim
JeremyE
JeremyE
SSCertifiable
SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)

Group: General Forum Members
Points: 5924 Visits: 4088
Pause:
ALTER DATABASE your_db_name SET PARTNER SUSPEND
GO

Resume:
ALTER DATABASE your_db_name SET PARTNER RESUME
GO

Failover:
ALTER DATABASE your_db_name SET PARTNER FAILOVER
GO
jimkern
jimkern
SSC Veteran
SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)

Group: General Forum Members
Points: 202 Visits: 79
Thanks for the syntax on those statements. If I built stored procedures for each of those statements, would I put them in MSDB?

What permissions/role would a user have to be to be able to execute those statements? Anything special, or would they just need execute permission on those procs?

Jim
JeremyE
JeremyE
SSCertifiable
SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)

Group: General Forum Members
Points: 5924 Visits: 4088
Users would also need the "ALTER" permission for each mirrored db.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search