Microsoft SQLServer Restore / Redirected Restore Procedure
Table of Contents INTRODUCTION 3 TYPES OF RESTORE 3 STEPS INVOLVED IN THE RESTORE 3 IDENTIFY THE DATABASE 3 LOGIN TO SQL SERVER MANAGEMENT STUDIO 4 SELECT THE DATABASE PROPERTIES 4 DATABASE FILE PROPERTIES 5 SELECT THE DATABASE 6 SELECT THE RESTORE OPTION 7 SELECT TO RESTORE THE PHYSICAL FILE 8 SELECT THE BACKUP SET 10 OPTIONS 11 SELECTION FOR REDIRECTED RESTORE 12 P a g e 2 Document version 1.7.15
Introduction Types of Restore The SQL Server supports 2 type of restore, namely; a) Normal Restore; You can use the normal restore if you want to have the current database restored back into the same database (so a backup of the Database you will be overwriting must to be done first) b) Redirected Restore;.A redirected restore will restore the data from the point at which the last backup was done to a specified Workarea. Steps involved in the Restore Identify the database In order to identify the database, we need to go into PCSchool. Go to Utilities and in the drop down menu there is a submenu called Work area maintenance. Click on the browse button to view a list of the registered Workareas. Select a Workarea to find the database it uses and the server on which the database exists. As per the below sample, you can see the server is dennispc\sqlexpress (normal format is severname\sqlserver instance name) and the database name is PCSchool. Different work areas will have different SQL server databases. P a g e 3 Document version 1.7.15
Login to SQL Server Management Studio Once the database is identified, we then need to open the sql server management studio and either login as a windows user or as an SQL server user (normally PCSchool sql server user is a powerful user and you can complete the login as that user). Select the database properties P a g e 4 Document version 1.7.15
Database file properties We need to look into the properties of the database and navigate to its files to see what the physical file name involved is. Each database should have a logical file name and a physical file name. It s possible to have different logical file names and a single physical file name. This means, if your physical file name is the same, then the data changes made by one application will reflect in the other. We need to note down the physical file name and we should use it when we do the restore in the steps below. P a g e 5 Document version 1.7.15
Select the database Once we know the physical file name, we can start our restore process. This involves selecting the database and selecting the option for Restore. P a g e 6 Document version 1.7.15
Select the Restore Option There are 2 different restore options possible. a) Normal restore; We will select From device on the assumption that we need to restore this backup into the database it was taken from, thus overwriting the data in there. b) Redirected restore; If we select From Database, this means you are going to do a redirected restore. P a g e 7 Document version 1.7.15
Select to Restore the physical file As we did in the backup procedure, we need to select the physical location of where the backup is stored. By default you should be following the path of your last backup, but if it s not the case or if it s different, remove it and add the correct location. P a g e 8 Document version 1.7.15
P a g e 9 Document version 1.7.15
Select the Backup set Once this is done, we will reach the main screen of the restore where we can see the last backup set, of that database backup. We need to select one of the backup sets. A backup set comes into play when we do the database backup wherein we have the option to say Overwrite the existing backup set or Append to existing set. P a g e 10 Document version 1.7.15
Options Before we do the restore, we need to make changes in the options tab, after selecting the backup set. This options tab will have information read from the backup set. What Microsoft does is, whenever a backup is taken, it will store information on What the database name is, What the physical location was and What the physical file name is. If we have the backup of a database (lets say PCSchool database) and if we are trying to restore the current PCSchool database with this backup, everything should be okay. But when you have a backup of PCSchool and you are trying to restore it on some other work area. A common situation is, trying to restore to PCSPlay, we need to make sure that the path is correct. As we have taken the file name and its path in our initial step, it s just a matter of pointing it to correct path and physical file. This is applicable for redirected restore and normal restore. Basically, each database will have 2 files with the same database name but with a different extension. For example; if the database name is PCSchool, you will have a PCSchool.mdf and a PCSchool_log.ldf. So you need to set the path and file name correctly. P a g e 11 Document version 1.7.15
Selection for redirected restore In the case of redirected restore you would need to select the option From Database on the initial restore screen. On selecting this you would need to know, what database you are restoring from and what database you are restoring it to. In the below example, I am trying to restore the database to PCSPlay from PCSchool. After this selection, you have to go to the options and set the correct details for the Restore as section. P a g e 12 Document version 1.7.15