c++ - Modify mirroring_partner_instance name in sys.database_mirroring -
i have issue correctly failing on mirror database. when connected principal database (dbx) (mirroring enabled , set up) , fail on principal database (shutting down sql server simulate crash), can no longer send queries without failure. expected since previous connection lost.
i close out connections , handles , re-establish new connection, using same connection string, , re-connect mirror database (dby, principal database).
my connection string follows:
driver={sql native client};server=dbx;failover_partner=dby;database=db;uid=uid;pwd=pwd;network=dbmssocn;
from doing research, have learned failover_partner parameter in connection worthless. used when principal server down , new connection being made first time. reason, failover_partner overwritten internally when connection established principal , mirroring_partner_instance found in sys.database_mirroring table used instead. when specify failover_partner dby, after establish connection, query thinks failover partner is, , returns instance name of failover partner , not dns name (dby).
here issue, cannot use instance name failover partner. required use dns name failover partner.
so question(s) is/are this:
- is there way modify sys.database_mirroring entry , change mirroring_partner_instance?
- where field value from?
- is there other way force sql server use dns name , not instance name?
i found answer question in case has same or similar issue.
i had modify @@servername property in sql. internally set computer win-... instance name , able drop , add server name wanted following commands:
get current server name (win_name)
select @@servername
drop win-name
sp_dropserver 'win_name' go sp_addserver 'server_name',local go
restart sql server see changes take effect.
Comments
Post a Comment