HP StorageWorks DButil user guide Abstract This guide describes procedures for installing, configuring, and managing HP StorageWorks DButil.
Legal and notice information © Copyright 2005-2009 Hewlett-Packard Development Company, L.P. Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license. The information contained herein is subject to change without notice.
Contents 1 Using HP StorageWorks DButil ............................................................. 7 Prerequisites ............................................................................................................................... 7 Supported software ..................................................................................................................... 7 Installing the utility ......................................................................................................
Recovery Recovery Recovery Recovery scenario scenario scenario scenario 1 2 3 4 ........................................................................................................... ........................................................................................................... ........................................................................................................... .........................................................................................................
Figures 1 SQL database drive example .................................................................................... 17 2 Managed set of containers monitor job ..................................................................... 18 3 Select Replication options ........................................................................................ 19 4 Suspend Host Application I/O window ......................................................................
Tables 1 Troubleshooting HP DButil error messages .................................................................. 29 2 Document conventions .............................................................................................
1 Using HP StorageWorks DButil HP StorageWorks DButil is a command-line utility to facilitate application-consistent replication of a Microsoft SQL Server database. HP DButil commands place the database in a transactionally consistent state and suspends write operations while HP StorageWorks replication software is used to copy the database. Other HP DButil commands then resume the database and normal write operations.
Running the utility HP DButil is run from a Windows command line, typically using the following methods: • Windows batch files • HP Replication Solutions Manager jobs that call batch files or scripts HP DButil creates a metadata file in the directory where it is run. HP DButil uses this metadata to restore the database. A metadata file is valid only for the snapshot that it is created for.
IMPORTANT: When freezing databases using DButil, follow the best practices for snapshot creation described in SQL Server 2005 Virtual Backup Device Interface (VDI) Specification, available at: http://www.microsoft.com/downloads/details.aspx?FamilyID=416f8a51-65a3-4e8e-a4c8-adfe15e850fc& DisplayLang=en. In particular, be sure to freeze the master database last and to limit the number of databases included in the snapshot. HP recommends that you include no more than three databases in a snapshot.
DButil –pre Database names that contain spaces Enclose the database name in quotes if it contains an embedded space. For example: DButil –pre “My Database” Metadata files The DButil –pre and DButil –mfreeze commands create metadata files that contain checkpoint and control information about the database(s) being replicated.
2 Creating snapshot backups using HP DButil Procedure To back up an SQL Server database using snapshots or snapclones and HP DButil: 1. Determine which databases need to be backed up. 2. Set the necessary login credentials (optional). 3. Create the HP DButil batch files to suspend and resume the desired databases. 4. Determine which volumes need to be replicated. 5. Construct the HP Replication Solutions Manager job, or Windows batch files to replicate the volumes identified in Step 4. 6.
If you use multiple instances of HP DButil (for multiple sets of physical LUNs, for example), you must set the credentials for each HP DButil instance. For a given instance of HP DButil, you need only set the credentials for the databases that the instance will interact with. NOTE: HP DButil only supports SQL server authentication. It does not support Windows authentication.
The following example shows a pre.bat file for this configuration. @ echo off rem pre.bat file for cd \dbutil dbutil –mfreeze 1 of dbutil –mfreeze 2 of dbutil –mfreeze 3 of suspending multiple SQL Server databases 3 Server1 TestDB1 3 Server1 TestDB2 3 Server1 TestDB3 The following example shows a post.bat file for this configuration. @ echo off rem post.
exec sp_helpdb TestDB3 testdb3_Data testdb3_Log H:\SQLdata\testdb3_Data.MDF E:\SQLlogs\testdb3_Log.LDF In this case, the logs files are all contained on the E: drive but the data files are spread across the F:, G:, and H: drives. A backup of this database requires snapshots or snapclones of E:, F:, G:, and H:. Constructing HP Replication Solutions Manager jobs or Windows batch files After you have created the pre.bat and post.
E7: DeleteHostVolume ( $HV2 ) onerror pauseat E7: E6: DeleteHostVolume ( $HV1 ) onerror pauseat E6: E5: DeleteStorageVolumes ( $Rep4 ) onerror pauseat E4: DeleteStorageVolumes ( $Rep3 ) onerror pauseat E3: DeleteStorageVolumes ( $Rep2 ) onerror pauseat E2: DeleteStorageVolumes ( $Rep1 ) onerror pauseat Exit ( SUCCESS ) E1: Exit ( FAILURE ) E5: E4: E3: E2: Sample HP Replication Solutions Manager snapshot job using replicate wizard The following is a RSM sample script to create a snapshot of a SQL database
// // Rollback. DeleteReplicaRepository ( $Repository1, FALSE ) E4: UnmountHostVolume ( $MP1 ) onerror pauseat E4: E3: DeleteHostVolume ( $HV1 ) onerror pauseat E3: E2: DeleteStorageVolumes ( $Rep1 ) onerror pauseat E2: Exit ( SUCCESS ) // // Failure exit - no rollback needed.
// // // Rollback. DeleteReplicaRepository ( $Repository1, FALSE ) E4: UnmountHostVolume ( $MP1 ) onerror pauseat E4: E3: DeleteHostVolume ( $HV1 ) onerror pauseat E3: E2: DeleteStorageVolumes ( $Rep1 ) onerror pauseat E2: 14 Exit ( SUCCESS ) // // Failure exit - no rollback needed. E1: Exit ( FAILURE ) Sample HP Replication Solutions Manager mirrorclone creation using replicate wizard To create a mirrorclone of a SQL database: 1. Create a container of the SQL database (host volume).
Figure 2 Managed set of containers monitor job . For more information on creating a managed set of containers for host volumes, see the HP StorageWorks Replication Solutions Manager user guide. 2. 18 Create a mirrorclone of the SQL database (host volume) using the container. To create a mirrorclone: a. Click Host Volumes and select the SQL database drive (host volume) for which the container is created. See Figure 1 for an example. b. Select Actions > Replicate.
Figure 3 Select Replication options . d. Click Suspend Host Application I/O and click Next. Figure 4 displays the Suspend Host Application I/O window that opens. Figure 4 Suspend Host Application I/O window . e. Specify the path of the .bat file in the Command option and click Next. After performing the above steps described in “Sample HP Replication Solutions Manager mirrorclone creation using replicate wizard” on page 17, the following job script is generated. The variables are displayed in italics.
// Assign some variables that will be used in this job. $source_host1 = SetVariable ( " Production Server IP " ) $mount_host = SetVariable ( " Backup Server IP " ) $source_hostvol_unc1 = SetVariable ("\\ProductionServerHostName\W:\") // // Validate that resources are as expected.
dbutil -pre sqlserver_name database_name username password IF %ERRORLEVEL% NEQ 0 goto ErrHand1 paircreate -g db_group1 -vl IF %ERRORLEVEL% NEQ 0 goto ErrHand2 pairevtwait -s PAIR IF %ERRORLEVEL% NEQ 0 goto ErrHand2 pairsplit -S -g db_group1 IF %ERRORLEVEL% NEQ 0 goto ErrHand3 pairevtwait -s SMPL IF %ERRORLEVEL% NEQ 0 goto ErrHand3 dbutil -post sqlserver_name database_name username password goto TheEnd :ErrHand1 echo DB FREEZE FAILED: %0% RingAlarm "DB FREEZE FAILED: %0%" goto TheEnd :ErrHand2 echo Pair Crea
Creating snapshot backups using HP DButil
3 SQL Server recovery using HP DButil Recovery approaches The appropriate recovery method depends on the situation and the type of backup. Choosing an incorrect method can prevent transaction logs from being applied and the database from being restored to the latest log backup. Two basic recovery methods can be used with snapshots or snapclones: volume replacement and selective file replacement.
a single database needs to be restored and other databases also reside on the volume. There are two ways that selective file replacement can be accomplished: Drag and drop from snap: If a snapshot or snapclone of the required data and log files is available, the snapshot or snapclone devices can be presented to the source host and manually mounted using operating system utilities. The required files can simply be dragged and dropped from the snapshot or snapclones back to the original source volumes.
8. Add the snapclone volumes as cluster resources and SQL Server cluster dependencies. 9. Start the SQL Server cluster service. 10. Run the DButil –restoresns command to start restoring the database. You will receive a prompt to replace the files. 11. Acknowledge the HP DButil file replacement prompt. This will complete the restoration and leave the database in a loading state. In the loading state, the database is ready to accept a restore of the transaction logs.
9. Run the DButil –restoresns command to restore the database. You will receive a prompt to replace the files. 10. Unpresent the failed database disks from the SQL Server host. (For example, using HP Command View EVA, select the appropriate virtual disk and click the Unpresent tab.) 11. Change the drive letters or mount points on the new volumes to match those of the original volumes, using the Disk Management utility. 12. Acknowledge the HP DButil file replacement prompt.
6. Acknowledge the HP DButil file replacement prompt. This completes the restoration and leaves the database in a loading state. In the loading state, the database is ready to accept transaction logs. NOTE: The DButil –restoresns command uses the metadata file to put the database in a loading state. If you are restoring a SQL Server database to a new SQL server with a different SQL server name, you need to edit the name of the metadata file to match the new name of the SQL server. 7.
SQL Server recovery using HP DButil
4 Troubleshooting HP DButil Status and error messages are written to an HP DButil log file each time the HP DButil utility is run. These log files can help you diagnose and correct common problems encountered when using HP DButil. The HP DButil log file is given the name sqlserver_dbname.log where sqlserver is the name of the SQL Server and dbname is the name of the database. The log file is located in the same directory as HP DButil and gets overwritten each time the application is run.
Failed to open sqlserver_dbname.meta HP DButil cannot find the metadata file, probably due to it having a different name than that specified by the server_dbname combination. Check the directory that HP DButil is installed to make sure the *.meta file exists. Rename the metadata file to match the sqlserver_dbname.meta. This can only be done if the metadata file is the correct file with an incorrect name. VDS::Create fails HP DButil has been the wrong instance name for the SQL Server.
5 Support and other resources Contacting HP HP technical support Telephone numbers for worldwide technical support are listed on the HP support website: http:// www.hp.com/support/.
Related information Documentation For documents referenced in this guide, see the Manuals page on the Business Support Center website: http://www.hp.com/support/manuals In the Storage section, click Disk Storage Systems or Storage software, and then select your product.
Typographic conventions Table 2 Document conventions Convention Uses Blue text: Table 2 Cross-reference links and email addresses Blue, underlined text: http://www.hp.
Support and other resources
Index B batch files, 12 C conventions typographic, 33 D database backups creating, 11 requirements, 11 database names, 10 DButil error messages, 29 DButil commands, 8 DButil –mfreeze, 8 DButil –mthaw, 9 DButil –post, 8 DButil –pre, 8 DButil –recover, 9 DButil –restoresns, 9 DButil –setcred, 9 DButil parameters, 9 document providing feedback, 31 related documentation, 32 documentation HP website, 32 F feedback documentation, 31 product, 31 file replacement, 23 H help obtaining, 31 HP DButil description,
transaction logs applying, 24 backup, 21 troubleshooting DButil error messages (table), 29 typographic conventions, 33 V volume replacement, 23 volume replication, 13 W websites HP, 32 HP Subscriber's choice for business, 31 product manuals, 32 36