Showing posts with label mirroring. Show all posts
Showing posts with label mirroring. Show all posts

Monday, March 12, 2012

how best to tackle logins with SQL authentication after automatic failover

In an sql authentication environment with an automatic failover in database mirroring how to you manage new logins which have been created on the principle since the start of mirroring? Since the master cannot be mirrored, and the mirror database cannot be read during mirroring (except as a snapshot) in order to find the missing logins, I assume that only after failover a script should run to create the new logins and then run sp_change_users_login . The qestions are:

1) should the script create a new login first and then run sp_change_users_login with option update_one , or should sp_change_users_login using option

Auto_Fix create the missing logins?

2) But what is the password of these users? is it initially NULL , as a consequence of sp_change_users_login? What about the SIDs?

3) Or should we bypass sp_change_users_login altogether and use

CREATE LOGIN <loginname> WITH PASSWORD = <password>, SID = <sid for same login on principal server>,...as described in http://blogs.msdn.com/chadboyd/archive/2007/01/05/login-failures-connecting-to-new-principal-after-failover-using-database-mirroring.aspx

4) What is the event that would trigger this script to run after the aitomatic failover ?

Is there a definitive MIcrosoft agreed apon and recommended method to tackle this?

If you want your application users to connect after failover you better create those logins beforehand @. both the principal and @. mirror server @. the time of configuring mirroring so that they will be available to you but will be mismatched and after failover you can correct them using sp_change_users_login sp.

and for the less important ones you can make use of SSIS to transfer logins frequently so that after failover you can just restore the master syslogins table or master db and fix the mismatch by change users login sp......

|||

Thank you for your anwer. My question was about the new logins created after mirroring had begun. Of course before mirroring started the existing logins were recreated on the mirrorserver beforehand . The question was whether sp_change_users_login should be used with update_one or Auto_Fix or not used at all . The auto fix option creates a login if there isn't one. The update_one option does not .

Assuming rhat SSIS would transfer the new logins from the princiopal master to the mirror master while database mirroring would transfer the users from the principal to the mirror. Will the SIDs be in order? If a script has to be run it would have to be run automatically so what is the trigger that this script will be triggered by?

|||

Actually there are a few issues here:

Firstly SSIS will not help you because as of 2005 the Transfer Logins task does not transfer the passwords, it resets the passwords which to be honest wouldn't help especially if you are using the High Availability option.

Next, you need to take care of the SID's otherwise you will have to sync them. See this KB article

Lastly, In 2005 you cannot create a login which has a default database that is offline. So if an app needs to use Automatic Client Redirect in a High Availability setup and the account is created on the Principal after mirroring has been configured, you will not be able to add the login on the Mirror. The only workaround is to bring the mirror online periodically and sync the logins. I heard it may be fixed in 2008 however; I have not tried yet, maybe someone can clarify for me.

Friday, February 24, 2012

Hot vs. warm standby

We have neither log shipping nor database mirroring on our system, so the
only way I could experiment with a standby database was to restore a backup
to a new database, using the standby option. Is the database I created a hot
or a warm standby? Can both kinds be used as a read-only data source for
queries or reports?I'd call your implementation a warm standby.
Yes, you can query such a database restored using STANDBY.
As for LS and M:
For LS, you can query the db is you restore using STANDBY, but you have to kick out the users for
each new log restore. Not very practical.
For mirroring, you can create a database snapshot of the mirrored database and query that snapshot.
I do recommend that you evaluate your HS requirements and your scalability requirements separately
and then decide which technology is best suited for each (HA and scalability). It might happen that
the same technology is good for both, but it isn't uncommon to use different technologies for the
two.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Bev Kaufman" <BevKaufman@.discussions.microsoft.com> wrote in message
news:6F37569F-1767-4F58-B0AB-90EBB83620AE@.microsoft.com...
> We have neither log shipping nor database mirroring on our system, so the
> only way I could experiment with a standby database was to restore a backup
> to a new database, using the standby option. Is the database I created a hot
> or a warm standby? Can both kinds be used as a read-only data source for
> queries or reports?
>|||Generally:
They call "Hot standby" when there is automatic failover in the high
availbility system. (Like SQL Server Failover Clustering or Database
Mirroring with High Availibility mode)
"Warm standby" when you can failover manually. (Log Shipping and Database
Mirroring's High Performance and Protection modes etc.)
Attach\detach, backup\restore kind of stuff is called "Cold standby"
Also I wanted to add to Tibor's message that, you'll need Enterprise Edition
of SQL Server 2005 to be able to use Database Snapshot in your environment.
--
Ekrem Ã?nsoy
http://www.ekremonsoy.net , http://ekremonsoy.blogspot.com
MCBDA, MCITP:DBA, MCSD.Net, MCSE, MCBMSP, MCT
"Bev Kaufman" <BevKaufman@.discussions.microsoft.com> wrote in message
news:6F37569F-1767-4F58-B0AB-90EBB83620AE@.microsoft.com...
> We have neither log shipping nor database mirroring on our system, so the
> only way I could experiment with a standby database was to restore a
> backup
> to a new database, using the standby option. Is the database I created a
> hot
> or a warm standby? Can both kinds be used as a read-only data source for
> queries or reports?
>