Posted September 6, 20231 yr SAP Netweaver 7.5 with MaxDB 7.9 on Azure using Azure NetApp Files (ANF) Overview This article describes the setup of SAP ERP 7.5 with MaxDB 7.9. In addition, we will show how to use azacsnap to create application consistent snapshots. This article is written for an audience which are familiar with Azure, Linux and SAP Basis. Since the login mechanism changed in version 7.7 we can only support the MaxDB 7.9 with all the automation scripts explained here iin the documentation. SAP MaxDB: The SAP Database - Home SAP MaxDB - MaxDB - Support Wiki SAP MaxDB Directory Structure - MaxDB - Support Wiki System Configuration This illustration is a short overview of the system setup. Create the Environment The VM SubscriptionSAP your subscribtion Resource group (new) ralfMaxDB Virtual machine name ralfmaxdb01 Region East US Availability options Availability zone Availability zone 1 Security type Standard Image SUSE Enterprise Linux 15 SP3 +Patching - Gen2 VM architecture x64 Size Standard E16-8ads v5 (8 vcpus, 128 GiB memory) Authentication type Password Username admin01 Create the delegated network for ANF Create the Volume Structure Download the sources from the SAP Marketplace The DB Export The SWPM The MaxDB The SAPCAR The Kernel The IGS Finally, the HOST Agent. Volume design on ANF Create the volume structure on ANF. The size of each volume depends on a proper capacity and performance sizing. Mount the volumes and create the directories. Modify the idmapd to align the NFSv4 domain. vi /etc/idmapd.conf # Example [General] Domain = defaultv4iddomain.com [Mapping] Nobody-User = nobody Nobody-Group = nobody update the system zypper up Install the RPM’s regarding the installation manual zypper in motif libXtst-devel libXp-devel libX11-devel libSM-devel libICE-devel zypper in glibc-32bit sapconf Maintain the sysctl.conf vi /etc/sysctl.conf net.ipv6.conf.all.disable_ipv6 = 1 net.core.somaxconn = 4096 net.core.netdev_max_backlog = 300000 net.ipv4.tcp_rmem = 4096 131072 16777216 net.ipv4.tcp_wmem = 4096 16384 16777216 net.ipv4.tcp_max_syn_backlog = 16348 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.tcp_slow_start_after_idle = 0 net.ipv4.conf.all.rp_filter = 0 net.ipv4.tcp_dsack = 1 net.ipv4.tcp_sack = 1 net.ipv4.tcp_no_metrics_save = 1 net.ipv4.tcp_moderate_rcvbuf = 1 net.ipv4.tcp_window_scaling = 1 net.ipv4.tcp_syn_retries = 8 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_timestamps = 1 net.ipv4.tcp_tw_recycle = 1 reboot the system to apply all the changes and reload the kernel after the update. reboot Check that sapconf is running and that it is enabled. sapconf_check This is sapconf_check v1.0. It verifies if sapconf is set up correctly and will give advice to do so. Please keep in mind: - This tool does not check, if the tuning itself works correctly. - Follow the hints from top to down to minimize side effects. Checking sapconf ================ [ OK ] sapconf package has version 5.0.5 [ OK ] sapconf.service is active [ OK ] sapconf.service is enabled Sapconf is set up correctly. create the group ID for your SAP systems (should be the same for all SAP systems) groupadd sapsys -g 79 groupadd sdba -g 1001 creating the DB users to avoid issues during the DB installation useradd c11adm -g sapsys -c "SAP System Administrator" -u 1001 -s /bin/csh -d /home/c11adm useradd sapadm -g sapsys -c "SAP System Administrator" -u 1002 -s /bin/false -d /home/sapadm useradd sdb -g sdba -c "Database Software Owner" -u 1003 -s /bin/csh -d /home/sdb useradd sqdc11 -g sapsys -c "Owner of Database Instance C11" -u 1004 -s /bin/csh -d /home/sqdc11 passwd c11adm passwd sapadm passwd sdb passwd sqdc11 MaxDB Volume design for non XXL installations As usual, create one shared volume for the Application Server part , a MaxDB volume for the database specific directories, data and log volume and the backup volume ideally on a different storage endpoint. In this PoC we have all storage endpoints on one IP, which is okay for small and medium installations. Get the FQDN name of the VM hostname -f ralfmaxdb01.lgbsmidv5lrurp4qqyuwbceesh.bx.internal.cloudapp.net maintain the /etc/hosts vi /etc/hosts 127.0.0.1 localhost # 10.6.0.4 ralfmaxdb01.lgbsmidv5lrurp4qqyuwbceesh.bx.internal.cloudapp.net ralfmaxdb01 10.6.1.4 anf01 Create the SAP App server structure mount -o vers=4.1 anf01:/C11usrsap /mnt mkdir -p /mnt/sapmnt /mnt/usr_sap mkdir -p /usr/sap/C11 /sapmnt umount /mnt Create the MaxDB “installation” structure mount -t nfs -o vers=4.1 anf01:/C11MaxDB /mnt mkdir -p /sapdb mkdir -p /mnt/C11 Create the data structure mkdir -p /sapdb/C11/sapdata mkdir -p /mnt/C11/sapdata Create the log structure mkdir -p /sapdb/C11/saplog mkdir -p /mnt/C11/saplog Create the backup structure mkdir -p /mnt/C11/backup mount -t nfs -o vers=4.1 anf01:/C11backup /mnt/C11/backup mkdir -p /sapdb/C11/backup/data /sapdb/C11/backup/log mkdir -p /mnt/C11/backup/data /mnt/C11/backup/log umount /mnt/C11/backup umount /mnt Create the fstab vi /etc/fstab ... /dev/sdc /Software xfs defaults 0 0 anf01:/C11usrsap/usr_sap /usr/sap nfs rw,hard,vers=4.1,nconnect=8,rsize=262144,wsize=262144,noatime,lock 0 0 anf01:/C11usrsap/sapmnt /sapmnt nfs rw,hard,vers=4.1,nconnect=8,rsize=262144,wsize=262144,noatime,lock 0 0 anf01:/C11MaxDB /sapdb nfs rw,hard,timeo=600,vers=4.1,nconnect=8,rsize=262144,wsize=262144,noatime,lock 0 0 anf01:/C11data /sapdb/C11/sapdata nfs rw,hard,vers=4.1,nconnect=8,rsize=262144,wsize=262144,noatime,lock 0 0 anf01:/C11log /sapdb/C11/saplog nfs rw,hard,vers=4.1,nconnect=8,rsize=262144,wsize=262144,noatime,lock 0 0 anf01:/C11backup/data /sapdb/C11/backup/data nfs rw,hard,vers=4.1,nconnect=8,rsize=262144,wsize=262144,noatime,lock 0 0 anf01:/C11backup/log /sapdb/C11/backup/log nfs rw,hard,vers=4.1,nconnect=8,rsize=262144,wsize=262144,noatime,lock 0 0 mount -a chown -R sdb:sdba /sapdb Create the Software directory Create a /Software directory where you store the SAP archives. Create the Software Disk lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 30G 0 disk ├─sda1 8:1 0 2M 0 part ├─sda2 8:2 0 512M 0 part /boot/efi ├─sda3 8:3 0 1G 0 part /boot └─sda4 8:4 0 28.5G 0 part / sdb 8:16 0 600G 0 disk └─sdb1 8:17 0 600G 0 part sdc 8:32 0 1T 0 disk mkfs -t xfs /dev/sdc mkdir /Software ll /Software drwxrwxrwx 3 root root 263 Mar 6 20:06 Export drwxrwxrwx 2 root root 173 Mar 6 19:51 Kernel drwxrwxrwx 2 root root 60 Mar 6 19:51 MaxDB -rwxrwxrwx 1 root root 4507168 Mar 6 15:27 SAPCAR_1115-70006178.EXE drwxrwxrwx 2 root root 22 Mar 6 19:51 SWPM copy the SAPCAR into the PATH mv SAPCAR_1115-70006178.EXE /usr/bin/SAPCAR ASCS Installation Extract the SWPM archive and start the SAP Installation cd /Software/SWPM SAPCAR -xf SWPM10SP37_0-20009701.SAR SAPCAR: processing archive SWPM10SP37_0-20009701.SAR (version 2.01) SAPCAR: 837 file(s) extracted set the root password on the VM (required for the SAP installation) sudo su – passwd Changing password for user root. New password: ********* Retype new password: ******* passwd: all authentication tokens updated successfully. Start the SWPM /Software/SWPM # ./sapinst Open your browser with https://10.6.0.4:4237/sapinst/docs/index.html and select advanced Select continue. Login as root MaxDB Installation After the ASCS is installed we now install the MaxDB and load the content into it. ralfmaxdb01:/Software/SWPM # ./sapinst cd /Software/MaxDB mkdir DB Patch mv unzip 51052559_8.ZIP DB mv 51054410_2.ZIP Patch/ cd DB unzip 51052559_8.ZIP Primary App Server installation ./sapinst Install the MaxDB Database Studio SAP Help Portal Installing or Upgrading Database Studio for SAP MaxDB | SAP Help Portal Download SAPCAR for Windows and extract the MAXDBSTUDIO.sar archive in a separate folder. Then call the sdbsetup.exe to install the MaxDB Studio Backup the Database HowTo - SAP MaxDB Backup with Database Manager CLI - MaxDB - Support Wiki Before you can create snapshot based backups we need to take a full database backup. Then we can switch the logmode su – c11adm dbmcli -d C11 -u superdba,<pwd> user_getall OK control superdba dbmcli -d C11 -u superdba,<pwd> user_get superdba OK SERVERRIGHTS=UserMgm,InstallMgm,SystemCmd,DBFileRead,AccessUtility,Recovery,Backup,ParamFull,ParamCheckWrite,ParamRead,AccessSQL,ExecLoad,LoadSysTab,DBStop,DBStart,DBInfoRead,SharedMemoryMgm,SchedulerMgm,Scheduling,EvtDispMgm,EvtDisp GUIRIGHTS= SECONDPASSWORD=NO DISABLED=NO COMMENT= USERTYPE=DBA EXTERNAL_IDS= MASTER_PW_ALTER_TIME=2023-03-07 18:51:54 Create an xuser key to be able password less access to the DB. xuser set -U ADMIN -d C11 -u superdba,<pwd> List the xuser entries xuser -U ADMIN list ---------------------------------------------------------- XUSER Entry 5 -------------- Key :ADMIN Username :SUPERDBA UsernameUCS2 :S.U.P.E.R.D.B.A. . .. . . . . . . . . . . Password :????????? PasswordUCS2 :????????? PasswordUTF8 :????????? Dbname :C11 Nodename :<unspecified> Sqlmode :<unspecified> Cachelimit :-1 Timeout :-1 Isolation :-1 Charset :<unspecified> Login as SUPERDBA using the XUSER key dbmcli -U ADMIN dbmcli on C11> Create template d1 for data backup: dbmcli on C11> backup_template_create d1 to FILE /sapdb/C11/backup/data/DAT0001 CONTENT DATA Create template l1 for log backup: dbmcli on DB1> backup_template_create l1 to FILE /sapdb/C11/backup/log/LOG0001 CONTENT LOG Starting a backup db_connect backup_start d1 check the data backup location ls -lh /sapdb/C11/backup/data/ -rw-rw---- 1 sdb sdba 24G Mar 7 19:39 DAT0001 Checking a backup after completion medium_label d1 OK Returncode 0 Date 20230307 Time 00193608 Server ralfmaxdb01 Database C11 Kernel Version Kernel 7.9.09 Build 005-123-259-005 Pages Transferred 0 Pages Left 0 Volumes Medianame Location /sapdb/C11/backup/data/DAT0001 Errortext Label DAT_000000001 Is Consistent true First LOG Page 6939 Last LOG Page DB Stamp 1 Date 20230307 DB Stamp 1 Time 00193608 Page Count 3044252 Devices Used 1 Database ID ralfmaxdb01:C11_20230307_193608 Converter Page Count 1681 Short Presentation Title (sap.com) As of SAP MaxDB Version 7.8 you can use external filer snapshot in combination with SAP MaxDB snapshot to create a consistent backup in online database mode. As of version 7.7 you can freeze the data area of a SAP MaxDB using internal database snapshots. A snapshot can be created in the ONLINE operational state. As of SAP MaxDB version 7.8 you can perform a complete data backup with an external file system snapshot in the operational state ONLINE in combination with a SAP MaxDB Database Snapshot. First a SAP MaxDB (internal) Snapshot is created followed by the external file snapshot. While this backup procedure the database is in online mode and the users can work with the application. Moreover, this procedure guarantees that this external file system backup is included in the backup history. The Log area is never part of this backup procedure. In response to this command, the system displays the following output: OK Returncode -8020 ... Max Used Data Page 0 The return code -8020 together with the number of maximum used data pages (Max Used Data Page), in this case 0, displays in this case that the complete data backup was successfully started. Create the Snapshot backup_template_create External_Snapshot TO EXTERNAL SNAPSHOT db_connect backup_start External_Snapshot OK Returncode -8020 Date 20230307 Time 00201047 Server ralfmaxdb01 Database C11 Kernel Version Kernel 7.9.09 Build 005-123-259-005 Pages Transferred 0 Pages Left 0 Volumes Medianame External_Snapshot Location Errortext Label DAT_000000002 Is Consistent true First LOG Page 6940 Last LOG Page DB Stamp 1 Date 20230307 DB Stamp 1 Time 00201047 DB Stamp 2 Date DB Stamp 2 Time Page Count Devices Used 1 Database ID ralfmaxdb01:C11_20230307_193608 Max Used Data Page 0 Converter Page Count --- take the snapshot with azacsnap on ANF than finish the backup backup_finish External_Snapshot ExternalBackupID 202303071508 (backup ID e.g. date and time) backup_finish External_Snapshot ExternalBackupID 202303071508 OK Returncode 0 Date 20230307 Time 00201047 Server ralfmaxdb01 Database C11 Kernel Version Kernel 7.9.09 Build 005-123-259-005 Pages Transferred 0 Pages Left 0 Volumes Medianame External_Snapshot Location Errortext Label DAT_000000002 Is Consistent true First LOG Page 6940 Last LOG Page DB Stamp 1 Date 20230307 DB Stamp 1 Time 00201047 DB Stamp 2 Date DB Stamp 2 Time Page Count Devices Used 1 Database ID ralfmaxdb01:C11_20230307_193608 Max Used Data Page 0 Converter Page Count Check the logfile tail -f ./sapdb/C11/data/wrk/C11/dbm.prt 23611 INF 7 DBMKnl Data: DBSTAMP1 DATE..... 20230307 23611 INF 7 DBMKnl Data: DBSTAMP1 TIME..... 00201047 23611 INF 7 DBMKnl Data: DBSTAMP2 DATE..... (null) 23611 INF 7 DBMKnl Data: DBSTAMP2 TIME..... (null) 23611 INF 7 DBMKnl Data: BD PAGE COUNT..... (null) 23611 INF 7 DBMKnl Data: TAPEDEVICES USED.. 1 23611 INF 7 DBMKnl Data: DB_IDENT.. ralfmaxdb01:C11_20230307_193608 23611 INF 7 DBMKnl Data: MAX USED DATA PNO. 0 23611 INF 7 DBMKnl Data: CONV PAGE COUNT.. (null) 2023-03-07 20:17:46 23611 INF 419 DBMSrv Command 'backup_finish' has ended with return code 0. Restore using an Snapshot HowTo - SAP MaxDB Recovery with Database Manager CLI - MaxDB - Support Wiki Recovery tests Crash the system by sending the sysrequest trigger b echo b > /proc/sysrq-trigger umount the data volume before we restore the snapshot umount /sapdb/C11/sapdata restore the SnapShot Remount the volume and start the DB for the automated recovery mount -a go to Restore the database --> further down Creating automated DB SnapShots A MaxDB Snapshot must be created before taking a storage Snapshot. The database will be set into a consistent state by quiescing the database. The following steps show how to perform database backup by using a storage Snapshot copy. Install the Azure CLI on Linux | Microsoft Docs (SLES) Download the azacsnap tool https://aka.ms/azacsnapinstaller Get started with Azure Application Consistent Snapshot tool for Azure NetApp Files | Microsoft Learn 1612412 - SAP MaxDB: How does a database backup with external file system backups take place? 1928060 - Data backup and recovery with file system backup - SAP ONE Support Launchpad 2282054 - Background DBM server - SAP ONE Support Launchpad SAP MaxDB | SAP Community Configure azacsnap Install the Azure Application Consistent Snapshot tool for Azure NetApp Files | Microsoft Learn Azacsnap is supporting only HANA, DB2 and Oracle at the moment. It is, however, possible to take a snapshot from the data volume and use the new feature in the version 6 with pre and post automation. Create the service principal for your subscription and install azacsnap – in the Azure Portal Store the output in a file I used /tmp/auth.json az ad sp create-for-rbac --name "AzAcSnap" --role Contributor --scopes /subscriptions/{subscription-id} --sdk-auth You will get an output which looks similar to this: { "clientId": "0815**4711-4**-a91f-d937*********1", "clientSecret": "d~_8Q~****Zk*****Y_********", "subscriptionId": "47110815-***-****-***-**********", "tenantId": "K47110815-****-4ecc-bda0-**********", "activeDirectoryEndpointUrl": "Sign in to your account", "resourceManagerEndpointUrl": "https://management.azure.com/", "activeDirectoryGraphResourceId": "https://graph.windows.net/", "sqlManagementEndpointUrl": "https://management.core.windows.net:8443/", "galleryEndpointUrl": "https://gallery.azure.com/", "managementEndpointUrl": "https://management.core.windows.net/" } Create an auth.conf file and copy the content into this file vi /tmp/auth.json ls -l /Software/azacsnap* admin01 users 16478438 Mar 8 15:30 /Software/azacsnap_7a_(1AA8343)_installer.run Install azacsnap cd /Software/ ralfmaxdb01:/Software # chmod 755 azacsnap_7a_\(1AA8343\)_installer.run ./azacsnap_7a_\(1AA8343\)_installer.run -I Configure azacsnap su - azacsnap azacsnap -c configure --configuration=new Building new config file Add comment to config file (blank entry to exit adding comments): MaxDB Add comment to config file (blank entry to exit adding comments): Enter the database type to add, 'hana', 'oracle', 'db2', or 'exit' (to save and exit): hana === Add SAP HANA Database details === HANA SID (e.g. H80): C11 HANA Instance Number (e.g. 00): 00 HANA HDB User Store Key (e.g. `hdbuserstore List`): ADMIN HANA Server's Address (hostname or IP address): 10.6.0.4 Do you need AzAcSnap to automatically disable/enable backint during snapshot? (y/n) [n]: === Azure NetApp Files Storage details === Are you using Azure NetApp Files for the database? (y/n) [n]: y Enter new value for 'ANF Backup (none, renameOnly)' (current = 'none'): renameOnly --- DATA Volumes have the Application put into a consistent state before they are snapshot --- Add Azure NetApp Files resource to DATA Volume section of Database configuration? (y/n) [n]: --- OTHER Volumes are snapshot immediately without preparing any application for snapshot --- Add Azure NetApp Files resource to OTHER Volume section of Database configuration? (y/n) [n]: y Full Azure NetApp Files Storage Volume Resource ID (e.g. /subscriptions/.../resourceGroups/.../providers/Microsoft.NetApp/netAppAccounts/.../capacityPools/Premium/volumes/...): /subscriptions/da/resourceGroups/ralfMaxDB/providers/Microsoft.NetApp/netAppAccounts/ralfmaxdbanf/capacityPools/ralfMaxDB/volumes/C11data Service Principal Authentication filename or Azure Key Vault Resource ID (e.g. auth-file.json or https://...): auth.json Add Azure NetApp Files resource to OTHER Volume section of Database configuration? (y/n) [n]: === Azure Managed Disk details === Are you using Azure Managed Disks for the database? (y/n) [n]: === Azure Large Instance (Bare Metal) Storage details === Are you using Azure Large Instance (Bare Metal) for the database? (y/n) [n]: Enter the database type to add, 'hana', 'oracle', 'db2', or 'exit' (to save and exit): exit Editing configuration complete, writing output to 'azacsnap.json'. Test the storage connection, at this point we “only” can test the storage connection. The ASE backup-mode will be scheduled as “runbefore” and “runafter”. azacsnap -c test --test storage –preview PASSED: Storage test completed successfully for all 'other' Volumes END : Storage tests complete END : Test process complete for 'storage' Create the .bashrc for the azacsnap user (compare the environment from the SIDadm user) vi .bashrc test -s ~/.alias && . ~/.alias || true export PATH=$PATH:/sapdb/clients/C11/bin:/sapdb/programs/bin export LD_LIBRARY_PATH=/usr/sap/C11/SYS/exe/run:/usr/sap/C11/SYS/exe/uc/linuxx86_64:/sapdb/clients/C11/lib export LANG=C.UTF-8 create the user key xuser set -U ADMIN -d C11 -u superdba,<pwd> Test the dbmcli connection using the user-key dbmcli -U ADMIN dbmcli on C11>quit Create the two Quiece and Unquiece scripts. (no Microsoft support) this is only an example. vi cat MaxDBQuiece.sh #!/bin/bash SID="$1" KEY="$2" DATE="`date +%m-%d-%Y`" LOGFILE="/tmp/MaxDM_Snapshot${SID}.log" # MAX LOGFILE SIZE is 2 MB MAXSIZE=2000000 # Get file size FILESIZE=$(stat -c%s "$LOGFILE") if [[ "$SID" == "" || "$KEY" == "" ]]; then echo "Usage: `basename $0` <SID> <USERSTOREKEY>" exit 1 fi sqlFile=$(mktemp) cat > $sqlFile << EOF background_server_start myserver background_server_execute myserver db_connect background_server_get_reply myserver -wait background_server_execute myserver backup_start External_Snapshot DATA background_server_get_reply myserver -wait EOF echo "Size of $LOGFILE = $FILESIZE bytes." >>$LOGFILE if (( $FILESIZE > $MAXSIZE)); then echo "Moving the MaxDM Snapshot logfile to a backup" >>$LOGFILE mv $LOGFILE ${LOGFILE}-${DATE} else echo "Logfilesize OK" >>$LOGFILE fi echo "`date` Creating MaxDB SnapShot" >>$LOGFILE #rc=`dbmcli -U $KEY -i $sqlFile -b | head -1 | tr -d "[:blank:]"` dbmcli -U $KEY -uUTL -i $sqlFile >>$LOGFILE echo "Returncode = $?" >>$LOGFILE rm $sqlFile vi MaxDBunQuiece.sh #!/bin/bash SID="$1" KEY="$2" DATE="`date +%m-%d-%Y`" LOGFILE="/tmp/MaxDM_Snapshot${SID}.log" # MAX LOGFILE SIZE is 2 MB MAXSIZE=2000000 # Get file size FILESIZE=$(stat -c%s "$LOGFILE") if [[ "$SID" == "" || "$KEY" == "" ]]; then echo "Usage: `basename $0` <SID> <USERSTOREKEY>" exit 1 fi sqlFile=$(mktemp) cat > $sqlFile << EOF background_server_execute myserver backup_finish External_Snapshot ExternalBackupID ANFSnapShot background_server_get_reply myserver -wait background_server_exit myserver EOF echo "Size of $LOGFILE = $FILESIZE bytes." >>$LOGFILE if (( $FILESIZE > $MAXSIZE)); then echo "Moving the MaxDM Snapshot logfile to a backup" >>$LOGFILE mv $LOGFILE ${LOGFILE}-${DATE} else echo "Logfilesize OK" >>$LOGFILE fi echo "`date` Creating MaxDB SnapShot" >>$LOGFILE #rc=`dbmcli -U $KEY -i $sqlFile -b | head -1 | tr -d "[:blank:]"` dbmcli -U $KEY -uUTL -i $sqlFile >>$LOGFILE echo "Returncode = $?" >>$LOGFILE rm $sqlFile chmod 755 MaxDB* create the cron script to schedule the azacsnap call vi cron_backup_daily.sh #!/bin/bash BACKUP_PREFIX="daily" PRIMARY_BACKUP_RETENTION=2 SAPSID="C11" USERKEY="ADMIN" ## AZACSNAP - PRIMARY BACKUP ## #HANA_CLIENT_PATH=`find /hana/shared/ -name hdbclient -type d -print 2>/dev/null` #export PATH=$PATH:$HANA_CLIENT_PATH # echo "Executing primary backup with prefix $BACKUP_PREFIX (retention ${PRIMARY_BACKUP_RETENTION})." /home/azacsnap/bin/azacsnap -c backup --volume other --prefix $BACKUP_PREFIX --retention $PRIMARY_BACKUP_RETENTION -v --runbefore "/home/azacsnap/bin/MaxDBQuiece.sh $SAPSID $USERKEY" --runafter "/home/azacsnap/bin/MaxDBunQuiece.sh $SAPSID $USERKEY" –preview chmod 755 cron_backup_daily.sh Schedule the daily backup in the cron crontab -e # create daily backups twice a day and replicate them via ANF backup 0 2,14 * * * /home/azacsnap/bin/cron_backup_daily.sh Check the backup history in MaxDB backup_history_list -c label,action,pages,stop,media OK END |HISTLOST | | | | |HISTLOST | | | | DAT_000000001|SAVE WARM|44272|2023-03-07 19:39:57|d1 | LOG_000000001|SAVE WARM| 6952|2023-03-07 19:45:09|l1 | DAT_000000002|SAVE WARM| 0|2023-03-07 20:17:45|External_Snapshot | DAT_000000005|SAVE WARM| 0|2023-03-08 16:52:18|External_Snapshot | DAT_000000008|SAVE WARM| 0|2023-03-08 17:10:02|External_Snapshot | Show the MaxDB Templates backup_template_show ALL OK NAME d1 CONTENT DATA CREATIONDATE 20230307193424 MODIFICATIONDATE 20230307193424 TOOL NONE BLOCKSIZE 8 DATACARRIER TYPE FILE LOCATION /sapdb/C11/backup/data/DAT0001 OVERWRITE NO COMPRESSED NO NAME l1 CONTENT AUTO CREATIONDATE 20230307193440 MODIFICATIONDATE 20230307193440 TOOL NONE BLOCKSIZE 8 DATACARRIER TYPE FILE LOCATION /sapdb/C11/backup/log/LOG0001 OVERWRITE NO COMPRESSED NO NAME External_Snapshot CONTENT DATA CREATIONDATE 20230307201008 MODIFICATIONDATE 20230307201008 TOOL DBMC BLOCKSIZE 8 DATACARRIER TYPE EXTERNAL LOCATION OVERWRITE NO COMPRESSED NO List the taken SnapShots azacsnap -c details --preview >>> Preview Feature 'ANF Backup' enabled in config file 'azacsnap.json'. ================================================================================ PREVIEWS ARE PROVIDED "AS-IS," "WITH ALL FAULTS," AND "AS AVAILABLE," AND ARE EXCLUDED FROM THE SERVICE LEVEL AGREEMENTS AND LIMITED WARRANTY Preview Terms Of Use | Microsoft Azure ================================================================================ User has enabled execution of PREVIEW features with '--preview'. -------------------------------------------------------------------------------- List snapshot details called with snapshotFilter '' #, Volume, SnapshotName, Created #1, C11data, Backup_202303141218, 14-Mar-2023 11:18:44am (UTC+0) #2, C11data, Backup_202303141215, 14-Mar-2023 11:15:20am (UTC+0) #3, C11data, Backup_202303131057, 13-Mar-2023 9:57:42am (UTC+0) Restore using azacsnap Shutdown SAP and ASE (if possible – if not simply “kill” the DB. We are restoring anyway. stopsap all umount the data volume umount /sapdb/C11/sapdata At the moment azacsnap does not support “Revert Volume” for ANF. If you would like to keep the volume names you have the option to “revert a volume using the Azure Portal. See: su – azacsnap cd bin azacsnap -c restore --dbsid C11 --restore revertvolume --configfile azacsnap.json --snapshotfilter daily__F44BFE3175B__c11data ... Azure NetApp Files volumes not supported for revertvolume, will not revert volume. With ANF you do have the option to clone a volume. This is probably the better option anyway. How to clone a volume for a recovery is demonstrated here: AzAcSnap is designed to restore a collection of dataVolumes and otherVolumes. AzAcSnap makes sure all the dataVolumes share the same snapshot to be restored and the otherVolumes the latest snapshot to be restored. In a deployment with multiple data volumes (e.g., SAP HANA Scale-Out) this can save a lot of time trying to ensure all the snapshots match in the Azure Portal before cloning or reverting the volumes. This means when using a setup with custom scripts to quiesce/unquiesce the database it's necessary to create a copy of the backup configfile and change "otherVolume" to "dataVolume" and change "dataVolume" to "otherVolume" effectively switching them. cp azacsnap.json azacsnap_snaptovol.json vi azacsnap_snaptovol.json "anfStorage": [ { "otherVolume": [], "dataVolume": [ Down here are the specifications of your ANF volumes à keep unchanged change only dataVolume to otherVolume and otherVolume to dataVolume. list the available SnapShots azacsnap -c details List snapshot details called with snapshotFilter '' #, Volume, SnapshotName #1, ralfC11data, daily__F44BFE3175B__c11data azacsnap -c restore --dbsid C11 --restore revertvolume --configfile azacsnap_snaptovol.json --snapshotfilter daily__F44BFE3175B__c11data create the new /etc/fstab pwd /home/azacsnap/bin grep rwclone ./logs/*.log … Creating new volume 'ralfc11data-rwclone-20221111-0732' … Volume 'ralfc11data-rwclone-20221111-0732' successfully created from snapshot. … … Creating new volume 'ralfc11sybase-rwclone-20221111-0732' … Volume 'ralfc11sybase-rwclone-20221111-0732' successfully created from snapshot. Mount the cloned volume to the sapdata directory mount -a Recover the database dbmcli -U ADMIN dbmcli on C11>backup_history_list -c label,action,pages,stop,media OK ... .. | DAT_000000030|SAVE WARM|0|2023-03-14 11:18:04|External_Snapshot | DAT_000000031|SAVE WARM|0|2023-03-14 11:18:57|External_Snapshot | --- dbmcli on C11>quit Restore the latest SnapShot dbmcli -U ADMIN db_admin OK db_connect OK recover_start External_Snapshot DATA ExternalBackupID DAT_000000031 OK Start the DB and SAP The Database will automatically apply the latest logfiles to the database. su – c11adm startsap Upgrade MaxDB su - c11adm stopsap as root cd /Software/MaxDB/Patch/MaxDB_7.9___SP10_Build_05_/DATA_UNITS/MAXDB_LINUX_X86_64 ./SDBUPD –d C11 -u control,<pwd> ANF Cross Region Replication Azure NetApp Files volume replication is supported between various Azure regional pairs and non-standard pairs. Azure NetApp Files volume replication is currently available between the following regions. You can replicate Azure NetApp Files volumes from Regional Pair A to Regional Pair B, and vice versa. Cross-region replication of Azure NetApp Files volumes | Microsoft Learn Azure NetApp Files cross region replication and new enhancements in preview | Azure Blog and Updates | Microsoft Azure Cross-zone replication of Azure NetApp Files volumes | Microsoft Learn Create an storage account in the destination region (must be the paired region (see table). Create a VNET (if not already existing in the DR region) Create a Capacity Pool for the DR volume (can be a different QoS level) Create the target DR volume. On the destination storage account overview select Add data Protection obviously the new volume should have the same size as the destination volume. Schedule an hourly replication for the data volume Now authorize the source volume for the replication. Specify the volume resource ID of the DR volume to the Source volume Finished Now repeat the same for the log backup volume but schedule the transfer every 10 Minutes Crontab for snapshots and logbackup crontab -l # create daily backups twice a day and replicate them via ANF backup 0 2,14 * * * /home/azacsnap/bin/cron_backup_daily.sh */10 * * * * /home/azacsnap/bin/cron_logbackup.sh The second part with the log volume is optional if you set the autolog_on to 300 second (5 minutes) Create the logbackup script vi cron_logbackup.sh #!/bin/bash SID="$1" DATE="`date +%m-%d-%Y`" LOGFILE="/tmp/MaxDM_Logbackup${SID}.log" # MAX LOGFILE SIZE is 2 MB MAXSIZE=2000000 # Get file size FILESIZE=$(stat -c%s "$LOGFILE") if [[ "$SID" == "" ]]; then echo "Usage: `basename $0` <SID> " exit 1 fi echo "Size of $LOGFILE = $FILESIZE bytes." >>$LOGFILE if (( $FILESIZE > $MAXSIZE)); then echo "Moving the MaxDM logbackup logfile to a backup" >>$LOGFILE mv $LOGFILE ${LOGFILE}-${DATE} else echo "Logfilesize OK" >>$LOGFILE fi echo "`date` Creating MaxDB Logbackup" >>$LOGFILE #rc=`dbmcli -U $KEY -i $sqlFile -b | head -1 | tr -d "[:blank:]"` dbmcli -U ADMIN -uUTL -c backup_start l1 >>$LOGFILE echo "Returncode = $?" >>$LOGFILE as an alternative you can enable autolog backup to 300 seconds dbmcli -U ADMIN dbmcli on C11>db_connect dbmcli on C11>autolog_off dbmcli on C11>autolog_on l1 INTERVAL 300 dbmcli on C11>db_stop dbmcli on C11>db_start dbmcli on C11>exit END Continue reading...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.