GithubHelp home page GithubHelp logo

hanacleaner's Introduction

HANACleaner

A house keeping script for SAP HANA

DESCRIPTION:

The HANA cleaner is a house keeping script for SAP HANA. It can be used to clean the backup catalog, diagnostic files, alerts, to compress the backup logs, and much more. It should be executed by adm or, in case you use a CRON job, with the same environment as the adm. See SAP Note 2399996 and SAP Note 2400024. For a list of all input flags execute with
python hanacleaner.py --help

DISCLAIMER:

ANY USAGE OF HANACLEANER ASSUMES THAT YOU HAVE UNDERSTOOD AND AGREED THAT:

  1. HANACleaner is NOT SAP official software, so normal SAP support of HANACleaner cannot be assumed
  2. HANACleaner is open source
  3. HANACleaner is provided "as is"
  4. HANACleaner is to be used on "your own risk"
  5. HANACleaner is a one-man's hobby; developed, maintained and supported only during non-working hours
  6. HANACleaner expects "default" HANA environment with no modifications done in the .bashrc or other files
  7. All HANACleaner documentations have to be read and understood before any usage:
  • SAP Note 2399996
  • The .pdf file hanacleaner_intro.pdf
  • All output from executing python hanacleaner.py --help
  1. HANACleaner can help you execute certain SAP HANA tasks automatically but is NOT an attempt to teach you SAP HANA
    Therefore it is assumed that you understand all SQL statements that HANACleaner does to make changes in your system
    To find out what crucial SQL statements HANACleaner will do without executing them, run with the additional flags
    -es false -os true
    To then learn what those statements do before you executing HANACleaner without "-es false", see SAP HANA Admin Guide or SAP HANA System Administration Workshops
  2. HANACleaner is not providing any recommendations, all flags shown in the documentation (see point 6.) are only examples
    For recommendations see SAP HANA Administration Workshops or other documentation, like e.g. SAP Note 2400024

hanacleaner's People

Contributors

chriselswede avatar dheule avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hanacleaner's Issues

Cleanup of compressed files

Hello,

As HANA backups can easily be reduced to 30% when compressing them (gzip), we thought it was a good idea to compress them afterwards. Unfortunately HANACleaner does not seem to accept that, even if the compressed backup files are renamed after the compression. Does that mean that HANACleaner needs to read information from the original files to perform some kind of validations? If so, would it be possible to have a parameter to force the deletion ?

Here is the output of a "file" command :

T1R_20200810-112704_databackup_5_1: gzip compressed data, was "T1R_20200810-112704_databackup_5_1", from Unix, last modified: Mon Aug 10 11:27:11 2020, max compression

SyntaxError: invalid syntax , line 7 <!DOCTYPE html>

Hello,

  I'm facing an error below after execution of hanacleaner.py script , it's exactly first line in scirpt , previous six are empty. Could you please have a look?

File "/hana/shared/scripts/hanacleaner/hanacleaner.py", line 7

^
SyntaxError: invalid syntax

Thank you

In regards

Jan Patak

HANA Cleaner with SSL

Hello,

We have the problem that since on our HANA the parameter sslenforce set to TRUE it's not possible anymore for HANA Cleaner to connect with the hdbuserstore to the database.

Is it possible to ressolve this issue?

Thanks
Stefan

hanacleaner.py deletes running log backups...

I'm actively using hanacleaner.py for our HANA dbs, and I've found and issue with this command:

python /hana/shared/HANA_CLEANER/hanacleaner.py -k HANACLEANER1KEY -dbs SYSTEMDB,XXX -bd 30 -be 30 -br true -op /hana/shared/HANA_CLEANER/hanacleaneroutput

(...)
| 1648856926220 | log backup | 1648856926220 | 2022-04-01 23:48:46.220000000 | successful |
| 1648857036969 | log backup | 1648857036969 | 2022-04-01 23:50:36.969000000 | successful |
| 1648857044623 | log backup | 1648857044623 | 2022-04-01 23:50:44.623000000 | successful |
| 1648857208854 | log backup | 1648857208854 | 2022-04-01 23:53:28.854000000 | successful |
| 1648857230029 | log backup | 1648857230029 | 2022-04-01 23:53:50.029000000 | successful |
| 1651525197388 | log backup | 1651525197388 | 2022-05-02 20:59:57.388000000 | running |
| 1651525197389 | log backup | 1651525197389 | 2022-05-02 20:59:57.389000000 | running |
| 1651525197390 | log backup | 1651525197390 | 2022-05-02 20:59:57.390000000 | running |
| 1651525197392 | log backup | 1651525197392 | 2022-05-02 20:59:57.392000000 | running |
| 1651525197393 | log backup | 1651525197393 | 2022-05-02 20:59:57.393000000 | running |
| 1651525197394 | log backup | 1651525197394 | 2022-05-02 20:59:57.394000000 | running |
| 1651525197395 | log backup | 1651525197395 | 2022-05-02 20:59:57.395000000 | running |
| 1651525197397 | log backup | 1651525197397 | 2022-05-02 20:59:57.397000000 | running |
| 1651525197398 | log backup | 1651525197398 | 2022-05-02 20:59:57.398000000 | running |
| 1651525197399 | log backup | 1651525197399 | 2022-05-02 20:59:57.399000000 | running |
| 1651525197401 | log backup | 1651525197401 | 2022-05-02 20:59:57.401000000 | running |
| 1651525197402 | log backup | 1651525197402 | 2022-05-02 20:59:57.402000000 | running |
| 1651525197403 | log backup | 1651525197403 | 2022-05-02 20:59:57.403000000 | running |
| 1651525197405 | log backup | 1651525197405 | 2022-05-02 20:59:57.405000000 | running |
| 1651525197406 | log backup | 1651525197406 | 2022-05-02 20:59:57.406000000 | running |
(...)

Is it a known issue ? something wrong in command used ?

INPUT ERROR: -ena is specified although -en is not, this makes no sense. Please see --help for more information.

Unless I put the en like [email protected], i get that error. How do i set it up without needing to specify an email?

Options I'm using.

-be 37 -tc 90 -te 90 -dr 30 -zb 50 -ar 90 -lr 300 -ur 30 -kr 7 -om 1000 -eh 30 -eu 30 -op /tmp/hanacleaneroutput/

This works
-be 37 -tc 90 -te 90 -dr 30 -zb 50 -ar 90 -lr 300 -ur 30 -kr 7 -om 1000 -eh 30 -eu 30 -op /tmp/hanacleaneroutput/ -en [email protected]

Even if i put -ena false, it still says i need -en

Do not delete sapstart.log

Hi Chris,

in clean_trace_files, you mustn't delete the file sapstart.log, which is required by the SAP Host Agent to determine running processes (sounds stupid, but that's the way it is). We ran into this issue during the configuration of Focused Run (SAP-based Monitoring Tool).

Best regards,
Benjamin

ERROR: Unexpted number output columns from df -h

Like Codebeta, we faced an issue with the command below :

python /hana/script/hanacleaner.py -k HANACLEANER1KEY -bd 2 -bb true -br true -op /hana/script/log

We are getting this :

Traceback (most recent call last):
  File "/hana/script/hanacleaner.py", line 1840, in <module>
    main()
  File "/hana/script/hanacleaner.py", line 1397, in main
    if max_filesystem_usage_in_percent(file_system, ignore_filesystems, logman) > 98:
  File "/hana/script/hanacleaner.py", line 639, in max_filesystem_usage_in_percent
    log("ERROR, Unexpted number output columns from df -h: \n", words)
  File "/hana/script/hanacleaner.py", line 290, in log
    if logmanager.print_to_std:
AttributeError: 'list' object has no attribute 'print_to_std'

We use the new version of the code. So this error must be fixed.
Could you help us ?

Regards

A small suggest aboout 'df' command

Separate df -h or df -hl , when I used this scripts on HANA DB Env, after a network smb device, had beed close , but system didn't umount it. This script will suspend when system run it .

I tried to umount it , but SUSE notify busy about that smb path. So I changed python script , use 'df -hl' instead of 'df -h'. Then issue solved.

Issue with virtual table statistics creation

When I tried to run the below command to virtual table statistics creation, received the mentioned error.

python hanacleaner.py -k HANACLEANERKEY -vs true -vt HISTOGRAM -vn 40 -vtt RECORD_COUNT -vto SIMPLE -os true

Error message:
Traceback (most recent call last):
File "hanacleaner.py", line 2494, in
main()
File "hanacleaner.py", line 2434, in main
[nVTs, nVTsOptimized] = create_vt_statistics(vtSchemas, maxColumnsOfVT, defaultVTStatType, maxRowsForDefaultVT, largeVTStatType, otherDBVTStatType, ignore2ndMon, sqlman, logman)
File "hanacleaner.py", line 1307, in create_vt_statistics
statType = defaultVTStatType if getNbrRows(vt[0], vt[1], sqlman) <= maxRowsForDefaultVT else largeVTStatType
File "hanacleaner.py", line 1015, in getNbrRows
return int(run_command(sqlman.hdbsql_jAQaxU + " "SELECT COUNT(*) FROM "+schema+"."+table+" "").strip(' '))
ValueError: invalid literal for int() with base 10: ''

Desired behaviour or bug? RECLAIM DATAVOLUME / -fl

Hi,

The parameter -fl is described as:

-fl fragmentation limit [%], maximum fragmentation of data volume files, of any service, before defragmentation of that
service is started: ALTER SYSTEM RECLAIM DATAVOLUME ':' 120 DEFRAGMENT, default: -1 (not used)
Note: If you use System Replication see Q19 in SAP Note 1999880.

This means, that when parameter -fl is set to e.g. 110, the check is made if a reclaim needs to be done (defrag > 110%) and when so, a reclaim datavolume 120 defragment is executed.

Should this not be a reclaim datavolume 110? What purpose could the check for a specific value have, when always a reclaim datavolume 120 is executed anyway?

Therefore the question, desired behaviour (in which case we will need to change the hardcoded 120 with our desired value) or a bug?

Thanks a lot!

Cheers.

Suggestion: Option to control Backup Type to be considered in retention calculation

is it possible to implement a option (e.g. -bt) to control the backup type to be considdered as "full backup" in retention calculation. Something like ...
-bt 0 (default) -> complete data backups and data snapshots are considdered as full backup
-bt 1 -> only complere data backups are selected
-bt 2 -> only snaps are selected

We are faced with the Situation that we have full VM backups with Veeam on a dayli basis. To insure Hana consistent backups the Hana is set to snapshot mode while the backup is done. But these snapshots are not valid for point in time DB revocery in a SAP supported way.

as workaround we edited the SQL in the skript to considder only complete data backups, but we want to go further with "offical hanacleaner" to be consitent for future updates and changes.

def sql_for_backup_id_for_min_retained_days(minRetainedDays): oldestDayForKeepingBackup = datetime.now() + timedelta(days = -int(minRetainedDays)) return "SELECT TOP 1 ENTRY_ID, SYS_START_TIME from sys.m_backup_catalog where ENTRY_TYPE_NAME = 'complete data backup' and STATE_NAME = 'successful' and SYS_START_TIME < '" + oldestDayForKeepingBackup.strftime('%Y-%m-%d')+" 00:00:00' order by SYS_START_TIME desc"

def sql_for_backup_id_for_min_retained_backups(minRetainedBackups): return "SELECT ENTRY_ID, SYS_START_TIME from (SELECT ENTRY_ID, SYS_START_TIME, ROW_NUMBER() OVER(ORDER BY SYS_START_TIME desc) as NUM from sys.m_backup_catalog where ENTRY_TYPE_NAME = 'complete data backup' and STATE_NAME = 'successful' order by SYS_START_TIME desc) as B where B.NUM = "+str(minRetainedBackups)

Regards Philipp

option "-dbs" does not work

Hi

In lines 1409 and 1495, it seems that the argument "-dbs " is not defined.

Could you have a look?

Thanks in advance!

hanacleaner.py in dos mode?

Hi,

I cannot use the script on linux/unix just as ./hanacleaner.py because the first line is in dos mode (additional CR):

/usr/bin/env: ‘python\r’: No such file or directory

It works fine if I convert the script with dos2unix utility.
Would you please consider storing the files with just LF as line feed?

Thank you!

Cleanup of Backup Catalog

Hi,

I tried to clean up Backup Catalog and I got the following error :
Please do not use -br true or -bo true if your backup catalog is larger than 100000 entries!

Why is there a limitation of the number of entries to delete ?
Is there a workaround ?

ERROR: Unexpted number output columns from df -h

When running the Python script with the command below

python hanacleaner.py -k HANACLEANER1KEY -tc 30 -te 30 -td tru

I'm getting the following error

Will now check most used memory in the file systems. If it hangs there is an issue with  df -h, then see if the -fs flag
 helps.
The most used filesystem is using 
Traceback (most recent call last):
  File "hanacleaner.py", line 1619, in <module>
    main()
  File "hanacleaner.py", line 1255, in main
    if max_filesystem_usage_in_percent(file_system, ignore_filesystems, logman) > 98:
  File "hanacleaner.py", line 560, in max_filesystem_usage_in_percent
    log("ERROR, Unexpted number output columns from df -h: \n", words)
  File "hanacleaner.py", line 250, in log
    if logmanager.print_to_std:
AttributeError: 'list' object has no attribute 'print_to_std'

This is on Red Hat Enterprise Linux Server release 6.7 (Santiago).

The error is caused by the output of df displaying entries in multiple lines instead of one per line. For example

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              49G   13G   34G  28% /
mpfs                  127G  8.0K  127G   1% /dev/shm
/dev/sda1             190M   69M  111M  39% /boot
/dev/mapper/vghanadata-lv_hana_data
                      768G  677G   91G  89% /sapmnt/data
/dev/mapper/vghanadata-lv_hana_shared
                      256G  159G   98G  62% /sapmnt/shared
/dev/mapper/vghanadata-lv_usr_sap
                       50G  4.8G   46G  10% /usr/sap
/dev/sdd1             258G  104G  155G  41% /sapmnt/log

To resolve this, add the -P option to the df command to output the information in POSIX format, meaning the output will instead look like

Filesystem                             Size  Used Avail Use% Mounted on
/dev/sda3                               49G   13G   34G  28% /
mpfs                                   127G  8.0K  127G   1% /dev/shm
/dev/sda1                              190M   69M  111M  39% /boot
/dev/mapper/vghanadata-lv_hana_data    768G  677G   91G  89% /sapmnt/data
/dev/mapper/vghanadata-lv_hana_shared  256G  159G   98G  62% /sapmnt/shared
/dev/mapper/vghanadata-lv_usr_sap       50G  4.8G   46G  10% /usr/sap
/dev/sdd1                              258G  104G  155G  41% /sapmnt/log

Error message after removal of fullsysteminfodumps

Hello,

after removal of fullsysteminfodumps a recheck of the numer of dumps is done in the following code line:
nbrDumpsAfter = int(run_command("ls "+path+"fullsysteminfodump* | wc -l").strip(' '))

This causes an error message after successfull removal of fullsysteminfodumps, for example:
ls: cannot access '///usr//sap//KRP//SYS//global//sapcontrol/snapshots/fullsysteminfodump*': No such file or directory

I suggest to change the code line to:
nbrDumpsAfter = int(run_command("ls "+path+"fullsysteminfodump* | wc -l", True).strip(' '))

Hana Cleaner with python 3

After upgrading to python 3 the hannacleaner.py is failing with the following error:

=== Custom script XXX called with parameters: XX XX XX
File ".../hanacleaner.py", line 319
print "Email Client: ", self.emailClient
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Email Client: ", self.emailClient)?
[ERROR]: Error while executing hanacleaner.py!

Suggestion on Backup Cleanup for TenantDBs

When using the backup (and catalog) clean up function, as we only got one account maintained in SystemDB with BACKUP ADMIN privilege, therefore with the current argument (-dbs) we are not able to perform the housekeeping for TenantDBs (as we don't have BACKUP ADMIN users in each TenantDB).
As HANA MDC allows SystemDB to manage the backup for TenantDBs, (SQL demo : backup catalog delete for all before BACKUP_ID <backup_id> [complete]), this might be considered for the above-mentioned scenario.

SyntaxError: Non-ASCII character '\xe2' in file hanacleaner.py on line 88, but no encoding declared

Command: python hanacleaner.py --help
Return following error message:
File "hanacleaner.py", line 88
SyntaxError: Non-ASCII character '\xe2' in file hanacleaner.py on line 90, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

This is due to wrong encoding/interpretation of apostrophes ... and is a fairly common error in mixed (linux/windows) environment and character/language setup.

In the hanacleaner.py script you find the first occurence in line 88:
print(" service is started: ALTER SYSTEM RECLAIM DATAVOLUME ':’ 120 DEFRAGMENT, default: -1 (not used) ")

Apostrophe (before ): ' This is a standard apostrophe
or apostrophe (after ): ’ This is a right single quotation mark, not a real apostrophe

I simply replaced the "single quotation mark" with a "standard apostrophe" to fix the issue.

Sometimes... such appearance of quotes is a result after using different editor's.
A similar issue is reported in issue: scipy/scipy#9606

Fix for character set:
cat hanacleaner.py | LC_ALL=C sed 's/'$'\342\200\231/\047/' > hanacleaner.py.fix

Check:
diff hanacleaner.py hanacleaner.py.fix
88c88
< print(" service is started: ALTER SYSTEM RECLAIM DATAVOLUME ':’ 120 DEFRAGMENT, default: -1 (not used) ")

print("         service is started: ALTER SYSTEM RECLAIM DATAVOLUME '<host>:<port>' 120 DEFRAGMENT,        default: -1 (not used)         ")

781c781
< gen = "TC.generation_type is NULL" # a generated column is typically a virtual column that doesn’t allocate space and so compression isn’t possible

    gen = "TC.generation_type is NULL" # a generated column is typically a virtual column that doesn't allocate space and so compression isn’t possible

803c803
< gen = "TC.generation_type is NULL" # a generated column is typically a virtual column that doesn’t allocate space and so compression isn’t possible

    gen = "TC.generation_type is NULL" # a generated column is typically a virtual column that doesn't allocate space and so compression isn’t possible

run issues when $hostname is not the same as /usr/sap/<SAPSID>/HD*/<servername>

this new part seems to be causing issues for an install having a virtual name...

host_line = [line for line in out_lines if local_host in line or local_host.upper() in line or local_host.lower() in line]  #have not tested this with virtual and -vlh yet
if len(host_line) != 1:
    print_out = "ERROR: Something went wrong. It found more than one (or none) host line" + " \n ".join(host_line)
    log(print_out, logman, True)
    os._exit(1)

in previous hanacleaner.py versions, using the physical name ($hostname) this same command is finishing:

python hanacleaner.py -k HANAKEY -tc 90 -tf 90 -td true -oi 0

however now we are getting an error, the only change we did was updating the hanacleaner.py on the same directory.

:/hana/shared/SC1/hanacleaner> python hanacleaner.py -k HDBCLEANTNT -tc 90 -tf 90 -td true -oi 0
Will now check most used memory in the file systems. If it hangs there is an issue with df -h, then see if the -fs flag helps.
The most used filesystem is using
83%


2022-06-08 14:50:01
hanacleaner as sc1adm by HANAKEY on SC1(10) with
hanacleaner.py -k HANAKEY -tc 90 -tf 90 -td true -oi 0
Cleanup Statements will be executed (-es is default true)
Before using HANACleaner read the disclaimer!
python hanacleaner.py --disclaimer


Online Check , 2022-06-08 14:50:01 , - , True , True , # index services: 1, # running services: 7 out of 7
Primary Check , 2022-06-08 14:50:03 , - , True , True ,
ERROR: Something went wrong. It found more than one (or none) host line

to workaround this, we have to update the custom scripts to use -vlh...

Running an error

Hi,

I cannot use the script on suse15.4 just as ./hanacleaner.py

db:/ # python3 hanacleaner.py --help
Traceback (most recent call last):
  File "hanacleaner.py", line 2300, in <module>
    main()
  File "hanacleaner.py", line 1472, in main
    SID = get_sid()
  File "hanacleaner.py", line 370, in get_sid
    SID = run_command('echo $SAPSYSTEMNAME').upper()
  File "hanacleaner.py", line 363, in run_command
    out = subprocess.run(cmd, shell=True, capture_output=True, text=True).stdout.strip("\n")
  File "/usr/lib64/python3.6/subprocess.py", line 423, in run
    with Popen(*popenargs, **kwargs) as process:
TypeError: __init__() got an unexpected keyword argument 'capture_output'
db:/ # python3 --version
Python 3.6.15

Issue with HANA System Replication (HSR)

We have HANA System Replication (HSR) between the two nodes sps91221 and sps92221 with virtual db name axq1db01.

echo $HOSTNAME
sps91221

hdbuserstore list:
KEY BKPSYSDB
ENV : axq1db01:35313
USER: BACKUP_ADMIN
DATABASE: SYSTEMDB

without vlh option error as expected:
ERROR, local host, sps91221 , should be one of the hosts specified for the key, BKPSYSDB (in case of virtual, please use -vlh, see --help for more info)

but with option -vlh axq1db01
SELECT * from DUMMY

  • 10: authentication failed SQLSTATE: 28000
    ERROR: Could not execute
    SELECT * from DUMMY
    USER ERROR: The user represented by the key BKPSYSDB cannot connect to the system. Make sure this user is properly saved in hdbuserstore.

hdbsql -U BKPSYSDB
hdbsql=> SELECT * from DUMMY;
1 row selected (overall time 2445.475 msec; server time 119 usec)

What is wrong?

When hdbuserstore ENV entry has IP address then HANA Cleaner fails when using -vlh flag.

Hello.

Running hanacleaner with "-vlh 127.0.0.1" if the hdbuserstore ENV entry has 127.0.0.1, then I get:

ERROR, local host, 127.0.0.1 , should be one of the hosts specified for the key, MYUSER (in case of virtual, please use -vlh, see --help for more info)

Looking at the code the determination of the variable "key_hosts" tries to trim off domain names, but this breaks IP addresses.
Maybe needs a check to see if the ENV key host string matches an IP address regex, before the FQDN trim is done.
I know that IP addresses are not ideal and a hostname (even localhost) is preferable, but 3rd party has setup the system this way. :-(

Thanks.

HANA CLEANER issue with -pe option

Hi,

I was trying to run hana cleaner with python script. I put an option to clear pending emails (pe) with value as 10. After the script run its gives error as below:

Traceback (most recent call last):
File "/hana/backup/Scripts/zsk-hanacleaner.py", line 2258, in
main()
File "/hana/backup/Scripts/zsk-hanacleaner.py", line 2181, in main
nCleaned = clean_pending_emails(pendingEmailsDays, sqlman, logman)
File "/hana/backup/Scripts/zsk-hanacleaner.py", line 1074, in clean_pending_emails
nbrEmailsBefore = int(run_command(sqlman.hdbsql_jAQaxU + " "SELECT COUNT(*) FROM _SYS_STATISTICS.STATISTICS_EMAIL_PROCESSING"").strip(' '))
ValueError: invalid literal for int() with base 10: ''

Please suggest to rectify the same.

Thanks
Arijit

Have issue with parameters -enc or -en

Hello, i have a issued with your new code, we don't have mail server but hanacleaner still force us to use that but we not understand because on document tutorial you attach is not yet inserted with newest version.

image

Issue with cleanup of backup catalog

Hello,

While running HANACLEANER to clean old backup catalog the script is giving error as below though the user has privilege BACKUP ADMIN. We have Azure backup service for our environment.

HANACleaner reports:

ERROR: Could not execute
BACKUP CATALOG DELETE ALL BEFORE BACKUP_ID 1670895013359 COMPLETE

ERROR: The user represented by the key HANACLEANER_SID_SYSTEMDB could not clean backup catalog.
One possible reason for this is insufficient privilege, e.g. lack of the system privilege BACKUP ADMIN.
If there is another error (i.e. not insufficient privilege) then please try to execute BACKUP CATALOG DELETE ALL BEFORE BACKUP_ID 1670895013359 COMPLETE in e.g. the SQL editor in SAP HANA Studio. If you get the same error then this has nothing to do with hanacleane

Did anyone faced this this issue?

Thanks
Arijit

SyntaxError with Python 3.7 and HANA 2.0 SP 6 version 63.

The following error is being generated:

File "hanacleaner.py", line 297
print "Reciever Email: ", self.recieverEmail, " Sender Email: ", self.senderEmail, " Mail Server: ", self.mailServer
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Reciever Email: ", self.recieverEmail, " Sender Email: ", self.senderEmail, " Mail Server: ", self.mailServer)?

Typo in line 334: receiverEmails

`class EmailSender:

def __init__(self, receiverEmails, emailClient, senderEmail, mailServer, SID):
    self.senderEmail = senderEmail
    self.emailClient = emailClient
    self.receiverEmails = receiverEmails
    self.mailServer = mailServer
    self.SID = SID
def printEmailSender(self):
    print("Email Client: ", self.emailClient)
    if self.senderEmail:
        print("Sender Email: ", self.senderEmail)
    else:
        print("Configured sender email will be used.")
    if self.mailServer:
        print("Mail Server: ", self.mailServer)
    else:
        print("Configured mail server will be used.")
    print("Reciever Emails: ", self.recieverEmails)`

Solution:
print("Receiver Emails: ", self.receiverEmails)

procedure to handle INFO events

Script execution cannot delete INFO type of events:

ERROR: Could not execute
ALTER SYSTEM SET EVENT HANDLED 'server:port' 1

ERROR: The user represented by the key HANACLEANERKEY could not delet events.
One possible reason for this is insufficient privilege,
e.g. lack of the privilege MONITOR ADMIN.
If there is another error (i.e. not insufficient privilege) then please try to execute
ALTER SYSTEM SET EVENT HANDLED 'server:port' 1
and
ALTER SYSTEM SET EVENT ACKNOWLEDGED 'server:port' 1
and
ALTER SYSTEM DELETE HANDLED EVENT 'server:port' 1

as per SAP note https://launchpad.support.sap.com/#/notes/0002253869
"The INFO state message cannot be handled with the command: ALTER SYSTEM SET EVENT HANDLED ':' "

So to handle INFO type of events, HANAcleaner should acknowledge and delete the event, without trying to set it as "handled", OR
at least try and execute the remaining two commands if first one fails.

Virtual table option -vn does not work: ValueError: invalid literal for int() with base 10:

The following execution leads to python value error:
python hanacleaner.py -vs true -vm 10 -vn 1000000 -vtt SIMPLE -vto SIMPLE -vnr 365 -k <userstore_key>

Traceback (most recent call last):
File "/hana/shared/hanacleaner/hanacleaner.py", line 2491, in
main()
File "/hana/shared/hanacleaner/hanacleaner.py", line 2431, in main
[nVTs, nVTsOptimized] = create_vt_statistics(vtSchemas, maxColumnsOfVT, defaultVTStatType, maxRowsForDefaultVT, largeVTStatType, otherDBVTStatType, ignore2ndMon, sqlman, logman)
File "/hana/shared/hanacleaner/hanacleaner.py", line 1304, in create_vt_statistics
statType = defaultVTStatType if getNbrRows(vt[0], vt[1], sqlman) <= maxRowsForDefaultVT else largeVTStatType
File "/hana/shared/hanacleaner/hanacleaner.py", line 1012, in getNbrRows
return int(run_command(sqlman.hdbsql_jAQaxU + " "SELECT COUNT(*) FROM "+schema+"."+table+" "").strip(' '))
ValueError: invalid literal for int() with base 10: ''

-oi = "0" breaks/aborts for single-db (Master checks)

Created a script running "python hanacleaner.py -k -dr 90 -po 0", previous version of hanacleaner.py works on HDB with active HSR and HDB w/o HSR active (Single-DB).

This current version terminates with error below due to master checks... oi = 0 should work as long as DB is identified as online.

hanacleaner-new.py -k -dr 90 -oi 0
Cleanup Statements will be executed (-es is default true)
Before using HANACleaner read the disclaimer!
python hanacleaner.py --disclaimer


Online Check , 2021-08-19 16:38:18 , - , True , True , # index services: 1, # running services: 9 out of 9
Primary Check , 2021-08-19 16:38:20 , - , True , True ,
Traceback (most recent call last):
File "/hanacleaner/hanacleaner-new.py", line 2133, in
main()
File "/hanacleaner/hanacleaner-new.py", line 1949, in main
while not online_and_master_tests(online_test_interval, local_dbinstance, local_host, logman): #will check if Online and if Primary and not Stand-By, and then if Master, but only if online_test_interval > -1
File "/hanacleaner/hanacleaner-new.py", line 384, in online_and_master_tests
return is_master(local_dbinstance, local_host, logman) #HANACleaner should only run on the Master Node
File "/hanacleaner/hanacleaner-new.py", line 394, in is_master
log("ERROR: Something went wrong. It found more than one (or none) host line: ", host_line)
File "/hanacleaner/hanacleaner-new.py", line 325, in log
if logmanager.print_to_std:
AttributeError: 'list' object has no attribute 'print_to_std'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.