Friday 29 April 2016

Move HANA data and log files to different mount point

I decided to write this because I ran into a space problem while trying to upgrade a HANA test system. Of course, it isn’t a certified appliance, but I had to move the data and log files to another mount point to free up enough space to complete the upgrade.

Moving data files to a different mount point is a common procedure for many databases, but typically isn’t an issue with HANA’s appliance model. HANA has a very specific hardware configuration with the persistent mount point being 4 times RAM. The introduction of the Tailored Datacenter Integration (TDI) may warrant this process a little more often. I’ve outlined the steps below to move the $(DIR_GLOBAL)/hdb/data and $(DIR_GLOBAL)/hdb/log directories to a different location.
MAKE BACKUP OF DATABASE BEFORE DOING ANYTHING.
  • Make new mount point
  • Logon to appliance as root or sudo user
    • Create new directory where data and log files will be stored
      • Eg. mkdir /hanadata
    • Mount the new drive, NFS mount or LUN at /hanadata. This is typically done in /etc/fstab, but I won’t go into details here
  • Create data and log subdirectories under new mount point
    • cd /hanadata
      • mkdir data
      • mkdir log
Move HANA data and log files to different mount point
  • Change ownership of new data dir to match ownership of /usr/sap/<SID>
    • chown <sid>adm:sapgrp /<newmount> -R
      • eg. chown anaadm:sapsys /hanadata/ -R

Move HANA data and log files to different mount point

  • Change location of persistence in Hana studio – HANA must be running
    • Browse to global.ini>persistence>
      • Update basepath_datavolumes to point to /<newmount>/data
        • Update basepath_logvolumes to point to /<newmount>/log
Move HANA data and log files to different mount point

  • Stop HANA
    • su - <sid>adm
    • HDB stop
Move HANA data and log files to different mount point
  • Verify HANA services are stopped
Move HANA data and log files to different mount point
  • Copy files to new location
    • I suggest to copy, instead of move, in case there are any problems. The original files can be removed/deleted after verifying HANA is up and running using the new file location.
    • cp /usr/sap/<SID>/global/hdb/data/* /hanadata/data -rp
    • cp /usr/sap/<SID>/global/hdb/log/* /hanadata/log –rp
  • The r is recursive to include all sub-directories
  • The p is preserve mode, to keep all permissions
  • Start DB
Move HANA data and log files to different mount point

Verify HANA starts and check nameserver trace file to verify HANA is using correct data and log files:

Move HANA data and log files to different mount point

Troubleshooting              

I ran into the issue below when I tried to start HANA the first time after copying the files. This occurred
because I didn’t use the –p switch in my copy command, so the files took the root permissions. I am including to show what will happen if <sid>adm doesn’t have write permissions to the data or log files.

Move HANA data and log files to different mount point
  • I easily fixed this issue by again running the below command
    • chown <sid>adm:sapgrp /<newmount> -R

Source: scn.sap.com

No comments:

Post a Comment