Zero Downtime Backup of MaxDB database with HP Data Protector Technical whitepaper Table of contents Executive summary............................................................................................................................... 3 Supported systems ............................................................................................................................... 3 Introduction........................................................................................................
Using the MaxDB DBM GUI......................................................................................................... 27 Other useful dmbcli commands .................................................................................................. 29 Performing a MaxDB datafiles restore............................................................................................... 30 Performing a MaxDB archive logfiles restore ......................................................................
Executive summary At the moment, there is no official DP-MaxDB interface to perform Zero Downtime Backup (ZDB) and Instant Recovery for Data Protector versions 5.5, 6.0, as well as 6.1. However, it is possible to perform ZDB using a scripted solution. This white paper provides the procedure on how to ZDB a MaxDB instance and potentially restore it to any point in time or to the latest point in time.
SAP MaxDB SAP MaxDB is the database management system developed and supported by SAP AG. It has its focus on the requirements of SAP customers and SAP applications and can be used as a less expensive alternative to databases from other vendors for your own or third-party applications as well.
SMIS agent The SMIS agent is Data Protector’s ZDB-agent that controls the disk controller of the EVA through the SMI-S interface. SMIS is an attempt by vendors to describe hardware, functionality, and processes in a generic, common way. It is controlled by SNIA (Storage Network Industry Association), and major storage companies like HP, IBM, EMC, Hitachi, Oracle, StorageTek, Brocade (and smaller ones too) contribute to this standard. See http://www.snia.
Concept According to SAP Note 371247, ZDB can be performed on a MaxDB instance if all its data volumes are split consistently at the same time. It also adds that if this prerequisite cannot be met, there is a workaround, SAP Note 616814, in which MaxDB’s logwriter must be suspended before the ZDB split process so that the data volume is made consistent and can then be zero downtime backed up. In multi-disk environments, it cannot be guaranteed that all volumes are split at the same time.
MaxDB Application Server configuration When configuring a MaxDB instance, take care where the following MaxDB volumes will be configured on the array: Data Volumes containing data must reside on splitable disks. It is highly recommended that you locate data volumes on a dedicated LUN, and that archive redolog1 files are not part of the same location. – See the screenshot illustrating various data and log volumes of a MaxDB instance in the Archive log mode section on page 10.
MaxDB architecture Figure 3. MaxDB architecture session flow dbmcli/dbmgui dbmweb client connect server wahttp X_Server start start dbm server Log Volumes MAX DB Kernel Data Volumes per instance/session Database Manager The Database Manager has a client/server architecture. The DBM Server is responsible for the functions, and the user uses the client to access the tool. Database Manager clients can be used for remote connections.
Database instance Every database instance consists of threads (such as log writer, server task, timer tasks, and so on), main memory structures (caches) and volumes. X Server The X Server is the communication instance of MAX DB software. It is required if the individual software components are on different hosts. For example, database applications and MAX DB tools communicate with a database instance installed on a remote host using the X server that also runs on the remote host.
Non-archive log mode By default, the log area can be overwritten only if the appropriate log entries have been backed up. You must therefore make regular log backups. The log entries of the log area and the log backups are then available if you need to recover the database. If these entries and the data backups are complete and available without gaps, you can recover the database up to any point in time. Archive log mode The log area is overwritten cyclically, even if you do not perform any log backups.
Compiling scripts This section explains how to compile various scripts to regulate MaxDB’s logwriter process. Six files are needed: three cmd and three txt files. Place all script files on the application server in the /bin directory, for example, C:\Program Files\OmniBack\bin. The following information and credentials hold true for the test environment used: MaxDB Instance Version = 7.6.06.03 MaxDB DBM GUI Version = 7.6.03.10 MaxDB dbmcli Version = 7.6.6.
The qgrep utility in the Windows Server 2003 Resource Kit is Windows equivalent of UNIX and Linux’s grep utility. In UNIX, grep means search globally for lines matching the expression and print the lines. You can download Windows Server 2003 Resource Kit Tools from http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EEB18C4790CFFD&displaylang=en suspend_db.cmd 1. On the MaxDB application server create a file called suspend_db.cmd, and copy and save the following into it.
Figure 6. Flowchart of suspend_db.cmd script Start Pre-exec script suspend_db.cmd invoked Log on to MaxDB’s CLI utility dmbcli dbmcli parses commands in suspend.txt file • Queries the current status of MaxDB • Suspends MaxDB instance’s logwriter process dbmcli parses commands in Igwr.txt file es the current status of logwriter process • Queri Queries • Writes the logwriter process status to tasks.
resume_db.cmd 2. On the MaxDB application server create a file called resume_db.cmd and copy and save the following into it. Make sure you adapt the file to suit MaxDB instance login requirements: @ ECHO OFF echo *--------------------------MaxDb's dbmcli Output---------------------------------* echo . C:\Lab\sdb\programs\pgm\dbmcli.exe -uUTL -d MAXDB -u DBADMIN,maxy -uSQL DBADMIN,maxy -i "C:\Program Files\OmniBack\bin\resume.txt" C:\Lab\sdb\programs\pgm\dbmcli.
Figure 7. Flowchart of resume_db.cmd script Start Post-exec script resume_db.cmd invoked Log on to to MaxDB’s CLI utility dmbcli dbmcli parses commands in resume_db.txt file • Resumes MaxDB instance’s logwriterprocess • Queries the current status of MaxDB li parses commands in Igwr.txt file dbmcli dbmc • Queries the current status of logwriter process • Writes the logwriter process status to tasks.
lgwr.cmd 3. On the MaxDB application server create a file called lgwr.cmd and copy and save the following into it. Make sure you adapt the file to suit MaxDB instance login requirements: @ ECHO OFF C:\Lab\sdb\programs\pgm\dbmcli.exe -uUTL -d MAXDB -u DBADMIN,maxy -uSQL DBADMIN,maxy -i "C:\Program Files\OmniBack\bin\lgwr.txt" > tasks.txt qgrep Logwr tasks.txt suspend.txt 4. On the MaxDB application server create a file called suspend.
Figure 8. Overview of script-assisted backup The backup session starts Timeline Backup objects and storage volumes are resolved Application Applica tion level pre-exec script is executed that will suspend MaxDB’s logwriter process.
* If pre-exec script execution or creation of the replica fails, you can forcibly resume the MaxDB logwriter process by setting the omnirc variable ZDB_ALWAYS_POST_SCRIPT=1. See Set the ZDB_ALWAYS_POST_SCRIPT omnirc variable on page 26 for more details, and the complete DP Session report on the benefit of deploying the omnirc variable, ZDB_ALWAYS_POST_SCRIPT, on application server in Appendix C on page 50. The process in detail BSM starts on CM and parses the Backup Specification.
On the application server, MaxDB’s dbmcli command resumes MaxDB’s logwriter process – This post-exec script is executed at the application level. – The time difference between the execution of pre-exec and post-exec scripts, both at application-level, constitutes the effective downtime of the backup. SMISA prepares the backup server to mount the filesystem. SMISA presents the filesystem to the backup server. DA starts to stream data from the replica to the backup server.
MaxDB-ZDB data volume backup specification This section explains how to configure a MaxDB-ZDB backup specification. In the HP Data Protector Manager, switch to the Backup context. On the Scoping pane, expand Backup and then Backup Specifications. Right-click Filesystem and then click Add Backup. In the Create New Backup dialog box, accept the default filesystem template Blank Filesystem Backup. For the Backup type, select Snapshot backup.
Figure 10. Select MaxDB application and Backup systems and EVA related options Click Next. Select the MaxDB Data volumes on the application server to be backed up. These data volumes will be made consistent, then split, and subsequently mounted on the backup server for backup. Click Next. Determining MaxDB volumes for backup Make sure you select the correct MaxDB data volumes. You can obtain the MaxDB volumes either via MaxDB’s GUI or dbmcli.
Figure 11. MaxDB data volumes displayed in MaxDB Database Manager GUI MaxDB dbmcli Query all MaxDB volumes by using the command param_getvolsall. Example: dbmcli on MAXDB>param_getvolsall OK LOG_MIRRORED MAXLOGVOLUMES MAXDATAVOLUMES LOG_VOLUME_NAME_001 DATA_VOLUME_NAME_0001 NO 2 64 3200 19200 F F R:\MAXDB\DISKL001 F:\MAXDB\DISKD0001 See Using the MaxDB DBM CLI section on page 28 on how to logon to MaxDB CLI utility called dbmcli. Select the appropriate MaxDB data volumes. Click Next.
Figure 12. Select MaxDB data volumes for backup Select appropriate drives. Figure 13.
Click Advanced under Backup Specification Options to bring up another page called Backup Options. Figure 14.
Select the HP StorageWorks EVA SMI-S tab. Deploy both pre- and post-exec scripts under Application options. Note that you can modify neither application nor backup system here. Figure 15. HP StorageWorks EVA SMI-S backup options In the Stop/quiesce the application dialog box, enter the name of the script that will suspend the MaxDB logwriter process before the snapshot is created. The script will be executed on the application system.
Set the ZDB_ALWAYS_POST_SCRIPT omnirc variable The omnirc variable file template is found on all data protector clients. This file is a template for Data Protector agent environment variables.
Restore and recovery To restore and recover a MaxDB database instance, you need a combination of a scripted MaxDBZDB solution and a MaxDB-DP integration backup solution. Scripted MaxDB-ZDB backs up data volumes using scripts, whereas the fully-fledged MaxDB-DP integration backup is used to back up MaxDB archive logs.
Using the MaxDB DBM CLI Log into the MaxDB CLI at a command prompt on the application server with the syntax: dbmcli -uUTL -d -u Note: To get a list of all dbmcli commands, type help at the prompt. Example: The following example logs into a MaxDB instance which is online. Then sequentially it is changed between modes: offline to admin, and finally back to online mode.
Other useful dmbcli commands To list all MaxDB parameters, use param_directgetall. If you already know the parameter and want to query its value, use the command with the following syntax: param_directgel Example: The following queries the MaxDB instance’s log segment size: dbmcli on MAXDB>param_directget LOG_SEGMENT_SIZE OK LOG_SEGMENT_SIZE 12 To list all MaxDB volumes use the param_getvolsall command.
Performing a MaxDB datafiles restore This section explains how to configure a restore of MaxDB ZDB file system backup so that MaxDB datafiles are restored back to their original location or a different location. In the Restore context, expand Restore Objects, Filesystem, and then your MaxDB server. Double-click the file system object under the MaxDB server. Note: Make sure you differentiate between the two kinds of restore objects available for restore— Filesystem and SAP DB Server.
In the Source pane, select the MaxDB data volume to be restored: Figure 19. MaxDB data volume restore selection dialog box Right-click the MaxDB data volume object and select the correct version of the MaxDB ZDB filesystem object. Click OK. Figure 20.
Select the Destination tab, and select the Overwrite option under File Conflict Handling. This will effectively overwrite the contents of MaxDB data volume. Optionally, you can choose to restore the object to a different location. To do this, select the option Restore to new location, and input the alternate location: Figure 21. Restore destination options dialog box Note: If you select Restore to new location, there is no need to select the Overwrite option. Click Restore.
Performing a MaxDB archive logfiles restore This section explains how to configure a restore of MaxDB ZDB archive logfiles, which will be used during recovery process. Note: You should have already performed a MaxDB datafiles restore, as described in the previous Performing a MaxDB datafiles restore section on page 30.
In the Restore context, expand Restore Objects, then SAP DB Server, and finally your MaxDB server. Double-click the MaxDB server object. Note: In the Data Protector GUI, the MaxDB Server is denoted as SAP DB Server for legacy reasons. MaxDB’s historical name was SAPDB. In the Source pane, select only the Data object for restore. Right-click it to access Properties for Data object. Note: Do not select the CONFIG object. If you select it, Data Protector will abort the session.
Go to the Options tab and deselect the Recovery option. Figure 24.
Repeat the above steps as many times as needed until you are certain that appropriate archive logs have been restored to start recovery. However, with the last archive log restore session, you can input the MaxDB recovery time, either to: The latest version Figure 25. Recovery option to the latest version Use the option Use existing archive logs if when recovering to the latest version Any particular point in time in the past Figure 26.
Appendix A The following is a complete MaxDB DP ZDB session report using scripts deployed on the application server. A dedicated backup server was also used to secure the backup: [Normal] From: BSM@hpu069.deu.hp.com "Delete_zdb_tpc003_maxdb_bkp_serv" 5:28:50 PM Backup session 2009/04/02-6 started. [Normal] From: SMISA@tpc007.dp2.com "SMISA" Starting agent on tpc007.dp2.com. Time: 4/2/2009 5:31:00 PM [Normal] From: SMISA@tpc003.dp2.com "SMISA" Starting agent on tpc003.dp2.com.
[Normal] From: SMISA@tpc007.dp2.com "SMISA" Time: 4/2/2009 5:31:01 PM A StorageWorks EVA unit has been successfully located for the storage volume: Storage volume name : 6005-08B4-0001-478C-0001-E000-0E75-0000 StorageWorks EVA name : TM_CPE_2 [Normal] From: SMISA@tpc007.dp2.com "SMISA" Time: 4/2/2009 5:31:02 PM Beginning the resolve of storage volumes. [Normal] From: SMISA@tpc007.dp2.
>sql_execute resume logwriter OK -->show state OK SERVERDB: MAXDB The SERVERDB state is ONLINE Console command finished (2009-04-02 17:31:29). --Log Writer Status . ================*****=========**********======================================== T2 2 0x13E8 Logwr No-Work (255) 0 0 1409(s) ================*****=========**********======================================== . . *--------------------------MaxDb's dbmcli Output---------------------------------* . . [Normal] From: SMISA@tpc003.dp2.
[Normal] From: SMISA@tpc007.dp2.com "SMISA" Time: 4/2/2009 5:32:03 PM A filesystem has been successfully dismounted. Filesystem name : \\?\Volume{10ece3bf-035a-11de-925a-000802dfd8a1} Mount point : C:\Program Files\OmniBack\tmp\tpc003.dp2.com\F_2009-04-02-6 [Normal] From: SMISA@tpc007.dp2.com "SMISA" Time: 4/2/2009 5:32:03 PM Removing any presentations of: Storage volume name : 50001FE15000C7C0\\Virtual Disks\MaxDB\tpc003_maxdb\maxdb_data\DP-2009.04.02-6-049D4DA4D [Normal] From: BMA@tpc007.dp2.
Appendix B The following is a complete Data Protector session report which shows what happens if you start MaxDB data volume ZDB backup session when the MaxDB logwriter process has already been suspended. The backup successfully completes, and the script reports an error, displayed in the Data Protector session report, stating that the MaxDB log suspend command cannot be executed again on a MaxDB instance where the process is already in suspension.
[Normal] From: SMISA@tpc007.dp2.com "SMISA" Time: 4/7/2009 2:09:38 PM Checking StorageWorks EVA SMI-S provider using this connection data: Host: tpc194.deu.hp.com User: administrator@dp2 Namespace: root/eva Port: 5988 SSL: FALSE [Normal] From: SMISA@tpc007.dp2.
Log Writer S t a t u s . ================*****==========**********========================================= T2 2 0x13E8 Logwr USR HOLD (248) 0 0 3776(s) ================*****==========**********========================================= . . *--------------------------MaxDb's dbmcli Output---------------------------------* . . [Normal] From: SMISA@tpc003.dp2.com "SMISA" Time: 4/7/2009 2:09:49 PM Split pre-exec script completed successfully. [Normal] From: SMISA@tpc007.dp2.
[Normal] From: SMISA@tpc007.dp2.com "SMISA" Time: 4/7/2009 2:10:10 PM Preparation of the backup system completed. [Normal] From: BMA@tpc007.dp2.com "MAXDB_FL_Writer0" STARTING Media Agent "MAXDB_FL_Writer0" Time: 4/7/2009 2:10:15 PM [Normal] From: BMA@tpc007.dp2.com "MAXDB_FL_Writer0" Time: 4/7/2009 2:10:16 PM Loading medium from slot D:\Backup\10394b45549db4272504cd501dd.fd to device MAXDB_FL_Writer0 [Normal] From: BMA@tpc007.dp2.
Appendix C The following is a complete Data Protector session report which shows the benefit of deploying the ZDB_ALWAYS_POST_SCRIPT omnirc variable on the application server. There was a problem with the resolution of the storage volume and so the storage volume was not resolved. As a consequence Data Protector cleans up the procedure, bypasses the application level pre-exec script, and jumps directly to executing the application level post-exec script.
[Normal] From: SMISA@tpc007.dp2.com "SMISA" Time: 4/8/2009 4:09:16 PM This StorageWorks EVA SMI-S provider has access to the following StorageWorks EVA unit: Array Name: TM_CPE Array WWN: 50001FE150004460 Array Status: OK Status Description: initialized_ok Firmware Version: 4100 Comment Field: [Normal] From: SMISA@tpc007.dp2.
[Normal] From: SMISA@tpc007.dp2.com "SMISA" Time: 4/8/2009 4:09:19 PM A StorageWorks EVA unit has been successfully located for the storage volume: Storage volume name : 6005-08B4-0001-478C-0001-E000-0E75-0000 StorageWorks EVA name : TM_CPE_2 [Normal] From: SMISA@tpc007.dp2.com "SMISA" Time: 4/8/2009 4:09:20 PM Beginning the resolve of storage volumes. [Normal] From: SMISA@tpc007.dp2.
[Normal] From: BSM@hpu069.deu.hp.com "zdb_tpc003_maxdb_bkp_serv" Time: 4/8/2009 4:08:42 PM Backup Statistics: Session Queuing Time (hours) 0.05 ------------------------------------------Completed Disk Agents ........ 0 Failed Disk Agents ........... 1 Aborted Disk Agents .......... 0 ------------------------------------------Disk Agents Total ........... 1 =========================================== Completed Media Agents ....... 0 Failed Media Agents .......... 0 Aborted Media Agents .........
Appendix D The following is a complete DP ZDB tape restore session report which restores MaxDB’s data volume. [Normal] From: RSM@hpu069.deu.hp.com "" Time: 3/17/2009 6:05:33 PM Restore session 2009/03/17-12 started. [Normal] From: RMA@tpc007.dp2.com "MAXDB_FL_Writer0" STARTING Media Agent "MAXDB_FL_Writer0" Time: 3/17/2009 6:06:21 PM [Normal] From: RMA@tpc007.dp2.com "MAXDB_FL_Writer0" Time: 3/17/2009 6:06:22 PM Loading medium from slot D:\Backup\10394b45549bfaf4c504cd500ff.
Appendix E What happens if you select the CONFIG object in addition to the DATA object in the Restore Source pane? Data Protector aborts the restore session and displays the following message: [Normal] From: RSM@hpu069.deu.hp.com "" Time: 3/19/2009 5:06:45 PM Restore session 2009/03/19-14 started. [Normal] From: OB2BAR_SAPDBBAR@tpc003.dp2.com "MAXDB" Executing the dbmcli command: `user_logon'. Time: 3/19/2009 5:07:34 PM [Normal] From: OB2BAR_SAPDBBAR@tpc003.dp2.
Appendix F The following is a complete Data Protector session report in which Latest Point In Time Recovery was selected. After restoring the appropriate archive log backup sessions, with the final archive log session yet to be restored, the Recovery option was selected with latest point in time. Data Protector restores the last archive log session and then instructs MaxDB to recover the instance to the latest point in time: [Normal] From: RSM@hpu069.deu.hp.
[Normal] From: OB2BAR_DMA@tpc003.dp2.com "MAXDB" Time: 3/19/2009 2:32:41 PM Starting OB2BAR Restore: tpc003.dp2.com:/MAXDB/Data/3 "SAPDB" [Normal] From: OB2BAR_DMA@tpc003.dp2.com "MAXDB" Time: 3/19/2009 2:32:43 PM Completed OB2BAR Restore: tpc003.dp2.com:/MAXDB/Data/3 "SAPDB" [Normal] From: OB2BAR_SAPDBBAR@tpc003.dp2.com "MAXDB" Executing the dbmcli command: `db_state'. Time: 3/19/2009 2:32:44 PM [Normal] From: OB2BAR_SAPDBBAR@tpc003.dp2.
Appendix G The following is a complete Data Protector session report in which a particular Point In Time Recovery was selected. After restoring appropriate archive log backup sessions, with the final archive log session yet to be restored, the Recovery option was selected with a specific point in time in the past. Data Protector restores the last archive log session and subsequently instructs MaxDB to recover the instance to a specific point in time: [Normal] From: RSM@hpu069.deu.hp.
Appendix H This is a reproduction of SAP Note 616814 downloaded on 28 July, 2008. Note 616814 - Suspend log writer for split mirror or snapshot Note Language: English Version: 13 Validity: Valid from 08.11.2006 Summary Symptom You want use a split mirror or snapshot of the storage system for data backups with MaxDB or liveCache. The storage system cannot ensure the consistency of the I/O for all data volumes, in other words the storage system cannot create a point-in-time image.
To create 0the split mirror or snapshot, proceed as follows: dbmcli -d -u , util_connect , util_execute suspend logwriter ==> Create the split mirror or snapshot util_execute resume logwriter util_release exit To create the snapshot, you can call a command for the operating system or a script with the exclamation mark: dbmcli -d -u , ... !/..../.../create_snapshot.sh ... Important: With Version 7.
Header Data Release Status: Released for Customer Released on: 08.11.2006 15:22:54 Priority: Recommendations/additional info 28.07.2008 Page 3 of 3 Category: FAQ Main Component BC-DB-SDB MaxDB Additional Components: BC-DB-LVC liveCache The note is not release-dependent. Related Notes 56 Number Short Text 669963 Log mirroring: DUAL/Mirrored vs.
Appendix I This is a reproduction of SAP Note 1351632 version 1, dated 13 July, 2009, downloaded on 25 July, 2009. Number Version Status Set on 1351632 1 from 10.06.2009 In Process 10.06.2009 Language Master language Short text EN EN MaxDB Zero Downtime Backup with HP Data Protector Component BC-DB-SDB-DBA Database Administration MaxDB Long text Symptom You would like to use HP Data Protector to create split-mirror or snapshot backups of MaxDB or liveCache databases.
For more information Visit the following Data Protector online resources to get more information: www.hp.com/go/dataprotector www.hp.com/go/imhub/dataprotector HP Data Protector guides To get more information on this topic consider the following Data Protector guides, available in the/docs directory on the HP Data Protector DVD, on your Installation Server or online. HP Data Protector A.06.10 IntegrationORASAP Technology for better business outcomes © Copyright 2009 Hewlett-Packard Development Company, L.