Random Thoughts by Paul Brun

SQL Server 2005 Databases Mirroring

Database Mirror How-TO

I have been to many sites and have visited the MSDN Technet forums, read up on all the details for Database Mirroring and even there, it doesn’t quite capture all the little things that must be done to create a successful mirror of a database.

Here is an extract from the Microsoft Website regarding Database Mirroring. Images are taken from the Microsoft Tech article as well from: http://msdn2.microsoft.com/en-us/library/ms189852.aspx

Database mirroring is a software solution for increasing database availability. Mirroring is implemented on a per-database basis and works only with databases that use the full recovery model. The simple and bulk-logged recovery models do not support database mirroring. Therefore, all bulk operations are always fully logged. Database mirroring works with any supported database compatibility level.

Database mirroring maintains two copies of a single database that must reside on different instances of SQL Server Database Engine (server instances). Typically, these server instances reside on computers in different locations. One server instance serves the database to clients (the principal server), while the other server instance acts as a hot or warm standby server (the mirror server), depending on the configuration and state of the mirroring session. When a database mirroring session is synchronized, database mirroring provides a hot standby server that supports rapid failover with no loss of data from committed transactions. When the session is not synchronized, the mirror server is typically available as a warm standby server (with possible data loss).

The idea here is not to repeat information that is already provided in the TechNet article, but to help those that are looking the multiple websites and provide an step by step guideline in creating a successful Database Mirror using a Witness server as seen in the following Microsoft image extracted from the website link above.

Manual Failover Mirror Concept

To accomplish automated failover in a production environment, you minimally require two instances of SQL Server Enterprise Edition and once instance of SQL Express which acts as the witness. The witness simply supports automatic failover by verifying whether the principal server is up and functioning. 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.

Setup Prerequisites

  • SQL Server SP1 applied to SQL Server install (via Microsoft updates). Database Mirroring supported with SP1 only.
  • Make sure each server is on the same domain.
  • Define one domain account that will be used for windows authentication on each system and add it to the administrator group on each system
  • All three server must be reachable via a Fully Qualified Domain Name (FQDN).
  • SQL Server Instance must run under the context of the Domain Account.
Steps
  1. Open SQL Server Management Studio on server hosting primary database
  2. Right click on the database that you would like to mirror and select Tasks –> Backup
  3. Perform a full backup and then a transaction log backup
  4. Copy the backup to the server hosting the secondary database
  5. Open SQL Server Management Studio (i.e., database should not exist at this point)
  6. Right Click on “Databases” and select “Restore Database”
  7. Type the name of the database in the “To Database” field
  8. Using the “From Device” option, select the copied backup.
  9. Select the “Full Backup”, and go to the Options Page.
  10. Make sure the second option (RESTORE with NORECOVERY) option is selected.
  11. Hit OK to restore database.
  12. Restore the Transaction Log database and make sure the “RESTORE with NORECOVERY” option is selected on the “Options”Page”
  13. At this point, you should see your database in the following state (Restoring)
  14. Go back to primary database server, right click on database and select Tasks –> Mirror
  15. In the new dialog, hit the “Configure Security” button
  16. Include the option to configure a “Witness” server
  17. Choose the appropriate locations for your principle, mirror and witness instance as long as the encryt endpoint option is deselected on each page.
  18. In the “Service Accounts” dialog, keep all fields blank as Windows Authentication will be used for database access using the aforementioned domain account.
  19. Each endpoint will be configured and each should succeed.
  20. Once complete, you have the option to start monitoring. Simply reconfirm that the server instances are accessed via their FQDN entries.
  21. Hit the start mirroring button.
This is it….this completes the Database Mirroring How-TO….please feel free to send me an email about your Database Mirroring experiences, or better yet, sign-on and post a response to this article.

Always back up your data

Doh….just recently….I got a new notebook for work purposes….it was great. I was happy to have gotten rid of the notebook that has been less than stellar in keeping a Wireless signal. I was happy, it was a new Dell D820…..slightly later than the D600, but I was happy to get the newer system.
Well….it wasn’t a week old when I came into work and turned it on and the control arms on the hard disk started making wierd noises…..and it was taking an extremely long time to load up into Windows and then blue screened on me every time I get into Windows.
Well….turns out the hard disk is shot and it will be next to impossible to get any data off the time……damn it….
Good thing they still have my old notebook with all my data, otherwise, I would have been somewhat dead in the water.
However, I still lost about 4 days of work…….which really tsucks as I have to make it up this weekend. Fortunately, it will take much faster to re-coup the lost effort. Whether in doubt, always make a backup copy of all your work…you never know the minute you turn the system on, that it will just stop functioning.
Fortunately, this weekend is rainy and damp, so I can make most of it up and it may come by a little faster, but who knows……
Oh well….time to get ready for my Ultimate game.

Citroen is possibly entering Canadian Market

What’s this…Citroen is possibly entering Canadian Market
I was wondering when this would happen. Citreon is considering entry into the Canadian market to test the North American waters. Check out this article:
Many of you may be wondering, who is Citreon? How can a French car maker enter hte North American market? My answers and thoughts will be forth coming, but would appreciate your initial views first.