Let us learn how to get the last restore date for the backup in SQL Server. Here is a very simple script for the same. It will give you all the necessary history from the msdb database.
If you want to clear any backup or restore history for the database, you can just run the following simple script and it will remove your history from the msdb database.
Here is an example of how you can remove the history for the AdventureWorks Database. Let me know your thoughts about this blog post. Below are tables in the MSDB database for the database restoration history. This table contains the row for each database restoration performed.
In the following image, we can see the essential columns of this table:. We get the row for each restored file. You will get the detail of each physical file that was restored by the backup file. We can do filegroup restore as well in SQL Server. Each database has Primary filegroup that contains primary data file MDF. Let us fetch information from the MSDB using internal tables with the following query.
However, if a SQL Server 9. If you set upgrade option to Import or Rebuild , the full-text indexes will be unavailable during the upgrade. Depending on the amount of data being indexed, importing can take several hours; rebuilding will take up to 10 times longer. When you set upgrade option to Import , if a full-text catalog isn't available, the associated full-text indexes are rebuilt.
On the General page, use the Source section to specify the source and location of the backup sets to restore. Select one of the following options:. Select the database to restore from the drop-down list. The list contains only databases that have been backed up according to the msdb backup history. If the backup is taken from a different server, the destination server will not have the backup history information for the specified database.
In this case, select Device to manually specify the file or device to restore. Click the browse Backup media type Select a media type from the Backup media type drop-down list. Note: The Tape option appears only if a tape drive is mounted on the computer, and the Backup Device option appears, only if at least one backup device exists.
Add Depending on the type of media you select from the Backup media type drop-down list, clicking Add opens one of the following dialog boxes.
If the list in the Backup media list box is full, the Add button is unavailable. Remove Removes one or more selected files, tapes, or logical backup devices. Contents Displays the media contents of a selected file, tape, or logical backup device.
This button may not function if the media type is URL. After you add the devices you want to the Backup media list box, click OK to return to the General page. In the Source: Device: Database list box, select the name of the database that should be restored. This list is only available when Device is selected. Only databases that have backups on the selected device will be available.
In the Destination section, the Database box is automatically populated with the name of the database to be restored. To change the name of the database, enter the new name in the Database box. In the Restore to box, leave the default as To the last backup taken or click on Timeline to access the Backup Timeline dialog box to manually select a point in time to stop the recovery action.
For more information on selecting a specific point in time, see Backup Timeline. In the Backup sets to restore grid, select the backups to restore. This grid displays the backups available for the specified location.
By default, a recovery plan is suggested. To override the suggested recovery plan, you can change the selections in the grid. Backups that depend on the restoration of an earlier backup are automatically deselected when the earlier backup is deselected. For information about the columns in the Backup sets to restore grid, see Restore Database General Page. Optionally, click Files in the Select a page pane to access the Files dialog box.
From here, you can restore the database to a new location by specifying a new restore destination for each file in the Restore the database files as grid. For more information about this grid, see Restore Database Files Page.
To view or select the advanced options, on the Options page, in the Restore options panel, you can select any of the following options, if appropriate for your situation:.
No additional transaction logs cannot be restored. Select this option if you're restoring all of the necessary backups now.
0コメント