Friday, April 11, 2025

How to reset System user password of Tenant DB and System DB

 Process to reset the system user password of the tenant:

1. Ensure that your tenant DB is offline. 

There are multiple ways to check it (HDB info, SELECT * FROM M_DATABASES; ==>Stastus active means running).

Process:

You need to run all the below commands from System DB

1. Login to system DB in HANA studio--> run the command ALTER SYSTEM STOP DATABASE <database_name>;

2. Go to SQL console of SYSTEM-DB and use command ALTER DATABASE <database_name> SYSTEM USER PASSWORD <new_password>; [Put your password in double quotes if you have special character in your password.]

3. Start the tenant database using command ALTER SYSTEM START DATABASE <database_name>;

4. It will ask you to change the password once you log in for the first time after resetting.

Process to reset System user password in System DB

 The system administrator can reset the password of any SYSTEM user if it has been irretrievably lost.

You must have the credentials of the operating system administrator (<sid>adm).

Shut down the instance by executing the following command:

/usr/sap/HDB/HDB<instance>/exe/sapcontrol -nr <instance> -function StopSystem HDB
or

HDB stop

Reset the system user: 

Now we will run the following commands to set the environment variables.

/usr/sap/<SID>/HDB<INSTANCE>/hdbenv.sh

Now we will start the name server with the option to reset the SYSTEM user password of SystemDB.

/usr/sap/<SID>/HDB<INSTANCE>/exe/hdbnameserver -reserUserSystem



Now the name server will be started; it will prompt you to enter password and stop the name server

You can start the HANA system with the following command.

          "HDB start" OR "sapcontrol -nr <instanceNumber> -function StartSystem HDB"

Tuesday, April 8, 2025

HANA Interview questions

What are the types of backup in HANA


1. Full Backup: Backs up the entire SAP HANA database (all data and metadata).
2. Differential Backup: Backs up the data changed since the last full backup.
3. Incremental Backup: Backs up the data changed from the last data backup (full or incremental).

  • How to check the version of Hana Database w/o logging in to SAP system and DB
  • a). You need to log in to the application server through Putty and switch to the sidadm user.

    Run the “R3trans -d” command. You will get the trans.log. Open that file, and you will get the version of the Hana database.

    or

    b). Another way is to check the work process log files from the work directory. Location—/usr/sap/SID/DVEBMGS00/work

    Check the work process log file with the name dev_w[n].

    General ways to check the HANA DB version

    • Log in to DB host through Putty and switch to the sidadm user. Run the command ‘HDB version.
    • Open the system in Studio and check the “Overview” page. There you will find the version.
    • sql query “select * from SYS.M_DATABASE_HISTORY”
    • Open the system in Sap Hana cockpit and go to applicatio“n General Information
    • Open the system from SAP Logon Pad and go to ‘System --> Status’; you will get the version.
    • Using python scripts available in directory (inside the DB server) ‘/usr/sap/SID/HDB<xx>/exe/python_support’ [you can reach to this directory using “cdpy.“] ==> Run the script ‘python systemOverview.py‘ using the sidadm user, and you will get the below output. It covers version along with other information-


    What are the ways to check the status of HANA Database

    Hana DB status can be checked using 

    • HDB info : This will provide you the status of all HDB services running in the system.
    • HDB proc: Same as HDB info, it provides the status of the services
    • sapcontrol -nr <instance##> -function GetProcessList
    • HANA Studio-->Landscape-->Services 
    • HANA cockpit


    How to install a HANA license if you are not able to connect using HANA Studio or HANA Cockpit.

    This is called lockdown mode, and there are few reasons behind this situation:

    • Your temporary license expires after installation.
    • The permanent license key is expired.
    • You manually deleted the license key.
    • Change in hardware key
    • Enforced license key has reached its limit and additional tolerance is exhausted

    In this case, only a user with the system privilege LICENSE ADMIN can connect to the database and execute license-related queries, such as obtaining previous license data or installing a new license key.
    While applying a fix, you must have the credentials of a SYSTEM user or any other user with the required privileges as stated above and a license key file generated from SMP handy.

    Solution: Log in to the database host with the sidadm user.

    Go to HDBSQL with the SYSTEM user. Once you are in HDBSQL, you will see message that *437: only commands for license handling are allowed in this current state SQLSTATE: HY000
    Switch ON multi line mode with command \mu ON

    Use the command SET SYSTEM LICENSE ‘<Copy paste your text from the license file>’ to install the license.
    You will return to the HDBSQL console without error, and your license will be renewed. If it does not come out to the HDBSQL console, then hit \g, and then it will come out of HDBSQL with output like 0 rows affected (overall time 20.486 msec; server time 18.529 msec).

    How to check if the installed HANA license is enforced or unenforced.

    We can check using an SQL query:  SELECT * FROM SYS.M_LICENSE. check the Enforced column (True or False)




    SAP HANA Architecture

     

    SAP HANA Directory Structure.



















    Thursday, April 3, 2025

    SAP HANA HA and DR

     SAP HANA HSR provides High Availability and Disaster recovery

    Fundamentals of HSR: 

    SAP HSR has two fundamental concepts

    1. HSR Replication Mode: Synchronous, Synchronous to memory, Asynchronous

    2. HSR Operation Modes: Delta shipping, Log replay or log replay with read access

    Replication Mode: 

    The HSR replication mode determines the behavior of secondary system in acquiring the data from the primary system

    1. Synchronous (SYNC)

    • The primary system waits for an acknowledgment from the secondary system before committing transactions.

    • Ensures no data loss.

    • Best for high-availability setups within low-latency environments.

    • Requires a reliable, high-speed network.

    2. Synchronous in-memory (SYNCMEM)

    • Ensures zero data loss but only guarantees that data is in the secondary system’s memory (not persisted to disk).

    • Faster than SYNC since it doesn’t wait for disk writes on the secondary system.

    • Suitable for systems with strict uptime requirements.

    3. Asynchronous (ASYNC)

    • The primary system does not wait for the secondary system to acknowledge the transaction.

    • Some data loss is possible in case of failure before replication completes.

    • Best for disaster recovery setups over long distances.

    4. Synchronous Full Sync (FULLSYNC) [Less Common]

    • Similar to SYNC but ensures the secondary system has fully committed the transaction before acknowledging.

    • Used in rare cases where absolute consistency is critical.

    Choosing the Right Mode

    • High availability within a data center?SYNC or SYNCMEM

    • Disaster recovery across regions?ASYNC

    • Extreme data consistency required?FULLSYNC

    Operation Mode:

    HSR Operation mode determines how the data is sent and processed by the secondary system


    1. Delta Data Shipping (operation_mode=delta_datashipping)
    This mode establishes a system replication where occasionally (per default every 10 minutes) a delta data shipping takes place in addition to the continuous log shipping. The shipped redo log is not replayed on the secondary site. The log is replayed only when a takeover (failover) occurs or when manually triggered.

    2. Continuous Log Replay (operation_mode=logreplay)
    This mode does not require a delta data shipping anymore. Additionally, the shipped redo log is continuously replayed on the secondary site.

    Log Replay Read Access
    The operation mode Log Replay Read Access is identical to the Log Replay mode with the exception that the secondary system is available in read only mode. This means that a SQL query can access (read) the data in the secondary, but the data can't be changed.


    Configure HANA Replication:

    Reference blog: 

    https://www.nexgen-tech.in/2019/01/hana-system-replication-hadr.html

    You can configure SAP HANA system replication by using the following tools:
        • SAP HANA cockpit
        • SAP HANA studio
        • `Hdbnsutil` (a command-line tool)

    Perform the following steps to configure replication by using SAP HANA studio:

    Step one: Enable system replication on the Primary

    1. Start the primary system.
    2. Perform an initial data backup or storage snapshot on the primary system.
    3. Enable system replication on the primary system by using the following steps in SAP HANA studio:
             a. In the Systems view, right-click the primary system and choose
                         Configuration and Monitoring -> Configure System Replication.


    sidadm password
    Provide logical name for primary system
    Finish.

    Step 2: Register the secondary System

      Stop the secondary system


    Register the secondary system:
     
    next

    Provide all the details such as : Logical Name, Replication mode, operation mode, primary system hostname and Instance number.

    Note: If you want to configure Active-Active Read, then you need to select the operation mode as Logreplay_readaccess. 

    Logreplay-readaccess operation mode is not supported in HANA Studio; you should use either the HANA cockpit or the HDBnsutil command-line tool. 

    Click on Finish
    With this HANA system replication setup completed successfully

    Once the secondary system restarts automatically, the replication will begin to start. 

    You can monitor the replication from Hana Studio-->Landscape-->System Replication.


    Step 3 : Takeover

    • You can trigger the takeover in the event of disaster or testing.
    • Register the former primary system as a new secondary system.

    Takeover:
      On secondary system --> config and monitoring--> system replication


    Click Finish to complete the takeover.



    Register the former primary as secondary: 

    Once the former primary comes back online, you need to register it as the secondary to the former secondary.

    1. Stop the former primary system
    2. Right click on the system ==>Configuration and monitoring ==> Configure Replication
    3. Register as secondary system
    4. Provide the details such as logical name, replication mode, operation mode, and primary host details.


    5.  Check the details you have provided in the below screen and click on Finish to complete the task.

    4. Disabling HANA Replication for Maintenance:

    1. Stop the secondary system
    2. Unregister secondary system from secondary system ==> Unregister secondary
    3. stop replication from primary system ==> Disable replication

    Saturday, March 29, 2025

    SAP HANA Installation

    SAP HANA INSTALLATION:

    HANA Database supports the below 2 operating systems. (Check supported versions in SAP PAM)

    • SUSE Linux Enterprise Server (SLES) 
    •  Red Hat Enterprise Linux (RHEL) 


    Build the server and make the primary file systems ready and mounted on the server

    • XFS (Recommended) for /hana/data, /hana/log, /hana/shared
    • NFS (Optional) for /hana/backup
    Have the below two users created.
    • sapadm (SAP Management User)
    • sidadm (SAP Instance Admin User)

    Download and extract the installation Media from SAP Support Portal



    SAP HANA

     HANA File Systems: Below are the major file systems used in HANA

    1. /hana/data
    2. /hana/log
    3. /hana/shared
    4. /usr/sap/
    5. /hana/backup

    FilesystemPurposeRecommended FS Type
    /hana/data/<SID>Stores HANA database tables & persistent dataXFS
    /hana/log/<SID>Stores redo logs for transaction recoveryXFS (SSD recommended)
    /hana/shared/<SID>Holds shared files, configurations & binariesXFS/NFS (multi-host)
    /usr/sap/<SID>Contains instance-specific binaries & logsXFS
    /hana/backupStores database backupsNFS

    E.g:


    All these file systems are to be saved in /etc/fstab so that they can be mounted in the server. using command : mount -a.





    SAP recommends having the primary HANA filesystem type as NFS:

    Command to check the filesystem: df -T /hana/data


    Recommendations:

    ✔️ Use XFS for /hana/data, /hana/log, /hana/shared for better performance
    ✔️ Use NFS for /hana/backup (if using shared storage)
    ✔️ Monitor disk usage regularly to avoid performance issues


    Advantages of XFS:
    ✔️ High performance for large databases
    ✔️ Supports snapshots and journaling
    ✔️ Ensures data consistency and integrity




    Friday, March 28, 2025

    SAP Basis Monitoring

     SM51: SAP servers

    Transaction code SM51 is to display a list of active application servers that have registered in the SAP message server. Further, you can manage & display the status, users, and work processes in all application servers belonging to the SAP System.


     SM66: Global Work Process

    SM66 is used to check the Active Work Process of all the instances. No, work process status should be in PRIVATE mode if it's then wp is consuming more memory.

     

    If any work process is in PRIV mode, go to SM51 and Check the server name, instance number, and contact the user if he is working in the system or not. If the user is not available Cancel the process without the core.

     

    SP01: Spool Request Selection

    In SP01 t-code we check the Spool Request data.

     

     Execute the report with the required date and if the requested data is more than 500 we will get a popup to select the entries.

     

    At the end of the page, we can find the following data for the spool request.

     

    SMGW: Gateway Monitor


    The Gateway Monitor (transaction SMGW) is used for analyzing and administrating the gateway in the SAP system. We check the number of Active gateway connections.


    SM37: Job Selection


    Transaction code SM37 is used to monitor the background, batch jobs running in the system. From the initial screen, you can search by the job name, user name, or program name accordingly with the time condition.


    Scheduled - Job already been defined, but the start condition has not yet been defined.

    Released - The job has been fully defined, including a start condition.

    Ready - The start condition of a released job has been met. A job scheduler has put the job in line to wait for an available background work process.

    Active - The job is currently running. Active jobs can no longer be modified or deleted.

    Finished - All steps that make up this job have completed successfully.

    Canceled - The job has terminated. This can happen in two ways:


    1. An administrator intentionally terminates the job

    2. A job step contains a program that produces an error, such as:

    3. An E or A error message in an ABAP program

    4. A failure return code from an external SAPXPG program


    SM12: Lock entries

    In SM12 we check the Lock entries. No lock entries should exist for more than 24hours. The number of lock entries should not exceed more than 500.


    Check the list.


    SM21: System logs

    Transaction code SM21 is used to check and analyze system logs for any critical log entries. The SAP System logs are all system errors, warnings, user locks due to failed login attempts from known users, and process messages in the system log.


    From the initial screen, go to System Log -> Choose -> All remote system logs. Set the date a day before and click on the Reread system log.

    In the system log analysis window, you can check/analyze the critical error message by double-clicking it.

    The list can be restricted for Problems Only, Problems, and all messages.

     

    SM13: Update Records

    Here we check the update records of the system which are getting canceled. If the records are reached more than 50 then we need to take action.


    ST22: ABAP dumps

    Transaction code ST22 is used to lists the ABAP dumps generated in the system, we can check for a date, user as required  


    Every dump indicates the reason for the error, transaction code, variables that caused the error. The types of error can be of various kinds for which action is to be taken to fix this error from happening again after analysis.


    SMQ1: qRFC Monitor (Outbound queue)

    We need to check if any outbound entries got stuck in the queue. If so check with the respective job owner and re-execute the entries.

     SMQ2: qRFC Monitor (Inbound queue)

    We need to check if any Inbound entries got stuck in the queue. If so check with the respective job owner and re-execute the entries.


    SM58: Transactional RFC

    In SM58 we can check the transactional RFC errors if any occurred.

    We can observe different types of errors for different functional modules check the target system entries and perform the required analysis if the user requires it then we can re-execute those entries or else we can delete the entries from the system. For example, we are deleting the WORKFLOW_LOCAL_100 Entries.

    Go to the log file -> Reorganize

    Enter the target system name in Destination box->And check the boxes as shown in the below screenshot-> Execute the program.

    We are supposed to delete only Connection errors, System error, and Already Executed.

    ST02: SAP Memory Configuration monitor


    SAP Memory Configuration monitor checks the SAP Buffers and SAP Memory areas for problems such as swapping.


    It is a snapshot of the utilization of SAP shared buffers.


    High watermarks of utilization for example extended, roll, paging, and heap memory can be obtained from the SAP memory configuration monitor.


    ST06: Memory Overview / Operating System Monitor


    The operating system provides the instance with the following resources:


    Virtual Memory

    Physical Memory

    CPU

    File system Administration

    Physical disk

    Network



    You can use the operating system monitor to monitor the system resources that the operating system provides. The operating system collector SAPOSCOL collects these resources.


    DB02: DBA Cockpit

    Transaction code DB02 is to analyze and monitor database statistics (DB growth, tablespace size, missing index &, etc.).

    1. Check Tablespace size. Go to Tablespaces -> Overview. If a tablespace size is reaching a 95% level, it’s advisable to increase the size. The Auto-extend should be Yes.


     

    SMLG: Load Distribution


    We need to check this tcode for performance issue, here we check the Response Time in load distribution of the Instance.


     


    Go to-> SMLG -> Load Distribution icon


     


    ST03N: Workload analysis


    The ST03 Workload Monitor is the central access point for analyzing performance problems in the SAP system. ST03N is a revised version of the transaction ST03. In the current SAP Releases transaction, ST03N replaces transaction ST03 and is automatically started when you enter transaction code ST03.


    Here you can compare the performance values for all instances, and compare the performance of particular instances over a period of time. Due to the number of possible analysis views for the data determined in transaction ST03, you can quickly determine the cause of performance problems.


    You can use the workload monitor to display the following, among other things:


    Number of instances configured for your system

    Number of users working on the different instances

    Response time distribution

    Distribution of workload by transaction steps, transactions, packages, sub-applications, and applications

    Transactions with the largest response times and database time

    Memory usage for each transaction or each user per dialog step

    Workload caused by RFC, broken down by transactions, function modules, and destinations

    Number and volume of spool requests

    Statistics about response time distribution, with or without the GUI time

    Optional: table accesses

    Workload and transactions used by users, broken down by users, accounting numbers, and clients

    Workload generated by requests from external systems




     




    STMS_IMPORT: Transport Request


    This tcode is used to import the transport requests to the system. But for daily monitoring purposes, we use it to check the import history.


    Go to-> STMS_IMPORT -> select the History Icon.


     

    SCC4: Clients Overview

    In SCC4 we check whether the client is open or closed.


    Go to -> SCC4 -> select the Production Client


    If the Changes and Transports for Client-Specific Objects are -> No Changes Allowed then Client is Closed. Other than that any option is selected then the client is Opened.


     


    Also, make sure Cross-Client Object Changes are set to No Changes to Repository and cross-client Customizing Objects.


    Printer issue: Device type import

     If you need a new device type in the sap system you need to login to the printer vendor site and download the device type

    --> import the device type in Dev system from spad tcode

    -->Capture the device type in a TR (using program in SE38)and move the TR to the subsequent systems

    Barcodes missing in device type:

    we can add barcodes for device types in SE73 Tcode and capture them in a TR and move to next system in the transport line.


    Friday, March 21, 2025

    Issus Faced

    Issues faced:

     During Java SPS upgrade:

    We do not have the java system added in maintenance planner/support portal. As a solution we have downloaded and ran SUM tool to generate system.info file and uploaded in marketplace and later generated the stack.xml file

    After launching the SUM, we got an error message: System Detect : solution added the hostname and IP address in etc/hosts file.

    During confirm target phase got en error saying that selected media during the creation of stack.xml file not available in the media directory

    . Major error During execution phase deploy java components phase not moved  for around 2 hours, after checking we found that connection to the server not working.


    The issue is the server not starting in safe mode. as suggested in the SAP note, we have removed the server from safe mode using CONFIGTOOL and started the server. Later executed SUM and started the upgrade successfully completed.

    Issue 2: SAP system connection using web-dispatcher was not working after the parameters upgrade.

    As part of SAP application maintenance, we have upgraded several security related parameters in ACL file in /usr/sap/global/acl_http_file.
    Solution: we have added the Ip address and hostnames of webdispather servers in the acl_http_file then it got resolved.





    HDBUSERSTORE COMMANDS FOR HANA

     HDBUSERSTORE COMMANDS:


    Set-up userstore for schema:

    hdbuserstore list:   this will show the list of saved user details in the userstore.

    Update the schema name and password at OS level

    hdbuserstore SET <keyname> <db_hostname>:3<nn>13@SID <schemaname> <password> 

    hdbuserstore set DEFAULT <sappmdb01>:31813@HDB SAPABAP1 password_123

    hdbuserstore set BACKUP_KEY <sappmdb01>:32213 <backup_user>  <password_123>

    login to SQL console at OS level:

    hdbsql -U <KeyName> : use this to login to sql console using the key from OS level

    hdbsql -u <user name> -p <password> -n <dbhostname>:3<##>13 : login to sql console(os level) by providing the user name and password 

    =======================================

    hdbnsutil -sr_unregister

    CREATE USER <user> PASSWORD <password> NO FORCE_FIRST_PASSWORD_CHANGE;


    sapcontrol -nr 00 -function StartService PS4
    ps -ef | grep sapstartsrv
    sapcontrol -nr 00 -function Start

    python systemReplicationStatus.py

    sapcontrol -nr <##> -function GetSystemInstanceList

    sapcontrol -nr <##> -function StartSystem

    sapcontrol -nr 00 -function GetProcessList


    Tuesday, June 11, 2024

    Issue: SAP Notes are not getting downloaded from SNOTE transaction.

    Issue: SAP Note are not getting downloaded from SNOTE transaction.

                   All the backbone RFC's are failing with certificate communication error

    Cause: certificate expiry messages is showing in saprout log in sap router

                SAP router certificate got expired which is causing the RFC connection error to SAP market place


    Resolution: Renew the SAP Router certificate by following the below blog

    https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/renewal-of-sap-router-certificate/ba-p/13416381

    (or)

    https://help.sap.com/docs/SUPPORT_CONTENT/basis/3354611206.html