community.sap_install icon indicating copy to clipboard operation
community.sap_install copied to clipboard

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

Open DominikDunst opened this issue 3 years ago • 12 comments
trafficstars

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.

DominikDunst avatar Sep 30 '22 10:09 DominikDunst

@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 to yes to 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)?

berndfinger avatar Sep 30 '22 11:09 berndfinger

@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'

DominikDunst avatar Sep 30 '22 11:09 DominikDunst

OK, thanks. Just a moment...

berndfinger avatar Sep 30 '22 11:09 berndfinger

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.

berndfinger avatar Sep 30 '22 11:09 berndfinger

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.

DominikDunst avatar Sep 30 '22 11:09 DominikDunst

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?

berndfinger avatar Sep 30 '22 11:09 berndfinger

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.

DominikDunst avatar Sep 30 '22 12:09 DominikDunst

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.

s11s11 avatar May 30 '23 15:05 s11s11

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.

berndfinger avatar Jun 20 '23 09:06 berndfinger

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.

fdanapfel avatar Jun 20 '23 14:06 fdanapfel

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.

mmoster avatar Jun 21 '23 07:06 mmoster

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).

sean-freeman avatar Jun 22 '23 11:06 sean-freeman