I set up a database mirroring and then used this connectionstring
to connect to it:
Data Source={0};Failover Partner={1};Initial Catalog=AdventureWorks;
Integrated Security=True;
After adding some data into database, I shutdown the principal server, so the mirror server becomes the principal server. I open the connection again, an get this error:
System.Data.SqlClient.SqlException: A transport-level error has
occurred when sending the request to the server. (provider: Shared Memory
Provider, error: 0 - No process is on the other end of the pipe.)
I thought that with Failover Partner specified in the connection string, ADO.NET would do the work for me. So what should I do now?
To pause or resume database mirroring During a database mirroring session, connect to the principal server instance, in Object Explorer, click the server name to expand the server tree. Expand Databases, and select the database. Right-click the database, select Tasks, and then click Mirror.
The mirror server initiates automatic failover only if the mirror and the witness remain connected to each other after both have been disconnected from the principal server.
Means if we change a page on the mirrored database, we will copy its origin state over to the snapshot. Means instead reading it from the origin database, the snapshot now will read it out of its own file.
Automatic failover is supported only in database mirroring sessions running with a witness in high-safety mode (high-safety mode with automatic failover). In high-safety mode with automatic failover, once the database is synchronized, if the principal database becomes unavailable, an automatic failover occurs.
Fortunately, I fixed this problem. All I need to do is calling ClearPool method:
SqlConnection.ClearPool(conn);
This method will clear the connection pool. Then, the problem's gone. I'm so happy with it.
Thank you, all of you, for your support. :D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With