Section 18 - Backup / Restore Microsoft SQL Server

This section describes how to backup and restore Microsoft SQL Server with the OBM.




18.5.2 Restore Microsoft SQL Server 2005 / 2008 database



    Table of Contents:



18.5.2.1 Restore master database


    Refer to the following instructions to restore the master database:





    18.5.2.2 Restore other system or user database (complete backup)



    Refer to the following instructions to restore a complete backup:



18.5.2.3 Restore other system or user database (differential / transaction log backup)

    Refer to the following instructions to restore a differential or transaction log backup:

    1. Open SQL Server Management Studio; connect to the server where the backup is to be restored.

      Important
      Backups must be restored in the order in which they were created.

      Transaction log can only be applied to database in WITH NORECOVERY recovery state.

      If the database to be restored is not in NORECOVERY recovery state, restore the previous backup using the following recovery state option:

      [Leave the database non-operational, and do not roll back the uncommitted transactions. Additional transaction logs can be restored].

    2. Expand [Databases].

      Select the corresponding user database or system database.

    3. Right click the database, [Tasks], [Restore], and then click [Database] or [Transaction Log] according to the backup file you are restoring.

    4. Select [From file or tape]; click the browse button to open the [Specify Backup] dialog box. Click [Add].
    5. Browse to the backup file (restored from the OBS) that is to be restored.

    6. After adding the differential database or transaction log file to the [Backup location] list box, click [OK] to return to the General page.
    7. In the [Select the backup sets to restore] grid, select the backups to restore.

    8. Click the Options page and select appropriate options for the restore operation.

      For the [Recovery state] setting:

      Important:
      If this is the final backup to be restored, select [Leave database ready to use by rolling back uncommitted transactions. Additional transaction logs cannot be restored].

      If there are further differential or transaction log to be applied, selection one of the other two options for the Recovery completion state.

    9. To start the restore operation, click OK.

    18.5.3 Restore Microsoft SQL Server 2012 database

    18.5.3.1 Restore master database

    Refer to the following instructions to restore the master database:

    1. Stop the SQL instance.
    2. Restart the SQL instance in single-user mode.
      • In SQL Server Configuration Manager, click [SQL Server Services].
      • In the right pane, right-click SQL Server, and then click [Properties].

      • On the Startup Parameters tab, type the parameter .m in the specify startup parameter box and click on [Add] and click on [OK]

      • Restore the database engine afterward.

      Important:
      When you start SQL Server in single-user mode, first stop SQL Server Agent.

      Otherwise, SQL Server Agent might connect first, preventing you from connecting as a second user.

    3. To restore a full database backup of master, use the following RESTORE DATABASE Transact-SQL statement:
      >RESTORE DATABASE master FROM ${backup_device} WITH REPLACE

      ${backup_device} is the database file restored from the OBS:

      C:\>sqlcmd
      
      1>RESTORE DATABASE master FROM DISK = .C:\temp\master.bak. WITH REPLACE;
      
      2>GO
      
    4. After master is restored, the instance of SQL Server shuts down and terminates the sqlcmd process.

      Before you restart the server instance, ensure to remove the single user startup parameter that you have added previously in Step 2.

    5. Restart the server instance and continue other recovery steps such as restoring other databases.

    18.5.3.2 Restore other system or user database

    Refer to the following instructions to restore a backup:

    1. Open SQL Server Management Studio; connect to the server where the backup is to be restored.
    2. Expand [Databases].

      Depending on the database, either selects a user database or expands [System Databases], and then selects a system database.

    3. Right click the database, point to [Tasks], clicks [Restore], and then click [Database].

      Note:
      SQL Server databases may be backed up on one server and restored to another server.

      If the target database does not exist on the server, right click on any database instead. A new database can be created while restoring the backup.

    4. On the General page, the name of the restoring database appears in the [To database] list box.

      To create a new database, enter its name in the list box.

    5. Select Source > Device and click the browse button to open the [Select backup device] dialog box. Click [Add].
    6. Browse to the backup file (restored from the OBS) that is to be restored.

    7. After adding the complete database file and transaction log files to the [Backup media] list box, click [OK] to return to the General page.
    8. In the [Backup sets to restore] grid, select the backups to restore.

    9. To restore the backup to the last backup state click [OK] button. If you want to restore the backup to a specific time line go to the next step.
    10. With Timeline option

    11. Click on the [Timeline] button to restore the backup to a specific time line

    12. Choose the [Specific date and time] button, and you can select the specific time to restore. Click [OK] to confirm.

    13. Click [OK] to start restore, or if you need to relocate the restore files on another folder, you can go to the next option.
    14. With relocate all file and folder option

    15. Click on the "Files" page on the left panel.

    16. Click on the check box "Relocate all files to folder" and you can select the folder path by clicking the folder selection button on the right hand side.

    17. Choose the folder path that you need the files to relocate and click OK.

    18. Click [OK] on the "Files" page to start the restore. If Taillog backup restore is required, go to the next option.
    19. With Taillog backup restore option

    20. Click on the "Option" page on the left panel.

    21. Click on the check box of the "Take tail-log backup before restore" option, and also select the backup file destination from the right hand side.

    22. Click [OK] to start the restore.