Module 7 Restoring SQL Server 2008 R2 Databases. Module Overview Understanding the Restore Process Restoring Databases Working with Point-in-time Recovery.

Slides:



Advertisements
Similar presentations
Module 8 Importing and Exporting Data. Module Overview Transferring Data To/From SQL Server Importing & Exporting Table Data Inserting Data in Bulk.
Advertisements

Module 12: Auditing SQL Server Environments
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
Module 4 Working with Databases. Module Overview Overview of SQL Server Databases Working with Files and Filegroups Moving Database Files.
Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.
FlareCo Ltd ALTER DATABASE AdventureWorks SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS Slide 1.
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 1 IT390 Business Database Administration Unit 5 :
SQL Server Data Protection and High Availability Anil Desai.
5 Copyright © 2006, Oracle. All rights reserved. Database Recovery.
Microsoft SQL Server Administration for SAP Database Backup and Restore.
Module 7: Restoring Databases. Overview SQL Server Recovery Process Preparing to Restore a Database Restoring Backups Restoring Databases from Different.
Module 6: Backing Up Databases. Overview Preventing Data Loss Setting and Changing a Database Recovery Model SQL Server Backup When to Back Up Databases.
Database Backup and Recovery
Backup and Recovery in SQL Server. Back-up and Restore Planning Goals and Objectives Implementation Training and Testing Execution BACKING UP AND RESTORING.
Module 5 Understanding SQL Server 2008 R2 Recovery Models.
Backup and Recovery (2) Oracle 10g CAP364 1 Hebah ElGibreen.
Backup and Recovery Part 1.
5. SQL Restore tasks Objectives –Learn howto recover databases from disaster Contents –View database and transaction log backup files –Perform a complete.
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
Modification is sent by application to SQL Server Modification is sent by application to SQL Server 1 Data pages are located in, or.
Transaction log grows unexpectedly
Module 8 Implementing Backup and Recovery. Module Overview Planning Backup and Recovery Backing Up Exchange Server 2010 Restoring Exchange Server 2010.
1 Chapter Overview Understanding Backup Terms, Media, and Devices Backing Up Databases, Files, Filegroups, and Transaction Logs Restoring a User Database.
Using RMAN to Perform Recovery
Module 13 Automating SQL Server 2008 R2 Management.
20 Copyright © 2004, Oracle. All rights reserved. Database Recovery.
Microsoft ® Official Course Module 12 Monitoring, Managing, and Recovering AD DS.
SQL Server 2008 Implementation and Maintenance Chapter 7: Performing Backups and Restores.
Course 6425A Module 9: Implementing an Active Directory Domain Services Maintenance Plan Presentation: 55 minutes Lab: 75 minutes This module helps students.
Module 18 Monitoring SQL Server 2008 R2. Module Overview Monitoring Activity Capturing and Managing Performance Data Analyzing Collected Performance Data.
Microsoft ® Official Course Module 13 Troubleshooting and Recovering Windows 8.
Module 13: Configuring Availability of Network Resources and Content.
It is one of the techniques to create a stand by server. Introduced in SQL 2000,enhanced in It is a High Availability as well as Disaster recovery.
16 Copyright © 2007, Oracle. All rights reserved. Performing Database Recovery.
Module 9 Authenticating and Authorizing Users. Module Overview Authenticating Connections to SQL Server Authorizing Logins to Access Databases Authorization.
Module 9 Planning a Disaster Recovery Solution. Module Overview Planning for Disaster Mitigation Planning Exchange Server Backup Planning Exchange Server.
Module 6 Backup of SQL Server 2008 R2 Databases. Module Overview Backing up Databases and Transaction Logs Managing Database Backups Working with Backup.
Module 14 Configuring Security for SQL Server Agent.
Module 16: Performing Ongoing Database Maintenance
MS SQL by: Bryan Bankhead CIS 407. General Concepts  Backing up and Restoring databases and transaction logs is a way that SQL Server provides protection.
Today’s Topics Backup Recap Restoration and Recovery T-SQL Commands –INSERT –UPDATE –DELETE –BEGIN TRAN –COMMIT TRAN –ROLLBACK TRAN.
Module 13 Implementing Business Continuity. Module Overview Protecting and Recovering Content Working with Backup and Restore for Disaster Recovery Implementing.
Module 15 Monitoring SQL Server 2008 R2 with Alerts and Notifications.
Module 15 Managing Windows Server® 2008 Backup and Restore.
Module 14 Monitoring and Optimizing SharePoint Performance.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
1 Chapter Overview Understanding Data Restoration Issues Understanding the Types of Database Backups Understanding the Restoration Process.
Connect with life Vinod Kumar Technology Evangelist - Microsoft
12 Copyright © Oracle Corporation, All rights reserved. User-Managed Complete Recovery.
18 Copyright © 2004, Oracle. All rights reserved. Backup and Recovery Concepts.
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
Backup and Recovery - II - Checkpoint - Transaction log – active portion - Database Recovery.
Data Disaster Recovery Planning Greg Fibiger 1/7/2016.
16 Copyright © 2005, Oracle. All rights reserved. Performing Database Recovery.
8 Copyright © 2007, Oracle. All rights reserved. Using RMAN to Duplicate a Database.
18 Copyright © 2004, Oracle. All rights reserved. Recovery Concepts.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
Praveen Srivatsa Director| AstrhaSoft Consulting blogs.asthrasoft.com/praveens |
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
Digging Out From Corruption Eddie Wuerch, MCM - Principal, Database Performance - Salesforce Marketing Cloud Data protection and loss recovery with SQL.
9 Copyright © 2004, Oracle. All rights reserved. Incomplete Recovery.
14 Copyright © 2007, Oracle. All rights reserved. Backup and Recovery Concepts.
Database Administration
Curacao SQL Saturday June 11, 2016
SQL Backups for Beginners by Mark Gordon
Back Up and Restore? Piece of Cake!
Database Backup and recovery
Workshop.
Performing Database Recovery
Backup & Recovery.
Presentation transcript:

Module 7 Restoring SQL Server 2008 R2 Databases

Module Overview Understanding the Restore Process Restoring Databases Working with Point-in-time Recovery Restoring System Databases and Individual Files

Lesson 1: Understanding the Restore Process Types of Restores Preparation for Restoring Backups Discussion: Determining Required Backups to Restore

Types of Restores Restore Types: Complete Database Restore in Simple recovery model Complete Database Restore in Full recovery model System Database Restore Restoring damaged Files only Advanced Restore Options including Online, Piecemeal, Page restore

Preparations for Restoring Backups Perform a tail-log backup if needed  Only applies to full and bulk-logged recovery model Identify the backups to restore  Last Full, File or Filegroup backup as a base  Last differential backup, if applicable  Log backups if using full and bulk-logged recovery model

Discussion: Determining Required Backups to Restore Backup schedule  Full database backups Saturday 10PM  Differential backups Monday, Tuesday, Thursday, Friday at 10PM  Log backups every hour (on the hour) from 9AM to 6PM Failure Occurred at Thursday at 10:30AM What should restore process should be followed?

Lesson 2: Restoring Databases Phases of the Restore Process WITH RECOVERY Option Restoring a Database Restoring a Transaction Log WITH STANDBY Option Demonstration 2A: Restoring Databases

Phases of the Restore Process The restore process of a SQL Server 2008 R2 database happens in three phases Redo and Undo are called Recovery PhaseDescription Data CopyCreates files and copies data to the files RedoApplies committed transactions from restored log entries UndoRolls back transactions that were uncommitted at the recovery point

WITH RECOVERY Option A database must be recovered before it can be brought online WITH RECOVERY (default) restore option performs a recovery after restore and brings the database online WITH NORECOVERY restore option leaves the database in a recovering state  Allows additional restore operations on the database Restore process always involves  WITH NORECOVERY for all backups restored except the last  WITH RECOVERY for the last backup restored

Restoring a Database RESTORE DATABASE AdventureWorks2008R2 FROM DISK = 'D:\SQLBackups\AW.bak' WITH RECOVERY; GO RESTORE DATABASE AdventureWorks2008R2 FROM DISK = 'D:\SQLBackups\AW.bak' WITH RECOVERY; GO Full and differential backups are restored using the RESTORE DATABASE statement Only the last differential backup needs to be restored Restore each backup in order and WITH NORECOVERY, if additional transaction log backups need to be restored

Restoring a Transaction Log RESTORE LOG Payroll FROM DISK = 'D:\SQLBackups\PayrollLogs.bak' WITH NORECOVERY; GO RESTORE LOG Payroll FROM DISK = 'D:\SQLBackups\PayrollLogs.bak' WITH NORECOVERY; GO Transaction Log Backups are restored using the RESTORE LOG statement An unbroken log chain sequence must be provided

WITH STANDBY Option Allows read-only access to an unrecovered database  A standby file is used to hold undo phase details Main usage scenarios are:  Creating a Standby Server with read-only access to the data (Log Shipping)  Inspecting a database between log restores RESTORE LOG Payroll FROM DISK = 'D:\Backups\PyLg.bak' WITH STANDBY = 'D:\Backups\ULog.bak'; RESTORE LOG Payroll FROM DISK = 'D:\Backups\PyLg.bak' WITH STANDBY = 'D:\Backups\ULog.bak';

Demonstration 2A: Restoring Databases In this demonstration, you will see how to restore databases in full recovery model

Lesson 3: Working with Point-in-time Recovery Overview of Point-in-time Recovery STOPAT Option Discussion: Synchronizing Recovery of Multiple Databases STOPATMARK Option Demonstration 3A: Using STOPATMARK

Overview of Point-in-time Recovery Enables recovery of a database up to a point in time Point in time can be defined by:  datetime value provided  mark set through a named transaction Database must be in FULL recovery model Logs may contain BULK_LOGGED sections  If the transaction log backup containing the point in time includes minimally-logged operations, the restore fails

STOPAT Option Can be utilized from SSMS or T-SQL Provide STOPAT with RECOVERY as part of all RESTORE statements in the sequence  No need to know in which transaction log backup the requested point in time resides  If the point in time is after the time included in the backup, a warning will be issued and the database will not be recovered  If the point in time is before the time included in the backup, the RESTORE statement fails  If the point in time provided is within the time frame of the backup, the database is recovered up to that point

Notes Page Over-flow Slide. Do Not Print Slide. See Notes pane.

Discussion: Synchronizing Recovery of Multiple Databases An application might use data in more than a single database, including data in multiple SQL Server instances  Do you use any multi-database applications?  What problems might occur when the databases need to be restored?  Why might restoring up to a point in time not be sufficient?

STOPATMARK Option Can only be performed using T-SQL Transactions marked using:  BEGIN TRAN WITH MARK Restore has two related options:  STOPATMARK rolls forward to the mark and includes the marked transaction in the roll forward  STOPBEFOREMARK rolls forward to the mark and excludes marked the transaction from the roll forward If the mark is not present in the transaction log backup, the backup is restored, but the database is not recovered

Demonstration 3A: Using STOPATMARK In this demonstration you will see how to restore a database up to a mark in transaction log

Lesson 4: Restoring System Databases and Individual Files Recovering System Databases Restoring the master Database Restoring a File or Filegroup from a Backup Demonstration 4A: Restoring a File

Recovering System Databases System DatabaseDescription masterBackup Required: Yes Recovery Model: Simple Restore using Single User Mode modelBackup Required: Yes Recovery Model: User configurable Restore using –T3608 trace flag msdbBackup Required: Yes Recovery Model: Simple (default) Restore like any user database tempdb /resourceNo backups can be performed tempdb is created during instance startup Restore resource using file restore or setup

Notes Page Over-flow Slide. Do Not Print Slide. See Notes pane.

Restoring the master Database Start the server instance in single user mode Use the RESTORE DATABASE statement to restore a full database backup of the master database 2. SQL will shut down and terminate the SQLCMD process Restart SQL Server normally (not single user) 4.

Restoring a File or Filegroup from a Backup Create a tail-log backup Restore damaged file or filegroup from a recent backup 2. Restore differential file backups Restore transaction logs sequentially * 4. Recover the database 5. * Restore the transaction log backups in sequence starting with the log that covers the oldest file and ending with the tail-log (Full/Bulk- Logged Recovery Models Only)

Demonstration 4A: Restoring a File In this demonstration, you will see how to restore a file from a full database backup in full recovery mode

Lab 7: Restoring SQL Server 2008 R2 Databases Exercise 1: Determine a restore strategy Exercise 2: Restore the database Challenge Exercise 3: Using STANDBY mode (Only if time permits) Logon information Estimated time: 45 minutes

Lab Scenario You have performed a database backup for the Proseware, Inc. databases. You need to test the database restore process. You have been provided with a series of backups taken from a database on another server that you need to restore to the Proseware, Inc. server with the database name MarketYields. The backup file includes a number of full, differential, and log backups. You need to identify backups contained within the file, determine which backups need to be restored, and perform the restore operations. When you restore the database, you need to ensure that it is left as a warm standby, as additional log backups may be applied at a later date. If you have time, you should test the standby operation.

Lab Review Why does STANDBY mode require an operating system file? If the last restore on a database was performed WITH NORECOVERY and no further transaction logs are available, how can the database be brought online?

Module Review and Takeaways Review Questions Best Practices