Technical Articles
HANA parameter change without DB user from console tool setParameter.py – SPS05 and above
Introduction – Console Tool setParameter.py
From SAP HANA version 2.0 SPS05, you can use the console tool setParameter.py to make changes to configuration parameter values, it can be run from the command line or integrated with other administration management tools and scripts.
The tool can be used either when the database is offline or online if for any reason it is not possible to make a configuration parameter change by executing an SQL statement. It ensures that if changes are made simultaneously to an ini file the changes are synchronized and applied correctly, this eliminates the need for administrators to directly edit ini files.
Syntax
The command supports both setting and unsetting parameters. No key value is required when unsetting a parameter:
python setParameter.py -set(or unset)=<LAYER>/<INIFILE_NAME>/<SECTION>/<KEY>=<VALUE>
[-comment=comment] [-reconfigure] [-sapcontrol=1]
The tool also supports a ‘help’ argument (-h) which displays a page of help text. The help page is shown automatically if invalid syntax is entered.
Example
One of the coolest features of this tool is that we can use it as a script to set or unset multiple values at the same time.
- Setting for SYSTEMDB
- Setting for tenant DB
- Setting Multiple values together
Conclusion : Return Values (0/1/2)
After submitting the command one of the following codes is returned indicating success or failure of the execution:
-
0 Successful execution
-
1 Could not be executed because of incorrect usage (unexpected parameter values)
-
2 Other error
If the -sapcontrol=1 is provided, then one of the following is printed in the output:
-
SAPCONTROL-OK
-
SAPCONTROL-ERROR:<errorMsg>
This python tool is really very helpful for doing mass changes, where you don’t need to authenticate on every server for DB user for running the ALTER statements.
Great info Vivek thanks for sharing
Hi Vivek,
is it intended that the script will also check - in the future - whether parameters, sections and values are correct? And will direct changes in the ini files be prevented in the future?
BR
Hi Michael
I don't think so, this was only intended to do the changes for HANA parameters.
In every new hana revision, we have some parameters which discontinues and some newly added parameters as well, so this won't be able to serve the purpose that efficiently.
But, there is a configuration parameter in global.ini file :
[configuration]
unsupported_configuration_change = error
If this is set, then it won't allow you to set any wrong parameter/section/key/value and throw an error.
Best Regards,
Vivek Sahu
Hi Vivek Sahu ,
i would love to see a getParameter.py which could be used to display the current parameter values instead of having to query M_CONFIGURATION_PARAMETER_VALUES (or M_INIFILE_CONTENTS). Are there any plans to provide such a console tool?
Best regards
Joe
Hello Joe,
Unfortunately, there is no such tool to read or display the parameter values outside of SQL prompt.
From DB server, you can either use the monitoring views M_INIFILE_CONTENTS, M_INIFILE_CONTENT_HISTORY or just read it from *.ini files placed into the config directory.
Best Regards,
Vivek Sahu
Hello,
there is such a script:
getParameter.py --key=<inifileName>/<section>/<key> [repeat as required] [--sapcontrol=1]
However this script only reads the values in the given ini files so it may not consider all possible sources of a parameter e.g. a parameter that considers both global.ini and indexserver.ini.
So it is not a replacement for the M_CONFIGURATION_PARAMETER_VALUES view that displays the effective value of a parameter for each service, and more like M_INIFILE_CONTENTS in that it displays the values in the ini files.
Best regards,
Sebastian
Hello Sebastian,
thank you for this hint. But since it does not verify the effective parameter values it does not fully cover our intended use-case.
Br,
Joe
Will we have a view on who/when did the parameter changes done, if there is no comment input during set parameter with setParameter.py? Thinking from a auditing perspective.
Hello Ian,
I also raised to HANA Product team about same request w.r.t auditing, but at the moment there is no such option to track it down.
users having <sid>adm access on OS, can execute the python script and shall be able to do the parameter changes. So, only OS level auditing is possible for now.
Best Regards,
Vivek Sahu
Hello Ian,
There is a view M_INIFILE_CONTENT_HISTORY and I recently have tried to explain the related behaviors in a blogpost , you may take a look .
Knowing the restart properties of SAP HANA parameters, change and monitor results from server level | SAP Blogs
Best Regards,
Bitan
Hello Vivek Sahu ,
I've determined a side effect when setting a value using setParameter.py and placing the setting in double-quotes as shown in your screenshots.
python setParameter.py -set="SYSTEM/webdispatcher.ini/profile/ssl/ciphersuites=546:eAES:\!kRSA" -reconfigure -sapcontrol=1
`546:eAES:\!kRSA
.Hi Johannes Goerlich,
Thanks for reporting the exception, we can definitely send this feedback to HANA dev support for rectification or updating the documentation. Feel free to report it via customer message.
Best Regards,
Vivek Sahu