Backing Up and Restoring Databases Advanced Database Dr. AlaaEddin Almabhouh.

Slides:



Advertisements
Similar presentations
TRANSACTION PROCESSING SYSTEM ROHIT KHOKHER. TRANSACTION RECOVERY TRANSACTION RECOVERY TRANSACTION STATES SERIALIZABILITY CONFLICT SERIALIZABILITY VIEW.
Advertisements

Backup Strategy. An Exam question will ask you to describe a backup strategy. Be able to explain: Safe, secure place in different location. Why? – For.
FlareCo Ltd ALTER DATABASE AdventureWorks SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS Slide 1.
DataBase Administration Scheduling jobs Backing up and restoring Performing basic defragmentation and index rebuilding Using alerts Archiving.
SQL Server Best Practices Keep Your Database In Top Performance Shape and Maintain Effective Backups September, 2007 Richard Kokoski.
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 1 IT390 Business Database Administration Unit 5 :
Week 9 – Chapter 8 SQL 710 Methods to Backup Databases
Genie Backup ManagerServer 7.0 Product Profile. Copyright© Genie-Soft Corporation All rights reserved. Overview GBM Server 7.0 is a fully integrated.
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.
Backing Up and Restoring Databases Lesson 16. Skills Matrix.
Module 5 Understanding SQL Server 2008 R2 Recovery Models.
Backup and Recovery (2) Oracle 10g CAP364 1 Hebah ElGibreen.
Backup and Recovery Part 1.
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
Transactions and Recovery
Presented by Joseph Galvan & Stacy Kemp BACKUPS.  Using database backups, a database administrator (DBA’s) can restore from the last backup or to a specific.
Introduction to Oracle Backup and Recovery
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
NovaBACKUP 10 xSP Technical Training By: Nathan Fouarge
Administration etc.. What is this ? This section is devoted to those bits that I could not find another home for… Again these may be useless, but humour.
SQL Server 2008 Implementation and Maintenance Chapter 7: Performing Backups and Restores.
1 Introducing Windows Backup There are different methods for starting Windows 2000 Backup. Requirements for running Windows 2000 Backup All users can back.
Chapter 11: Designing a Data Recovery Solution for a Database MCITP Administrator: Microsoft SQL Server 2005 Database Server Infrastructure Design Study.
Module 3: Managing Database Files. Overview Introduction to Data Structures Creating Databases Managing Databases Placing Database Files and Logs Optimizing.
EM408 Backup and Recovery of SQL Anywhere Tips and Techniques Reg Domaratzki Sustaining Engineering iAnywhere Solutions
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.
Chapter 18: Windows Server 2008 R2 and Active Directory Backup and Maintenance BAI617.
16 Copyright © 2007, Oracle. All rights reserved. Performing Database Recovery.
Databases Lesson 5.
Architecture Rajesh. Components of Database Engine.
Module 6 Backup of SQL Server 2008 R2 Databases. Module Overview Backing up Databases and Transaction Logs Managing Database Backups Working with Backup.
The protection of the DB against intentional or unintentional threats using computer-based or non- computer-based controls. Database Security – Part 2.
Managing Disks and Drives Chapter 13 powered by dj.
Mark A. Magumba Storage Management. What is storage An electronic place where computer may store data and instructions for retrieval The objective of.
Backup and Recovery Overview Supinfo Oracle Lab. 6.
11 DISASTER RECOVERY Chapter 13. Chapter 13: DISASTER RECOVERY2 OVERVIEW  Back up server data using the Backup utility and the Ntbackup command  Restore.
Views Lesson 7.
BACKUP & RECOVERY Option 1: Transaction Processing Systems.
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.
IT1001 – Personal Computer Hardware & system Operations Week7- Introduction to backup & restore tools Introduction to user account with access rights.
Learningcomputer.com SQL Server 2008 – Backup and Restore Database.
IMS 4212: Data and Database Administration 1 Dr. Lawrence West, Management Dept., University of Central Florida Data & Database Administration.
18 Copyright © 2004, Oracle. All rights reserved. Backup and Recovery Concepts.
Data Disaster Recovery Planning Greg Fibiger 1/7/2016.
Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
Thanapoom Boondee M.2/2 No.22. Pattawan Tangpattananon M.2/2No.5 Tuchatham Tosakul M.2/2No.13 Thanapoom Boondee M.2/2No.22 Suvit Pathomthanasarn M.2/2No.30.
Hands-On Microsoft Windows Server 2008 Chapter 7 Configuring and Managing Data Storage.
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.
SQL IMPLEMENTATION & ADMINISTRATION Backup/Restore and Replication.
6 Copyright © Oracle Corporation, All rights reserved. Backup and Recovery Overview.
Jeremy Kingry, eBECS | ADVANCED SQL SERVER FOR ADMINS AND ANALYSTS.
( ) 1 Chapter # 8 How Data is stored DATABASE.
WHAT ARE BACKUPS? Backups are the last line of defense against hardware failure, floods or fires the damage caused by a security breach or just accidental.
Administrating a Database
Database Administration
Managing Multi-User Databases
Backup and Recovery (1) Oracle 10g Hebah ElGibreen CAP364.
Back Up and Restore? Piece of Cake!
RPO, RTO & SLA: 3 Letter Words for When the SHT hits the FAN
Prepared by Jaroslav makovski
Performing Database Recovery
Administrating a Database
Backup & Recovery.
Presentation transcript:

Backing Up and Restoring Databases Advanced Database Dr. AlaaEddin Almabhouh

Learning outcomes At the end of this lesson, you will be able to:  Understand how backups work  Use the different types of backups  Restore a database from a back up files  Devise a backup strategies

Backups  Some features are common to all types of backup.  All backups in SQL Server are online backups, which means your users can access the database while you’re backing it up.  Once the backup completes, SQL Server backs up all the entries in the transaction log.

Backup Devices  To perform any type of backup, you need a place to store it.  The medium you’ll use to store a backup is called a backup device.  Backups are stored on a physical backup medium or media, which can be a tape drive or a hard disk (local or accessed over a network connection).  A backup device is a logical construct that provides this definition.

Types of Backup Devices  You can create two types of backup devices:  Temporary  Permanent  Temporary backup devices are created on the fly when you perform the backup.  You can use permanent backup devices over and over again; you can even append data to them, making them perfect devices for regularly scheduled backups.

Types of Backup Approaches  Full Backups  Differential Backups  Transaction Log Backups

Full Backups  Just as the name implies, a full backup records the entire database.  It backs up the database files, the locations of those files, and portions ( أجزاء ) of the transaction log.  All other backup types depend on the existence of a full backup.  This means you can’t use a differential or transaction log backup if you have never performed a full backup.

Differential Backups  Differential backups record all the changes made to a database since the last full backup was performed.  The differential backup gets a little bigger each time it’s performed, but it’s still a great deal smaller than the full backup.  So, a differential executes faster than a full backup.

Transaction Log Backups  Although they rely on the existence of a full backup, transaction log backups don’t back up the database itself.  This type of backup records only sections of the transaction log; specifically, those activities since the last transaction log backup.

Transaction Log Backups  When a transaction log becomes 100 percent full, users lose access to the database until an administrator clears the transaction log.  Perform regular ( منتظم ) log backups to ensure continuous database availability.

Filegroup Backups  Full, differential, and transaction log backups are great for small to large databases, but consider using filegroup backups for databases measured in terabytes.  Essentially, a filegroup provides a way of storing a database on more than one file, and it gives you the ability to control in which of those files you store objects (such as tables or indexes).  The files must be backed up as a single unit; you can’t back up the tables one night and the associated indexes the next.  To perform a filegroup backup, you need to create a filegroup.

Copy-Only Backups  special backup of a database outside your normal backup scheme.  Does not affect the logs or database.  You do this using the COPY_ONLY option of the BACKUP statement.

Backing Up to Multiple Devices  If you really want to speed up the process, you can perform backups to multiple devices at the same time.  If you want to do this with tape devices, you need more than one local tape drive in the SQL Server machine.  This type of backup uses multiple devices in parallel and writes the data in stripes ( أشرطة ) across the media.

Example 1: Backing up a complete database BACKUP DATABASE AdventureWorks TO DISK = ‘C:\SQLServerBackups\AdvWorksData.bak' WITH FORMAT; GO

Example 2: Backing up the database and log -- Back up the full AdventureWorks2012 database. BACKUP DATABASE AdventureWorks2012 TO DISK = ‘C:\SQLServerBackups\AdvWorksData.bak'; GO -- Back up the AdventureWorks2012 log. BACKUP LOG AdventureWorks2012 TO DISK = ‘D:\SQLServerBackups\AdvWorksLog.bak'; GO

On-Line Resources  BACKUP (Transact-SQL)   Back Up and Restore of SQL Server Databases   Introduction to SQL Server Database Backup and Restore Using Management Studio   Introduction to SQL Server Database Backup and Restore Using T-SQL 

Restoring Databases  Regularly rehearse كرر recovering your database before the expected disaster occurs.  Suspect or corrupt databases aren’t the only reasons to perform restores, though.  You may, for example, need to send a copy of one of your databases to the home office or to a branch office for synchronization.

Restoring Databases  The restore operation will likely miss recovering the last transactions entered by users, so be sure to alert your users of the need to restore.  Train them how to verify that the last few entries still exist after your restoration effort.  Some corporations train users to maintain today’s records until tomorrow in case a daily backup and subsequent restore misses all of yesterday’s data entries.

Recovery Option  The RECOVERY option, when set incorrectly, can thwart إحباط all your efforts to restore a database.  The RECOVERY option tells SQL Server that you’ve finished restoring the database and that users should be allowed back in.  Use this option only on the last file of the restore process.

Restoring to Location  SQL Server also remembers where the original files were located when you backed them up.  Thus, if you backed up files from the D:\ drive, SQL Server will restore them to the D:\ drive.  In this instance, you need to use the MOVE…TO option. MOVE…TO lets you back up a database in one location and move it to another location.

Restore Check  Finally, before allowing you to restore a database, SQL Server performs a safety check to make sure you aren’t accidentally restoring the wrong database.  SQL Server compares the database name being restored to the name of the database recorded in the backup device.

Piecemeal Restore  Piecemeal تدريجي restores restore the primary filegroup and (optionally) some secondary filegroups and make them accessible to users.  You can restore the remaining secondary filegroups later if needed.

Online Restore  Normally a database restore requires exclusive access to the database.  For larger databases, a restore operation can take hours.  When the Enterprise Edition of SQL Server is in use, the online option for restores is available.  Online restores are automatic and require the use of different filegroups so that different filegroups, files, or even individual pages can be restored.  This could be extremely useful in the event of a torn or damaged page in a large highly busy database.

Backup Strategy  Plan a backup strategy that details when to use which type of backup.  If you have a relatively small database, you can perform just full backups with no other type.  A full backup only strategy results in a comparatively slow backup when compared to other strategies.  A full backup only strategy results in a faster restore process than with other strategies because it uses only one storage device.

Backup Strategy  The transaction log clears only when you perform a transaction log backup.  With a full-only strategy, your transaction log may fill completely locking your users out of the database.

Backup Strategy  You can avoid this problem in two ways:  Set the recovery model for the database to Simple.  Instructs SQL Server to completely empty the log every time it writes to the database from the log (a process called checkpointing).  You’ll lose up-to-the-minute recoverability because the latest transactions will be deleted every time the server checkpoints.  If your database crashes, you can restore it only to the time of the last full backup.

Backup Strategy  Second, you can perform the full backup and, immediately afterward, perform a transaction log backup with the TRUNCATE_ONLY clause.  This option frees space, but risks possible data loss.  After the log truncates by using either NO_LOG or TRUNCATE_ONLY, the changes recorded in the truncated portion of the log become unrecoverable.  Therefore, for recovery purposes, after using either of these options, you must immediately execute BACKUP DATABASE to take a full or differential database backup—not a recommended strategy.

Planning for Full Backups with Differential Backups  A full/differential strategy provides a faster backup than full alone.  With a full-only backup strategy, you’re backing up the entire database every time you perform a backup.  With a full/differential strategy, you’re backing up only the changes made to the database since the last full backup, which should be faster than backing up the whole database.  The full/differential strategy has the major disadvantage of being slower when restoring than with the full-only strategy, because full/differential sets require you to restore more backup sets.

Planning for Full Backups with Differential Backups  Be aware that differential backups don’t clear the transaction log.  If you opt for this method, you should clear the transaction log manually by backing up the transaction log.

Planning for Full with Transaction Log Backups  Consider full/transaction backups with small or huge databases.  This method offers several advantages.  It’s the best method to keep your transaction logs clean, because this type of backup purges old transactions from your transaction logs.  It makes for a fast backup process.  This strategy requires more restoration time than full alone or full/differential.

Planning for Full, Differential, and Transaction Log Backups  If you combine all three types of backups, you get the best of all worlds.  The backup and restore processes are still relatively fast, and you have the advantage of point-in-time restores as well.

Planning for Filegroup Backups  You learned the mechanics of the filegroup backup earlier in this lesson, so you know they’re designed to back up small chunks of the database at a time rather than the whole database all at once.  This may come in handy, for example, with a 700 GB database contained in three files in three separate filegroups.  When a disk fails, you need to restore the backup of the filegroup that failed and the transaction log backups that occurred after the filegroup was backed up.

Slide 81 (of 82) Q & A