Microsoft SQL Server Administration for SAP Database Backup and Restore

Preview:

Citation preview

Microsoft SQL Server Microsoft SQL Server Administration for SAPAdministration for SAP

Database Backup and RestoreDatabase Backup and Restore

2

OverviewOverview

SQL Server ArchitectureSQL Server Architecture SQL Server with SAPSQL Server with SAP Performance Monitoring and TuningPerformance Monitoring and Tuning Administration and TroubleshootingAdministration and Troubleshooting Database Backup and RestoreDatabase Backup and Restore

3

Importance of BackupImportance of Backup

User ErrorsUser Errors

Physical ErrorsPhysical Errors

External FactorsExternal Factors

Logical ErrorsLogical Errors

4

Recovery ModelsRecovery Models

Full Full No work lossNo work loss Supports recovery to any point-in-timeSupports recovery to any point-in-time

SimpleSimple Simplest backup/restore strategySimplest backup/restore strategy Less log space requiredLess log space required Greatest work loss possibleGreatest work loss possible

Bulk_LoggedBulk_Logged High performance bulk operationsHigh performance bulk operations Minimal log space for bulk operationsMinimal log space for bulk operations Some work loss exposureSome work loss exposure

5

BackupBackup

FullFull DifferentialDifferential LogLog FileFile File GroupFile Group NT BackupNT Backup

6

Full BackupFull Backup

Copy all used data pages to the backup media

Data

Andre Vasser Hil Frenzen

X0 X1 X2 X3 X4 X5 X6 X7

Kojak MagnumDerrick Marple

X8 X9 X10 X11 X12 X13 X14 X15

Landis Wolf Wang Kerber Kania Thomas Merdes

X16 X17 X18 X19 X20 X21 X22 X23

Mozart Bach Strauss Wagner Beeth.

X24 X25 X26 X27 X28 X29 X30 X31

1111

Copy all used log pages to the backup media

Set the timestamp of the backup to the time when the backup has finished

Transaction Log

begin update begin insert commit chkp insert rollback

LSN0 LSN1 LSN2 LSN3 LSN4 LSN5 LSN6 LSN7

delete

LSN8 LSN9 LSN10 LSN11 LSN12 LSN13 LSN14 LSN15

LSN16 LSN17 LSN18 LSN19 LSN20 LSN21 LSN22 LSN23

LSN24 LSN25 LSN26 LSN27 LSN28 LSN29 LSN30 LSN31

2222

3333

7

Log BackupLog Backup

Copy all used log pages to the backup media

begin1 update begin2 insert commit2 chkp insert begin3

LSN0 LSN1 LSN2 LSN3 LSN4 LSN5 LSN6 LSN7

delete dump commit1 chkp insert insert delete delete

LSN8 LSN9 LSN10 LSN11 LSN12 LSN13 LSN14 LSN15

insert

LSN16 LSN17 LSN18 LSN19 LSN20 LSN21 LSN22 LSN23

LSN24 LSN25 LSN26 LSN27 LSN28 LSN29 LSN30 LSN31

1111

Transaction Log

Truncate the inactive portion of the transaction log

begin1 update begin2 insert commit2 chkp insert begin3

LSN0 LSN1 LSN2 LSN3 LSN4 LSN5 LSN6 LSN7

delete dump commit1 chkp insert insert delete delete

LSN8 LSN9 LSN10 LSN11 LSN12 LSN13 LSN14 LSN15

insert

LSN16 LSN17 LSN18 LSN19 LSN20 LSN21 LSN22 LSN23

LSN24 LSN25 LSN26 LSN27 LSN28 LSN29 LSN30 LSN31

2222

Transaction Log

8

Differential BackupDifferential Backup

Andre Vasser Schumi Frenzen

X0 X1 X2 X3 X4 X5 X6 X7

Kojak Rex Derrick Marple

X8 X9 X10 X11 X12 X13 X14 X15

Dilg Wolf Wang Kerber Kania Thomas

X16 X17 X18 X19 X20 X21 X22 X23

Mozart Bach Strauss

X24 X25 X26 X27 X28 X29 X30 X31

Data

Copy all modified records since the last full database backup to the backup media1111

Copy all used log pages to the backup media

Set the timestamp of the backup to the time when the backup has finished

Transaction Log

begin update begin insert commit chkp insert rollback

LSN0 LSN1 LSN2 LSN3 LSN4 LSN5 LSN6 LSN7

delete

LSN8 LSN9 LSN10 LSN11 LSN12 LSN13 LSN14 LSN15

LSN16 LSN17 LSN18 LSN19 LSN20 LSN21 LSN22 LSN23

LSN24 LSN25 LSN26 LSN27 LSN28 LSN29 LSN30 LSN31

2222

3333

9

File BackupFile Backup

...

<SID>DATA1

<SID>DATA2

<SID>DATA3

<SID>DATAnCopy one or more database files to the backup media

1111

10

Filegroup BackupFilegroup Backup

PRIMARY...

<SID>DATA1

<SID>DATA2

<SID>DATA3

<SID>DATAnCopy one filegroup to the backup media

1111

11

NT BackupNT Backup Directory Files Directory Files

X:\<SID>DATA1 Primary data fileX:\<SID>DATA2 Secondary data fileX:\<SID>DATA3 Secondary data file

Y:\<SID>LOG1 Transaction log file

Z:\Tempdb data and log files of the tempdb

C:\Mssql7\Backup Default Backup directoryBinn MS SQL Server executablesBooks Online documentationData System and sample database filesHtml Enterprise Manager Html Files Install Installation scripts and logsJob Temporary job output filesLog Errorlogs and JoblogsRepldata Working directory for replication tasksUpgrade Files used for upgrade (6.5 to 7.0)

D:\usr\sap\<SID> R/3 executablestrans Transport directory

E:\WINNT NT System directory

Copy all R/3 and SQL Server files to the backup media1111

Create a document containingthe file structure2222

File System Structure

12

How to Perform a BackupHow to Perform a Backup

MonthlyMonthlyBackupBackupCycleCycle

Query Analyzer

??. . . .

Mon Tue Wed Thu Fri Sat

Tue Wed Thu Fri Sat Sun

Mon Tue Wed Thu Fri Sat Sun

Mon

SunTue

Mon Tue Wed Thu Fri Sat Sun

regularTue

SQLEnterprise Manager

unplanned

CCMS DBA Calendar (DB13)

13

Backup Requirements and CostsBackup Requirements and CostsDuration of a backup

Time window for a recovery

High availability

Training

Administrative workload

Acquisition costs

14

Backup strategiesBackup strategies

Single DB and Transaction Log Single DB and Transaction Log BackupsBackups

Parallel Tape SupportParallel Tape Support Two-Step Disk BackupTwo-Step Disk Backup Supplementary Differential BackupsSupplementary Differential Backups Hot-Standby ServerHot-Standby Server

15

Restore ProcedureRestore Procedure

Availability

ONLINETargetActual

OFFLINE

Replace hardwareand set up system

Problemanalysis

Applytransaction

logs

Automaticrecovery

Time

Restoredatabase

16

Data Volume CrashData Volume Crash

Back up recent transaction logBack up recent transaction log

Replace RAID systemReplace RAID system

Restore R/3 databaseRestore R/3 database

Restore transaction logsRestore transaction logs

Check restore operationCheck restore operation

<SID>

<SID>

<SID>

Procedure andescalation plan

PRIMARY

<SID>DATA3

<SID>DATA2

<SID>DATA1

17

Log Volume CrashLog Volume Crash

Replace RAID systemReplace RAID system

Restore R/3 databaseRestore R/3 database

Restore transaction logsRestore transaction logs

Check restore operationCheck restore operation

<SID>

<SID>

Procedure andescalation plan

<SID>LOG1 <SID>LOG1

18

Executable Volume CrashExecutable Volume Crash

Reload lost files from latest NT Backup

Reload lost files from latest NT Backup

Reboot Primary NTReboot Primary NT

Restore msdb (and master) Database

Restore msdb (and master) Database

Check Restore OperationCheck Restore Operation

Procedure andEscalation Plan

Replace disks and installauxiliary NT

Replace disks and installauxiliary NT

msdb master

Directory Directory

C:\Tempdb

C:\Mssql7\

C:\usr\sap\

C:\WINNT

19

SummarySummaryRAID 1 crash :Log files lost

<SID> suspect

Replace crashed disk(s), synchronize RAID

SQL Restore of database and transaction logs

Automatic recovery

OK Some data lost! OK OK OK

NT Restore of EXEs;not log file(s)!

RAID 5 crash:Data files lost<SID> suspect

System crash: Data + EXEs lostSQL Server down

Exe disk crash: EXEs lost

SQL Server down

One disk crash

Shut down SQL Server

SQL Restore of msdb (and master)

Back up log <SID> with

no_truncate

20

System CrashSystem Crash

Reload executables from latest NT Backup

Reload executables from latest NT Backup

Reboot primary NTReboot primary NT

Restore msdb (and master) database

Restore msdb (and master) database

Check restore operationCheck restore operation

Procedure andescalation plan

Replace hardware and install auxiliary NT

Replace hardware and install auxiliary NT

msdb master

Directory Directory

C:\Tempdb

C:\Mssql7\

C:\usr\sap\

C:\WINNT

Restore R/3 databaseRestore R/3 database

Restore transaction logsRestore transaction logs <SID>

<SID>

21

Backup and restoreBackup and restore

Log marksLog marks RESTORE optionsRESTORE options

RECOVERY, NORECOVERY, STANDBY RECOVERY, NORECOVERY, STANDBY

Backup passwordBackup password Snapshot BackupSnapshot Backup Database Copy WizardDatabase Copy Wizard New Backup modesNew Backup modes

22

Hot standbyHot standby

Scheduled movement of T-logsScheduled movement of T-logs Pulled to secondary machine(s)Pulled to secondary machine(s) Copies all Logged OperationsCopies all Logged Operations

DML + schema, permissions, roles,...DML + schema, permissions, roles,...

Setup & managed via Maintenance Setup & managed via Maintenance ‘Plan’‘Plan’

Interactive remote monitoringInteractive remote monitoring Used for creating ‘warm backup’ DBsUsed for creating ‘warm backup’ DBs Roll reversal (swap source <-> Roll reversal (swap source <->

destination)destination)

23

DB12DB12

24

Backup HistoryBackup History

25

SQL Agent SettingsSQL Agent Settings

26

Backup DeviceBackup Device

27

JobsJobs

28

Restore informationRestore information

29

DB13 CalendarDB13 Calendar

30

DB13 Scheduling BackupDB13 Scheduling Backup

31

DB13 Scheduling BackupDB13 Scheduling Backup

32

DB13 Scheduling BackupDB13 Scheduling Backup

33

DB13 Scheduling BackupDB13 Scheduling Backup

34

DB13 CalendarDB13 Calendar

35

Failed JobFailed Job

36

Failed JobFailed Job

37

Jobs in SQL ServerJobs in SQL Server

38

Backup from SQL Enterprise Backup from SQL Enterprise ManagerManager

39

Backup from SQL Enterprise Backup from SQL Enterprise ManagerManager

40

Backup from SQL Enterprise Backup from SQL Enterprise ManagerManager

41

Backup from SQL Enterprise Backup from SQL Enterprise ManagerManager

42

Backup from SQL Enterprise Backup from SQL Enterprise ManagerManager

43

Restore from SQL Enterprise Restore from SQL Enterprise ManagerManager

44

Restore from SQL Enterprise Restore from SQL Enterprise ManagerManager

45

Failed Job in SQL ServerFailed Job in SQL Server

46

Details of the failed jobDetails of the failed job

47

Details of the failed jobDetails of the failed job

48

Job InformationJob Information

49

Job InformationJob Information

50

Job ScheduleJob Schedule

51

NotificationNotification

52

Backup DeviceBackup Device

53

Backup – media set nameBackup – media set name

54

Restore from DeviceRestore from Device

55

Point in time restorePoint in time restore

56

LabLab

Create a Backup DeviceCreate a Backup Device Backup using CCMSBackup using CCMS Backup using SQL Enterprise Backup using SQL Enterprise

ManagerManager Backup from Query AnalyzerBackup from Query Analyzer Check the media naming convention Check the media naming convention

by SAPby SAP Setup a stand by database and Setup a stand by database and

switch to the standby databaseswitch to the standby database

57

LabLab

Restore using SQL Enterprise Restore using SQL Enterprise ManagerManager

Restore from Query Analyzer(1 full Restore from Query Analyzer(1 full backup followed by 2 trans log backup followed by 2 trans log restore)restore)

Setup log shipping and switch to the Setup log shipping and switch to the backup serverbackup server

Perform point-in-time recoveryPerform point-in-time recovery

58

SummarySummary

Write module summaryWrite module summary

Recommended