http://sapbasisinfo.com/blog/2018/03/12/useful-python-scripts-for-hana/
All python scripts can be found in exe/python_support directory.
These scripts can affect the system therefore it’s better to check with ‘-help’ switch before executing the scripts.
systemOverview.py
You can get system information with this script like Instance, Services, Memory, Disk, Memory etc.
python systemOverview.py
Example;
landscapeHostConfiguration.py
It gives the host , group roles and status of the landscape.
python landscapeHostConfiguration.py
Example ;
HanaHwCheck.py
Check and list complete HW information of the related system.
python HanaHwCheck.py –v
Example;
getParameter.py
Checks the values from the file which you execute for.
python getParameter.py –key=<filename>
Example;
fullSystemInfoDump.py
Collects diagnosis information from the SAP HANA database
Some options:
-F FROMDATE, –fromDate=FROMDATE
Collects trace files starting from the specified date
(format: YYYY-MM-DD)
-T TODATE, –toDate=TODATE
Collects trace files up to the specified date (format:
YYYY-MM-DD)
-e EXPORTPATH, –exportPath=EXPORTPATH
Path to exported tables/views
-t TENANT, –tenant=TENANT
Specifies the tenant where the files are to be collected
Example;
Other some scripts ;
recoverSys.py
You can start the recovery on your database or cancel the active process
HDBSettings.sh recoverSys.py [<parameters>]
Example;
HDBSettings.sh recoverSys.py –command=”RECOVER DATABASE UNTIL TIMESTAMP ‘2018-02-01 09:30:00′”
HDBSettings.sh recoverSys.py –command=”RECOVER DATABASE UNTIL TIMESTAMP ‘2018-02-01 09:30:00’ USING LOG PATH (‘/system/backup/TST/log’) USING BACKUP_ID 1588445415345 CHECK ACCESS USING FILE”
mergeDeltaTable.py
Delta merge on a column table
python mergeDeltaTable.py [options] tableName
memorySizing.py
Analyzes the memory consumption of the system.
memorySizing.py [options]
Measurement Options:
-l LOADTABLES, –loadTables=LOADTABLES
if yes (no), (do not) load tables before sizing
[default: yes]
-i IMMEDIATEUNLOAD, –immediateUnload=IMMEDIATEUNLOAD
immediately unload a table after loading (possible
values: no, unloaded, partially_loaded, all) – only
relevant together with –loadTables yes [default: no]
-m MERGECOMPRESS, –mergeCompress=MERGECOMPRESS
if yes (no), (do not) merge and compress tables before
sizing [default: yes]
Example;
HDBSettings.sh memorySizing.py -a localhost:30015 -u SYSTEM -p ******* -l LOADTABLES
https://blogs.sap.com/2017/11/23/10-useful-python-script-for-hana/
Python support scripts of the HANA Database as HANA 1.0 SPS12
The python support can be found in /usr/sap/<SID>/HDB<XX>/exe/python_support.
Usually you can use the option ‘–help’ and ‘–helpGeneral’ on each scripts. Be carefeful before you execute one, these scripts can impact the system.
You can use HDBSettins.sh combined with the script, which passes the necessary variables towards.
Example:
HDBSettings.sh fullSystemInfoDump.py –help
fullSystemInfoDump.py
Collects diagnosis information from the SAP HANA database
Some options:
-F FROMDATE, –fromDate=FROMDATE
Collects trace files starting from the specified date
(format: YYYY-MM-DD)
-T TODATE, –toDate=TODATE
Collects trace files up to the specified date (format:
YYYY-MM-DD)
-e EXPORTPATH, –exportPath=EXPORTPATH
Path to exported tables/views
-t TENANT, –tenant=TENANT
Specifies the tenant where the files are to be
collected
Example:
python fullSystemInfoDump.py -F 20171110 -T 20171112
getParameter.py (download from 2399996)
Reads values from various HDB ini files.
Example:
python getParameter.py –key=global/persistence/log_mode
hanacleaner.py
Cleans up backup catalog, trace files, alerts, audit logs, etc – can be set as a periodic task.
This script is an expert tool designed by SAP support. You are allowed to use it, but SAP doesn’t take over any responsibility for problems originating from the use of this tool.
Example:
(trace files, statistics server alerts and backup catalog entries, i.e. not the backups themselves, older than 42 days
are deleted and backup logs bigger than 50 mb are compressed and renamed and logsegments a removed if more than 20
free once exist for a service):
> python hanacleaner.py -tc 42 -tf 42 -ar 42 -bd 42 -zb 50 -lr 20 -eh 2 eu -42
AUTHOR: Christian Hansen
(2399996 – How-To: Configuring automatic SAP HANA Cleanup with SAP HANACleaner)
HanaHwCheck.py
Show complete HW information
Example:
python HanaHwCheck.py -v
landscapeHostConfiguration.py
Shows the hosts’ groups, roles and status of the landscape.
Example:
python landscapeHostConfiguration.py
mergeDeltaTable.py
Initiates a delta merge on a column table
Usage:
python mergeDeltaTable.py [options] tableName
See also:
-> mergeAllDeltaTables.py
memorySizing.py
Analyzes the memory consumption of the system.
memorySizing.py [options]
Check note for details: 1698281 – Assess the memory consumption of a SAP HANA System
Measurement Options:
-l LOADTABLES, –loadTables=LOADTABLES
if yes (no), (do not) load tables before sizing
[default: yes]
-i IMMEDIATEUNLOAD, –immediateUnload=IMMEDIATEUNLOAD
immediately unload a table after loading (possible
values: no, unloaded, partially_loaded, all) – only
relevant together with –loadTables yes [default: no]
-m MERGECOMPRESS, –mergeCompress=MERGECOMPRESS
if yes (no), (do not) merge and compress tables before
sizing [default: yes]
Example:
HDBSettings.sh memorySizing.py -a localhost:30015 -u SYSTEM -p ******* -l LOADTABLES
recoverSys.py
Recovers the database or cancel the recovery process.
Emergency restore & recover is possible even if database is not able to start.
HDBSettings.sh recoverSys.py [<parameters>]
Examples:
HDBSettings.sh recoverSys.py –command=”RECOVER DATABASE UNTIL TIMESTAMP ‘2017-11-10 07:00:00′”
HDBSettings.sh recoverSys.py –command=”RECOVER DATABASE UNTIL TIMESTAMP ‘2017-11-10 07:00:00’ USING LOG PATH (‘/remote/backup/P50/log’) USING BACKUP_ID 1380740405546 CHECK ACCESS USING FILE”
systemOverview.py
Shows base system information, such as Instance, Services, Disk, Memory details.
Example:
python systemOverview.py
All Python scripts delivered with HANA can be found with the alias cdpy (as sidadm) or unter the path /usr/sap/<SID>/HDB<instancenumber>/exe/python_support.
To add some further useful python scripts:
- loadAllTables.py => to load all tables of a schema into memory (usage: python loadAllTables.py –help)
- systemReplicationStatus.py => status of HSR
- systemOverview.py => OS level, HANA version, disk status etc.
- indexAdvisor.py => index advisor for column tables (usage: python indexAdvisor.py -h)
Python scripts are depend on HANA SPS and revision level.
'Database' 카테고리의 다른 글
[HANA] Workload Management (internal) (0) | 2019.05.01 |
---|---|
[HANA] HANA DB Trace (0) | 2019.04.28 |
[HANA] HANA DB Startup (0) | 2019.04.27 |
[HANA] Parameter - service_thread_sampling_monitor_enabled (0) | 2019.04.26 |
[HANA] Parameter - expensive statement 관련 (0) | 2019.04.26 |