sap-linuxlab / community.sap_install

Automation for SAP - Collection of Ansible Roles for various SAP software installation
Apache License 2.0
52 stars 57 forks source link

sap_hana_install: Set log_mode to overwrite always executed for tenant-database, also if sap_hana_install_create_initial_tenant is set to n #213

Open DominikDunst opened 2 years ago

DominikDunst commented 2 years ago

If sap_hana_install_create_initial_tenant is set to n, the task "SAP HANA Post Install - Set log_mode to overwrite" (post_install/log_mode.yml) fails because the "ALTER SYSTEM ALTER CONFIGURATION"-Command for the tenant could not be executed. SQLSTATE: HY000\n* 488: invalid database name: xxx

Would be nice to have an option to skip the log-mode-change.

berndfinger commented 2 years ago

@DominikDunst I could not find a variable with the name sap_hana_install_create_initial_tenant in the current dev branch. Are you referring to the following variable (from defaults/main.yml)? # The first tenant database is using a port range not within the range of the ports of additional tenant databases. # In case this is not desired, you can set the following parameter toyesto recreate the initial tenant database. sap_hana_install_recreate_tenant_database: no

Are you using an older version of the role? In my tests when using default role variables, I never got the error you reported. If the above does not help, can you please post your role variables here (omitting any customer specific content like e.g. sap_hana_install_sid)?

DominikDunst commented 2 years ago

@berndfinger: I am reffering to variable "sap_hana_install_create_initial_tenant" from defaults/main.yml in the dev-branche.

# If the following variable is undefined or set to `y`, the role will create an initial tenant database.
# corresponding entry in the hdblcm configfile:
# create_initial_tenant, default: 'y'
sap_hana_install_create_initial_tenant: 'y'
berndfinger commented 2 years ago

OK, thanks. Just a moment...

berndfinger commented 2 years ago

OK, when using the defaults for sap_hana_install_create_initial_tenant, which is y, for installing a SAP HANA rev64 system on RHEL 8.4 on platform x86_64, I am not getting the error you reported. So I'd now like to check the role variables you are using and also the OS level and platform on which you are experiencing the symptom.

DominikDunst commented 2 years ago

we set sap_hana_install_create_initial_tenant=n because we use the HANA as MDC and create the tenants with the installation of the ABAP-Systems.

berndfinger commented 2 years ago

OK, sorry. You had mentioned that already. I will check and find a way to fix this.

Do you think we need a new variable for skipping the task SAP HANA Post Install - Set log_mode to overwrite", or should we just skip this task by default whenever sap_hana_install_create_initial_tenant is set to n?

DominikDunst commented 2 years ago

I think the overwrite mode should not be set for the tenant, if no tenant (sap_hana_install_create_initial_tenant=n) is created: ALTER SYSTEM ALTER CONFIGURATION('global.ini','DATABASE','{{ sap_hana_install_sid }}') SET ('persistence','log_mode') = 'overwrite' WITH RECONFIGURE;

and it would be nice, to have a new variable for skipping the task SAP HANA Post Install - Set log_mode to overwrite, so every user can decide if he wants override mode or not.

s11s11 commented 1 year ago

I just ran into this issue today, and found this open issue.

I think that users should have an option to skip setting the log_mode to overwrite. I personally never use overwrite mode, as I always configure backups for the HANA system after installing it.

Whether or not this setting will be added, the current version does run into an issue like @DominikDunst mentioned, when sap_hana_install_create_initial_tenant is set to n. It tries to set the log mode to for both the system DB and the initial tenant, which does not exist.

berndfinger commented 1 year ago

I think we should have a role variable to support not setting the log_mode to overwrite. For the time being, the same goal can be achieved by calling the role with --skip-tags sap_hana_install_set_log_mode. This tag is assigned to the task which sets the log_mode to overwrite and to the task which reports the result of the related hdbsql command. By skipping these tasks, the log_mode will be left to its default setting.

fdanapfel commented 1 year ago

The default for log_mode should actually be to set it to "normal", and setting it to "overwrite" should be optional, otherwise HANA system Replication will not work. See also SAP Note 3221437 - System replication is failed due to "Connection refused: Primary has to run in log mode normal for system replication!". log_mode = overwrite should only be used for test environments but never in production afaik.

mmoster commented 1 year ago

The primary database has to run with log_mode=normal. otherwise you can replicate but not failover. I would prefer to remove the task for sap_hana_install_set_log_mode. Then the default value is used. The default behavior of sap_hana_install should use log_mode=normal. If someone need log_mode=overwrite we should think about a day2 task.

sean-freeman commented 1 year ago

I agree with the analysis, it is an oversight. However I would strongly recommend that a variable remains that by default performs normal and by request performs overwrite etc.

For Sandbox installations (OneHost) to test latest SAP Software releases, overwrite is commonly used to control the cost (if Cloud) or capacity (if Hypervisor, particularly if using Thin Virtual Disks).