Thursday 18 May 2023

SAP HANA DB ANALYSIS AFTER ISSUES

To be able to further analyze your issue and environment please download the attached shell script you can get from KBA: 3218277 - Collecting HANA Support Data - Shell Script: HANASupportInfo

IMPORTANT:
Connect via shell as ROOT user to your HANA server. It must be a non-restricted root session!
- Single HANA Server setup: run "HANASupportInfo.sh -f".
- Replication setup: run "HANASupportInfo.sh -f" on your Primary, Secondary (and DR).
- Cluster setup: run "HANASupportInfo.sh -f" on all Cluster Nodes.
- Multi Node Setup: run "HANASupportInfo.sh -f" on one Master Node and "HANASupportInfo.sh" on the other Nodes.

It will collect basic information about your HANA Installation and Full System Info Dumps.
Upload the resulting ZIP file to this incident

Thursday 20 January 2022

Start and stop an SAP Central instance : WINDOWS / SQLSERVER

Hello,
Here is the second part of this SAP BC admin for beginners blog series: How to start/stop an SAP instance on WINDOWS/SQLServer

 Stop SAP & SQLServer
Connect to the operating system as sidadm,
  • Start the SAP Management console :
  • Stop the diagnostic agent ( DAA )
Right click on the instance and select stop  : Enter the requested passwordThis instance is made of a few processes and should stop within a few seconds.The diagnostic instance is then stopped.
  • Stop the SAP instance :
Right click on the instance and select stop :This is the SAP applicative instance. Here, Solution manager in this example.
It is made of ABAP and JAVA processes.
Stopping this SAP instance will take more time, up to a few minutes.You can check the ABAP processes shutdown here :You can check the JAVA processes shutdown here :The SAP instance is then fully stopped :
  • Stop the SQLServer database instance using SQL Server Management Studio as user sidadm :
The authentification to the database is done through the windows operating system authentification:Once connected, right click on the SID database and do the following choices:The database is then stopped.
  • You can stop the instance in order to perform a full stop :
The application and database are then stopped. You can stop the server now.

If you need to perform a full stop without rebooting in order to do a kernel upgrade for example, you can manually stop the following services :Right click each service and stop it :The services are now stopped. Everything related to SAP and its database is stopped.


We now deal with the SAP instance startup.

Connect to the server  as user sidadm and do as follows :
SAP services restart :SQLServer services restart :You can then use the SQL Server management Studio to restart the database :

Note : the database was previously brought offline. The sidadm user uses the SID database as its primary logon database.
This means you’ll have to logon to the database instance as user “sa” through SQL Server Authentification :Then you can bring the SID database online :The database is then up and running.
You can restart the SAP instances using the SAP MMC :Startup of the Diagnostics agent :This instance starts instantly.
We start the SAP SID instance :The SID instance startup can take up to several minutes, especially if you also have an J2ee instance running in case of a dual stack system.
Still you can check the instance startup here :
ABAP partJAVA part :Once everything is started correctly, everything should be green :The SAP instance is then fully started and can be used.

Thursday 13 January 2022

SAP HANA system Refresh

Homogeneous system copy, choose the Backup/Restore method. For a SQL Server-based ABAP system, for instance, you can make an online backup of your source database without having to shut down the #SAP system, which means there is no downtime of the source system involved. Copy the backup file to your target system, restore it to a new database there, then run SWPM/HANA Studio to complete the copy.

Most Recent State: Used for recovering the database to the time as close as possible to the current time. For this recovery the data backup and log backup have to be available since last data backup and log area are required to perform the above type recovery.

Point in Time: Used for recovering the database to the specific point in time. For this recovery the data backup and log backup have to be available since last data backup and log area are required to perform the above type recovery.

Specific Data Backup: Used for recovering the database to a specified data backup. Specific data backup is required for the above type of recovery option.
  • Specific Log Position: This recovery type is an advanced option that can be used in exceptional cases where a previous recovery failed.
Restrictions for Recovery
  • A #SAP HANA database cannot be recovered to a #SAP HANA database with a lower software version. The #SAP HANA database software version used for the recovery must always be the same version or higher than the #SAP HANA database used to create the backup.
  • There can be any number of hosts in the target system, provided that the number and type of services is identical in both the source and the target system.
  • With #SAP HANA multi-tenant database containers, recovery using snapshots is not supported yet. Tenant databases can be recoverd via the relevant system database only.
  • Note: if we are performing a recovery to different system - Target system and Source system must have the same configuration.IN Particular, the no.of DB services with their own persistence must be the same in both systems.

Prerequisites for Copying a Database Using Backup and Recovery:

The target database has sufficient disk space and memory.

  • The target system should have at least the same amount of disk space as the source system. You can copy a database to machines from different vendors and with different hardware configurations, provided that both the source and target machines are compliant with the #SAP HANA appliance specifications.
  • The target system can have any number of hosts, provided that the number and type of services is identical in both the source system and the target system.If desired, and if performance limitations are acceptable, a cloned database can be set up on a platform with less memory and CPU capacity and a different number of hosts.
  • The target database must have the same number and types of services as the source database.If the source system has 17 worker nodes with one indexserver process running on each node, a target system with one node needs 17 indexserver processes.
  • To change the number of indexserver processes in the target system (and the Backint settings, if you are using a third-party tool), a database user with the system privileges SERVICE ADMIN, INIFILE ADMIN, and BACKUP ADMIN is needed in the target system.
  • For an #SAP HANA single-container system, you set the number and type of services in the target database using SQL. For this reason, the target database must be online.vFor an #SAP HANA multitenant database container, the number and type of services in tenant databases is set automatically during recovery.

Note

  • For a database copy using storage snapshots, the number of hosts and the number and type of services assigned to each host must be the same for the source database and the target database, and the mountpoint IDs must be identical.
  • For an #SAP HANA single container system and the system database in an #SAP HANA multitenant database container, you must have the logon credentials of the operating system user (<sid>adm). For an #SAP HANA multitenant database container, you need the authorization DATABASE ADMIN.
  • Disable FULL SYNC Option Before Recovery
  • If you are running system replication with replication mode SYNC and the FULL SYNC option enabled, the system will not start after a recovery, because no write operations are possible. To prevent this from happening, before you perform a recovery, manually disable the FULL SYNC option in global.ini.
  • Take the backup of HANA PRD system
  • Copy/Move the backup form PRD Host to QAS Host
  • Ensure that QAS is having enough space for Backup.
  • Login to Hana Studio of QAS system with ID “SYSTEM”.
  • After Login to QAS system, go to Backup and recovery option
No alt text provided for this image

  • From there select recover system option. Once you select this option database will shut down to process recovery.
No alt text provided for this image

  • Once the system got shut down, recover screen will open. Kindly select the option based on your requirement. Since I am doing refresh from PRD to QAS with Data backup. I selected the Last option.
No alt text provided for this image

If you want to backup from the specific path where the data file is stored, select option “Specify backup without catalog”

No alt text provided for this image

  • Now provide the backup path and the same backup prefix name there in the “Backup Data file”

No alt text provided for this image


Provide the New license key path or you can skip this option and you can update license after recovery.
  • Make sure the backup file copied from the PRD system have proper permission of QAS system.
  • Once the recovery completed successfully, the database will start automatically. Make sure all services are running in HANA DB.
Please follow below steps at the application Server:
  • Modify the default key hdbuserstore on the application servers and the DB instance.
           Go to /usr/sap/<SID>/hdbclient  and execute the belowhdbuserstore set default <dbhost>:<dbport> <dbuser> <dbpassword>

  • Unlock the SAP<SID> and DBACOCKPIT ids in HANA DB.
  • Change the /dbs/hdb/schema parameter value to <Source schema value> in RZ10 DEFAULT.PFL
  • Try to check the R3tans –d in application server to establish a connection to the HANA DB, if the result is RC = 12. Analyse the trans.log file.

After changing all the things in Application server, start the SAP using cmd STARTSAP R3”.

  • Next install the license key for application server and HANA if not installed during recovery.
  • Once the #SAP system service started, kindly run the transaction to complete the post refresh activities SICK, SGEN, BDLS, RZ10, RZ12, SCOT, SOST do the changes.
  • Call transaction SECSTORE.
  • Choose “Execute” (F8).In the entries that are displayed, delete the entry /HMAC_INDEP/RFC_INTERNAL_TICKET_4_TRUSTED_SYSTEM if it is marked with a red traffic light.In the entries that are displayed, delete the entry /HMAC_INDEP/RFC_EXTERNAL_TICKET_4_TRUSTED_SYSTEM if it is marked with a red traffic light.
  • In transaction SE37, execute the function module RFC_PING with the destination NONE. If the system displays an error message, execute the function module RFC_PING again; the error message cannot appear a second time in this case.

DB Refresh of HANA Based systems using HANA Studio Backup/Recovery without SWPM

DB Refresh using HANA Studio DB Restore  with SID Modification –  NON SAPinst

HANA Studios DB restore option and hdbuserstore there after makes the whole process of a  System copy a lot simpler . The only limitation would be that the target schema would still remain as source.

The idea of this blog is to explain the process of performing  a simple homogeneous system copy of a HANA based system using the recovery of the source backup on the target HANA DB using HANA Studio.

In this case ,we will be  considering a situation of copying a Prod backup and refreshing it in a already running quality system

These are the salient steps involved in achieving this

Step 1 ) Take a complete DB backup of the source Database

Step 2) Move the database backup to the Target system

Step 3) Using HANA Studio recover the source db in the target HANA box

Step 4) Supply the license text so that the HANA Studio can automatically apply the license after install

Step 5) Modification of Schema access at the target DB

Step 6) Modify the default key  using the hdbuserstore on the application servers  and DB instance.

Step 7 ) Start sap

Step 8 ) Post activities.

Activities in the Source System :

Step 1 – Backup of the source DB .

Use the HANA studio backup studio to take a complete DB backup either at the disk level or using Backint.



image Courtesy : SAP HANA Backup/Recovery Overview by Andrea Kristen in SCN

Usually this should be sufficient to perform a DB Refresh but if you are looking for a  point in time recovery you may want the backups from the log area as well to include them post the recovery.

Step 2 ) : Move the database backup to the Target system

Once the backup is completed you will have to move the backup to a location in the target system , you should have 4 separate files with the your backup prefix . In this case the prefix is “COMPLETE_DATA_BACKUP_20122015”





Activities in the Target system

Step 3 ) Using HANA Studio recover the source db in the target HANA box

→ Shutdown SAP Application alone

→ Open HANA Studio and right click on the SID ( target) where you want to perform the recovery.

You will have to specify the destination location and the Backup Prefix for the HANA studio to recognize the backups .

If you just have a Complete data backup and not planning to recover log segments you can select the option “ Initialize Log area”… This is something like reset logs in oracle.

Step 4) Supply the license text so that the HANA Studio can automatically apply the license after install

  Post recovery your existing HANA License will be invalid , so here is a opportunity to mention the license text so that that can be installed automatically. If not this can be performed manually later.

Step 5 ) Proceed with the recovery . Please note that the Target and source version must have the same configuration. Is there are specific configuration thats required in the target system that can be done manually as part of the Post steps.

Post recovery you should be able to see the Overview tab in HANA Studio with the Memory and Host Details.

However you may expect to see all the schemas under Catalog but it will error out as below. Same would occur when you try to expand Content.

The reason being the new SID will probably be looking for a schema name as SAPSID and it cannot find it , so there are few changes that need to be done in the target system

Step 6) Modify the default key hdbuserstore on the application servers and the DB instance.

  • Go to /usr/sap/<SID>/hdbclient   and execute the below

hdbuserstore set default <dbhost>:<dbport> <dbuser> <dbpassword>

Let say for example our target host is : host01 and Source SID is  PRD and System No : 00  and lets assume that the source schema is SAPPRD and its password is sapprd#!

hdbuserstore set default host01:30015 SAPPRD sapprd#!


The above example is for the Unix system for Windows its a bit different (Refer SAP Note 1709838)


Execute a hdbuserstore list you should find the new Key set as below

KEY DEFAULT

   ENV:host01:30015

User: SAPPRD

This confirms that the key is set .

This has to be done on the appservers , else R3trans -d would fail.

Go back to HANA Studio and you should be able to see the contents under Catalog and Contents. You should also find the source Schema under Catalog.

At this point there is one more thing that needs to be done before we start the apps on the target system.

go to the DEFAULT profiles and modify the /dbs/hdb/schema to SAPPRD ( or whatever your source schema is ) .

At this point you are good to start SAP.

Follow the standard Post Refresh activities from there..

Few points to remember

– > You may want to disable the btc processes before starting SAP

→ Perform standard post steps like SE06/STMS/BDLS etc and activities specific to your case. 

SAP HANA DB ANALYSIS AFTER ISSUES

To be able to further analyze your issue and environment please download the attached shell script you can get from KBA: 3218277 - Collectin...