SQL mirror failover/virtual ip question

Status
Not open for further replies.

nuwanda

Wise, Aged Ars Veteran
172
We've had SQL 2005 mirroring running successfully for a while now, but the issue I have is our applications reference the primary server by name directly and when the mirror fails over to box #2 I'm faced with either manually changing the connection string or bringing back #1.

So is there a way to reference the mirror as a group? Is there a virtual IP or name that will work for either?

I realize this is a fairly basic thing, but I can't seem to get good answers on what the correct set up should be.
 
Are these web apps I use sql 2005 mirroring for all our web apps that are coded with asp.net. This is what our developers did

Client-side Redirect
In SQL Server 2005, if you connect to a database that is being mirrored with ADO.NET or the SQL Native Client, your application can take advantage of the drivers' ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string, and optionally the failover partner server.

There are many ways to write the connection string, but here is one example, specifying server A as the principal, server B as the mirror, and AdventureWorks as the database name:

"Data Source=A;Failover Partner=B;Initial Catalog=AdventureWorks;Integrated Security=True;"
 

nuwanda

Wise, Aged Ars Veteran
172
@anthony75

Thanks! You are right, these are asp.net apps for the most part.

I added the "failover parnter" portion of the connection string and it accepts it and everything stays running.

Since I can't test just one database (it has to be the whole server) I'll have to wait for a quieter time of day to try the actual failover, but so far so good.
 
I assume you are not using windows accounts if you are using sql accounts you must set that account up on the other server. Basically there is a command that you run on the source server it will actually guve you the sid of the sql accounts than theres another command thats run on the target server that creates the sql account using that sid. If you don't do this you will get logon errors. I will will try to find the KB tonight and post the link.
 
Status
Not open for further replies.