Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a SQL server database with data supplied from a 3rd party. They supply a tool to update the database data weekly. The tool is pretty old and uses ODBC. The update can take several hours. In order to have high availability, it was suggested to have 2 SQL databases, and store a "active database" setting in another database to determine which of the two databases applications should use (while the other could be being updated).

One issue we are running into is: How to do reference the active database in stored procedures in other databases?

Is this the right approach, or is there a better way?

Notes: Updates can either be incremental or can delete all database data then recreate the data. Databases are currently read-only besides the update tool.

share|improve this question
add comment

1 Answer

What a DELIGHTFULLY CONVOLUTED solution they offer - Try the following:

  • Have two database servers, A & B
  • Have a DB IP address (in addition to the base IP addresses of your systems)
    • Assign the DB IP address to whichever DB server you want queries to go to

When update time comes:

  • Update the inactive machine ("Machine B")
  • Swap the DB IP address onto "Machine B"
  • Update "Machine A"

Note that this is susceptible to ARP cache issues -- You could also get the same results with DNS & a (very) short TTL (assuming your DNS TTLs are respected), a high-availability package that uses a virtual MAC, or with a load-balancing front-end.

share|improve this answer
    
I begin to see the wisdom of MongoDBs solution for this problem. Just assume (or guarantee for the ones you write) the drivers take multiple hostnames/ips in their connection strings and let the clients sort it out. Of course that only works when multi master is a given. –  Justin Dearing Nov 16 '10 at 16:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.