Sometimes a problem occurs during the installation or operation of SQL Server and it needs to be completely reinstalled. These instructions will help you reinstall SQL Server while preventing any data loss.
Create a Backup of Your Database
You must make a backup of your information before making any changes to the system to prevent data loss1. Removing SQL Server always deletes your database. To retain your database information you will be required to restore a backup once you reinstall SQL Server. To backup your database:
Open the software if possible and go to File > Backup and Restore > Backup Database.
Follow the prompts to create a backup either on your computer's hard drive or on a USB flash drive. The particular location of the backup does not matter as long as it is a location you can remember and find later when the database needs to be restored.
Copying Your Database Directly2
If you cannot make a backup of your database and the software has not been making automatic backups, then you can copy the database file directly from the SQL Server data. If you already have a backup, then skip to the Uninstall SQL Server 2008 Express R2 section.
Go to Start Menu > All Programs > Microsoft SQL Server 2008 > Configuration Tools > SQL Server 2008 Configuration Manager
Click on SQL Server 2008 Services on the left side.
Stop the SQL instance that you were running your database on by right-clicking on the instance and then selecting Stop.
Go to Start Menu > My Computer if you are using Windows XP, or go to Start Menu > Computer if you are using Windows Vista, 7, or 8.
Typically, the database files are found in Local Disk (C:) > Program Files (x86) > Microsoft SQL Server > MSSQL.1 > MSSQL > Data.
Locate the files 123Pet.mdf and 123Pet.ldf. Highlight these two files, right-click, then select Copy.
Find a location that is appropriate (like Desktop), right-click, and select Paste to make a copy of your database files.
Uninstall SQL Server 2008 Express R2
Close the software on the computer if it's open.
Go to Windows Start > Control Panel.
Double-click on Add or Remove Programs if you are using Windows XP or Programs and Features if you are using Windows Vista, 7, or 8.
Look for items listed under Microsoft SQL Server.There should be at least four items listed. Two of these need to be removed: Note: removing these will also delete your database. Make sure you have made or found a recent backup file of your database to prevent data loss.
Microsoft SQL Server 2008
Microsoft SQL Server Native Client
Remove Microsoft SQL Server 2008.
Select Microsoft SQL Server 2008 in the list of programs and Remove or Uninstall.
You will be prompted to select which instance to remove. Eventually, you need to remove all instances. If there is only one choice, then select the bullet point next to this instance. If there are multiple instances, then pick the first one and you will need to come back to this step later to remove the other(s).
On this same screen, if you are given the option, check the box next to Worskstation Components under Remove SQL Server 2008 common components.
Click Next.
Select Finish on the following screen. This will begin the process of removing SQL Server. This process should take several minutes to finish.
If you originally had two or more instances of SQL Server, then repeat Steps A-E of this section for each remaining instance. Common SQL instances that you encounter will be CMJ and SQLEXPRESS.
Remove Microsoft SQL Server Native Client.
Select Microsoft SQL Server Native Client from the list of programs and select Remove or Uninstall.
The Native Client should be uninstalled automatically.
Check your program list for a program called Microsoft SQL Server Desktop Engine. If you see this program, then you should uninstall it the same way you uninstalled the Native Client. If you do not have this program installed, then skip to the next section.
Reinstall SQL Server Express R2
Download the installation file here.
Run the installation file.
Follow the prompts given by the installer. It may take several minutes to install.
Open 123Pet again when it's finished.
Restore the Database Backup
Since reinstalling SQL Server deletes your previously created database, you will need to restore that database from the backup created earlier.
In the software, go to File > Backup and Restore > Restore Database.
Click on Restore Database from Backup.
Choose Restore a database from a specific location.
Click Next.
Browse to the location where you saved the backup and double-click it.
If you originally set a database password, then you will be prompted to enter it at this time.
Your database will be restored into your software.
Restore from a Copy of a Database File
If you could not make a backup file or had no automatic backup files, then you can use your copied database files to restore your previously created database.
Open the software and when prompted create a Blank Database.
Close the software.
Go to Start Menu > All Programs > Microsoft SQL Server 2008 > Configuration Tools > SQL Server 2008 Configuration Manager.
Click on SQL Server 2008 Services on the left side.
Stop the SQL instance by right-clicking on the name and selecting Stop.
Locate the files 123Pet.mdf and 123Pet.ldf from the location that you copied them to earlier. Highlight these two files, right-click, then select Copy.
Go to Start Menu > My Computer if you are using Windows XP or Start Menu > Computer if you are using Windows Vista, 7, or 8.
Typically, the database files need to be pasted to Local Disk (C:) > Program Files > Microsoft SQL Server > MSSQL.1 > MSSQL > Data.
Find the appropriate file location of the new Blank Database that you created and then right-click and select Paste to copy the database files.
Choose Replace, or Replace and Copy for both files.
Go to Start Menu > All Programs > Microsoft SQL Server 2008 > Configuration Tools > SQL Server 2008 Configuration Manager.
Click on SQL Server 2008 Services on the left side.
Start the SQL instance by right-clicking on the name and selecting Start.
Open your software and your database will be restored.
1If you cannot open your software to create a database, check for your most recent automatic backup file. If you have not been making automatic backups, then you can make copies of your database files directly.
2We recommend making copies of your database files as a last resort. DaySmart Software, Inc. is not responsible for data lost from customer manipulation of the SQL database files.