How to use SAP HANA to execute SQL commands at OS level

How to use SAP HANA to execute SQL commands at OS level

HDBSQL is a command line tool for executing commands on SAP HANA databases. SAP HANA HDBSQL is also used to automate the HANA Database backups using cron scripts.

Requirement:?You want to access SQL prompt using HDBSQL at OS level.

Prerequisites :?You need password of <SID>ADM user and?User with HANA database access, in our example we are connecting using SYSTEM.

  • Steps :Logon to HANA host with?<SID>adm?user.
  • Once you are logged in as <SID>adm?you can directly execute the?hdbsql?command , or you can go to following path and execute the hdbsql command.
  • cd?/hana/shared/<SID>/hdbclient
  • cd /usr/sap/<SID>HDBXX/exe/
  • Now execute the command
  • hdbsql?-n localhost -i 00 -u SYSTEM -p Ina123

No alt text provided for this image
example of Select SQL Statement using hdbsql


  • Once you get the command , enter?\s?to get the system information you are connected to.
  • In the above screenshot we execute SQL “Select * from Schemas
  • Exit HDBSQL by entering the command:?exit?or?quit?or?\q

?

You can also log on with user credentials for the secure user store (hdbuserstore) with -U <user_key>. Here is a separate document for?hdbuserstore?configuration.

HDBSQL Examples :

hdbsql?-n localhost -i 00 -u SYSTEM -p Ina123;

hdbsql -S DEV -n localhost:30015 -u SYSTEM -p In123 ;

hdbsql -n localhost -i 00 -u myuser -p myuserpassword “select * from sys.users”;

hdbsql -U myUserSecureStore “Select table_name, schema_name from m_tables” ;

要查看或添加评论,请登录

Mohamed ABDELMOULA的更多文章

  • The step-by-step guide to collect a server snapshot and analyze it with kernel

    The step-by-step guide to collect a server snapshot and analyze it with kernel

    Server snapshot (also known as kernel snapshot) is a feature available since SAP NetWeaver ABAP Kernel 740. It is…

    2 条评论
  • Memory Management in SAP Hana 2.0

    Memory Management in SAP Hana 2.0

    Memory Usage in the SAP HANA Database SAP HANA comprises of different processes that store the memory from the…

  • SAP HANA Cockpit

    SAP HANA Cockpit

    SAP HANA CockpitUse the Web-based administration tool SAP HANA cockpit for the administration, monitoring and…

    1 条评论

社区洞察

其他会员也浏览了