Worked example: Getting Started |
See Also |
This worked example provides a basic overview of how to use SQL Log Rescue.
In the example, the Magic Widget Company has a SQL Server 2000 database running on a live web server. This database contains tables that have been modified in error, and three records that have been deleted must be restored.
You will see how to:
You will need access to a SQL Server 2000 to do this.
If you want to follow the example using your own system, you must create the Widgets database on your server. If this database exists already on your server, delete it. Then, click here to open the SQL creation file for the databases, and run the file in Microsoft® SQL Server™ 2000 Query Analyzer.
The script creates the Widgets database, backs it up, inserts some data, and modifies the data.
SQL Log Rescue automatically retrieves the backup for the Widgets database and displays it in the Choose Database Backups page.
The Choose Database Backups page enables you to change the backups that SQL Log Rescue will include in the analysis.
If you have not installed the SQL Log Rescue extended stored procedure on the server, you are prompted to install it. Click Yes on the prompt box to install the extended stored procedure.
SQL Log Rescue displays the Backup File Warnings page.
Any problems with the included backups are displayed here. For example, if you had omitted to include a full database backup, a warning would be displayed. For this example, there are no warnings.
SQL Log Rescue analyzes the database, and the log entries from the live transaction log are displayed in the main window.
SQL Log Rescue projects are saved with the suffix .slr
The log entries table (top pane) displays the list of log entries.
For ease of viewing, you can group the log entries by a particular column. In this case, we will use the Transaction ID column: drag the column header to the area above the table. You can then expand and collapse the individual groups as required.
You can also sort, group, and filter the columns, as you will see later in this example. For full details of how to use the log entries view see Viewing log entries.
You can use the tabs at the bottom of the main window to view the log entries in more detail. If you cannot see the tabs, on the View menu, click Dock All Windows to display the default view.
SQL Log Rescue displays only the log entries for the WidgetDescriptions table.
The Row Data tab shows details of the operation.
The updated values are displayed in blue text. A browse button is displayed for the Description and Picture values. This is because they are large object data types. Click the buttons to see details of the large objects.
If the appropriate backups have been included, you can also view the full history of a row.
SQL Log Rescue searches the table names and row details and displays the log entries that contain the string.
The Row History tab shows details of the operations that have occurred on that row.
You can view the SQL code for undoing and redoing operations.
The Type column is shaded to show that it is the sort column, and to indicate the order.
SQL Log Rescue displays the SQL code to undo the table drop.
Note that for large table reconstruction, SQL Log Rescue shows only a section of the Undo script in this pane.
For more information see Viewing Log Entry Details.
To undo operations, you first select the log entries you want to undo by clicking the appropriate check boxes in the left-hand column of the log entries table. For this worked example, you want to undo all the deletions.
When you have selected the log entries, click Undo Operations . The Undo Operations wizard displays a summary of the operations that the SQL script will perform when you run it.
A warnings tab is displayed for you to review. For this example, three standard warnings are displayed to inform you that triggers, foreign keys, and cascade deletes are not disabled.
You can ignore the warnings for this example.
To see the SQL script to undo the log entries, click the SQL Script tab.
When you have reviewed the script, click Next. The Data Recovery page is displayed.
You can now choose either to run the SQL script from within SQL Log Rescue, or to launch SQL Query Analyzer so that you can edit the script. In this example, we will choose to run the script (the default).
Click Finish to start the undo operation.
The script is run, and the log entries table is updated. Clear the filter on the Type column by clicking the down-arrow and clicking All. Operations performed by SQL Log Rescue are shaded, and is displayed next to the entries to indicate that they are part of a transaction performed by SQL Log Rescue.
You have successfully recovered the deleted records.
© Red Gate Software Ltd 2005. All Rights Reserved.