0% found this document useful (0 votes)
26 views78 pages

SAP HANA Database Explorer en ORIGINAL

The document provides a comprehensive guide to the SAP HANA Database Explorer, detailing its functionalities for querying databases, managing catalog objects, and analyzing performance. It includes sections on getting started, security, error diagnosis, querying, performance analysis, and data import/export. New features in the latest version include the ability to remove multiple databases, create virtual functions, and import/export data from external sources.

Uploaded by

fernando
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views78 pages

SAP HANA Database Explorer en ORIGINAL

The document provides a comprehensive guide to the SAP HANA Database Explorer, detailing its functionalities for querying databases, managing catalog objects, and analyzing performance. It includes sections on getting started, security, error diagnosis, querying, performance analysis, and data import/export. New features in the latest version include the ability to remove multiple databases, create virtual functions, and import/export data from external sources.

Uploaded by

fernando
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 78

PUBLIC

Document Version: 2.15.0 – 2022-09-26

SAP HANA Database Explorer


© 2022 SAP SE or an SAP affiliate company. All rights reserved.

THE BEST RUN


Content

1 Getting Started With the SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4


1.1 What's New in SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 Open Catalog Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Create URL Shortcuts to Database Objects in the SAP HANA Database Explorer. . . . . . . . . . . . . . . . .7
1.4 Search for Database Objects in the SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . .8
1.5 Add a Database to the SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.6 Remove Databases from the SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12
1.7 Add HDI Containers and Databases to the SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . 13
1.8 Remove Groups from the SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.9 Create Groups in the SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2 Security in the SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18


2.1 Data Protection in SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Delete Personal Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Delete Your Personal Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22
2.2 Securing the SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23
Secure the SAP HANA Database Explorer from Web Socket Attacks. . . . . . . . . . . . . . . . . . . . . . 24

3 Analyzing and Diagnosing Errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26


3.1 Set Session Logging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.2 View SQLScript Code Coverage Report. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.3 View Database Procedures in the SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Debug Procedures in the SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.4 SAP HANA Database Explorer Debugger Tutorials. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Tutorial: Connecting the Debugger. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Tutorial: Debugging a Procedure by Setting Breakpoints. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Tutorial: Debugging a Function by Setting Breakpoints. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Tutorial: Debugging an Anonymous Block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Tutorial: Debugging a SQLScript Library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35
Tutorial: Working With Expressions in the Debugger. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Tutorial: Working with Variables in the Debugger. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Tutorial: Working With Watchpoints in the Debugger. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Tutorial: Quitting the Debugging Session. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

4 Querying the Database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40


4.1 Execute SQL Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.2 Execute Parameterized Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.3 Run a Query as a Background Activity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44

SAP HANA Database Explorer


2 PUBLIC Content
4.4 Use the Statement Library to Administer Your Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.5 Work With Graph Workspaces in SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

5 Analyzing Performance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
5.1 Configure Tracing in the SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50
5.2 View Diagnostic Files in the SAP HANA Database Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51
Viewing the Trace File List. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
View Diagnosis Files of an Unavailable Tenant Database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
5.3 Traces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
5.4 Analyze Procedure and Function Performance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
5.5 View Execution Plans for SQL Statements, Procedures, and Anonymous Blocks. . . . . . . . . . . . . . . . 55

6 Importing, Exporting, and Accessing Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56


6.1 Create a Remote Source. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.2 Edit a Remote Source. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
6.3 Create Virtual Objects (Smart Data Access). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
6.4 Create Virtual Objects (SAP HANA Smart Data Integration). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
6.5 Import Schemas, Tables, and Other Catalog Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61
6.6 Import Data Into a New or Existing Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
6.7 Import HDI Containers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.8 Export Schemas, Tables, and Other Catalog Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.9 Export Data Into a File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.10 Export HDI Containers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72
6.11 Deleting Tables and Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

7 Important Disclaimer for Features in SAP HANA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

SAP HANA Database Explorer


Content PUBLIC 3
1 Getting Started With the SAP HANA
Database Explorer

Use the SAP HANA database explorer to query information about the database, as well as view information
about your database's catalog objects.

The database explorer is integrated into both the SAP Web IDE for SAP HANA and in the SAP HANA cockpit.
The database explorer contains features and functions required by both database administrators and
developers.

What can I do with the SAP HANA database explorer?

The SAP HANA database explorer allows you to query your database and view information about your catalog
objects, by providing the following functionality:

A catalog browser View the definitions of all types of catalog objects, for example: tables, views, stored
procedures, functions, and synonyms. Also, view the content (data) of your tables and
views.

An SQL console Create SQLScript procedures and queries, and then execute them or analyze their
performance using the SQL analyzer.

An SQL analyzer View detailed information on your queries and evaluate potential bottlenecks and
optimizations for these queries. The SQL analyzer is accessible from the SQL console, as
well as from the plan trace and expensive statement features in the SAP HANA cockpit.

An SQL debugger View the call stack, set break points, view and evaluate expressions and variables.

Related Information

SAP Note 2373065

SAP HANA Database Explorer


4 PUBLIC Getting Started With the SAP HANA Database Explorer
1.1 What's New in SAP HANA Database Explorer

The following features are new or changed for this release of SAP HANA database explorer.

Administration

Remove Multiple You can now remove multiple databases simultaneously by clicking the  icon above
Databases (New) the catalog browser on the left of the screen.

Remove Databases from the SAP HANA Database Explorer

Create Virtual Functions The remote source editor can now create virtual functions for Smart Data Access
(New) (SDA) remote sources.

Create Virtual Objects (Smart Data Access)

Removing Data from When deleting a table, you now have the option of truncating the table. Truncating
Tables (New) allows you to remove all the content from your table but leaves the table structure,
indexes, and privileges intact.
Deleting Tables and Data

Importing Data from and You can now import data from and export data to external sources such as
Exporting Data to External Amazon S3, Azure Storage, Alibaba Cloud OSS, and Google Cloud Storage.
Sources (New)
Import Data Into a New or Existing Table, Export Data Into a File

Import ESRI Shapefiles from You can now import ESRI shapefiles from the following external sources:
External Sources (Changed)
• Amazon S3
• Azure Storage
• Alibaba Cloud OSS
• Google Cloud Storage

Import Data Into a New or Existing Table

Visualizing You are now able to visualize spatial data in the SAP HANA database explorer.
Spatial Data
(New) To visualize spatial data, in the table editor, right-click on a column of type ST_Geometry
that contains an extended well-known binary value and choose View data to show the
spatial data on a blank canvas.
Spatial Data

Monitoring

Download SQL Results for In the Background Activities Monitor, you can now download the SQL results for
Background Activities
one or multiple queries by clicking the  (Download SQL Results for Selected
(New)
Row(s)) icon.
Run a Query as a Background Activity

SAP HANA Database Explorer


Getting Started With the SAP HANA Database Explorer PUBLIC 5
Filter Selection in Data When previewing data for catalog objects, such as tables and views, you are now able
Preview (Changed) define potential filters using drag and drop. You also now have the option to right-click
on your desired column(s) and click Add to Filters.

Last Modified In the Statement Library dialog, you can now see when a statement was last modified.
Column in When you add to the statement library from the SQL console or import from a file, a
Statement Library timestamp for the corresponding statement is displayed under Last Modified. For
(New) SYSTEM statements, the value in the Last Modified column is N/A.
Use the Statement Library to Administer Your Database

Security

Enable Single Sign-On SSO authentication can now be enabled when adding a new SAP HANA database in
(SSO) (New) the SAP HANA database explorer.
Add a Database to the SAP HANA Database Explorer

User and Database Group Management

Show User Details


You can now see which user is logged in by clicking the  (Show user login
(New)
information) icon.

Removing Groups Groups in the SAP HANA database explorer no longer need to be empty in order for you
(Changed) to remove them.
Remove Groups from the SAP HANA Database Explorer

1.2 Open Catalog Objects

Browse your database's catalog using the SAP HANA database explorer.

Prerequisites

You must be a user of the database that you want to explore and you must have the required privileges to view
the catalog items.

Context

Some monitoring and problem analysis may require you to examine individual tables and views, for example,
system views provided by the SAP HANA database. Use the catalog browser, which is located in the left pane,
to find and open these catalog objects.

SAP HANA Database Explorer


6 PUBLIC Getting Started With the SAP HANA Database Explorer
Procedure

1. In the catalog browser, choose the database that you want to explore.

If your database is not listed in the catalog browser, then click Add a database to the Database Explorer
( ) to add the database.

The catalog browser lists the catalog objects, grouped by schema.


2. Choose an object type to view its objects.

For example, choose Tables to list the tables in the database.


3. Choose an object to view its definition in an editor in the right pane, or right-click the object to choose a
different action.

For example, right-click a table and choose Open Data to view the table's data.

Related Information

Add a Database to the SAP HANA Database Explorer [page 9]


Add HDI Containers and Databases to the SAP HANA Database Explorer [page 13]
View Database Procedures in the SAP HANA Database Explorer [page 28]

1.3 Create URL Shortcuts to Database Objects in the SAP


HANA Database Explorer

Use the SAP HANA database explorer to create a URL shortcut, and then use it to create a bookmark or
favorite in your browser.

Procedure

1. In the catalog browser, right-click a database object and choose Create Shortcut.
2. Click Copy URL to copy the shortcut to your clipboard.
3. Paste the URL into your browser.
4. Use your browser to create a bookmark or favorite for the copied URL.

Results

The shortcut is created. Use it to open the database explorer and quickly navigate to the database object.

SAP HANA Database Explorer


Getting Started With the SAP HANA Database Explorer PUBLIC 7
Related Information

Search for Database Objects in the SAP HANA Database Explorer [page 8]

1.4 Search for Database Objects in the SAP HANA


Database Explorer

Search for database objects across all databases that the SAP HANA database explorer is connected to.

Prerequisites

In the database explorer, connect to each database that you want to search.

Context

Use the catalog browser to find your object when you know the type of object and the database that it exists in.

If you are unsure of the object type or the database that it exists in, then use the database object search. This
search looks for matches in either a specified database or all of the connected databases in the database
explorer and it can search across more than one object type. For example, use this search to find all tables and
procedures that contain the word production in their names.

Procedure

From the right sidebar of the database explorer, click Object Search ( ).
a. Specify a search term that is longer than one character.

Specify * to return all results.


b. Optionally, restrict your search to a specific database.
c. Target your search to specific object types by selecting them at the bottom of the pane.

Results

The search results appear in the Search for Database Objects pane.

SAP HANA Database Explorer


8 PUBLIC Getting Started With the SAP HANA Database Explorer
Related Information

Create URL Shortcuts to Database Objects in the SAP HANA Database Explorer [page 7]
Open Catalog Objects [page 6]

1.5 Add a Database to the SAP HANA Database Explorer

Add a database to the SAP HANA database explorer so that you can browse its catalog and execute SQL
statements against it.

Context

Adding a database to the database explorer is similar to registering a database in the cockpit. Once a database
is added, it is listed in the catalog browser pane on the left.

You cannot add a database to the database explorer that uses LDAP authentication.

Procedure

1. Open the database explorer from the SAP HANA cockpit.


2. Add a database by clicking the Add a Database to the Database Explorer icon ( ) at the top of the catalog
browser pane on the left.
3. From the Database Type dropdown list, choose the type of database to add:

Database Type Action

Add a database 1. Choose Cockpit Database.


that has been
2. Choose a resource from the list.
registered in the
cockpit 3. Choose to either use the credentials supplied in the cockpit, or to enter a different user name
or password.

An SAP HANA 1. Choose SAP HANA database.

database 2. Specify the fully qualified domain name (FQDN) of the host on which the system is installed.
Specify the instance number or port of the database you are adding.
When adding a database that is part of a multi-host system, specify the master host.
You do not have to enter all host names explicitly as they are determined automatically. If the
master host becomes unavailable, then the connection is automatically established through
one of the other hosts. Hosts that are added to the system later are also detected automati­
cally.
3. (Optional) Select Authenticate using single sign-on

SAP HANA Database Explorer


Getting Started With the SAP HANA Database Explorer PUBLIC 9
Database Type Action

This will allow you to connect using your single sign-on (SSO) token and eliminate the need to
specify your login information.

A tenant or the 1. Choose SAP HANA database (Multitenant).


system database
2. Specify the host and instance number or port of the system database.
that is part of a
multitenant data­ 3. (Optional) Select Authenticate using single sign-on
base container This will allow you to connect using your single sign-on (SSO) token and eliminate the need to
system
specify your login information.
4. Specify whether you are adding the system database or a tenant database. If you are adding a
tenant database, then specify the name of the tenant database.

4. (Optional) If you are adding an SAP HANA database, a tenant database, or a system database that is part
of a multi-tenant database container system, then specify encryption information and advanced
connection properties as required.

Choose from the following encryption options:

Option Description

Save user and password (stored in the SAP HANA secure By default, your database credentials are not saved. Each
store.) time you need to connect to an added database, you must
provide your user credentials.

Choose this option to save these user credentials so that


you do not have to re-enter them each time you connect.
These credentials are saved to the SAP HANA secure
store.

 Note
If you have selected Authenticate single sign-on, this
option is disabled.

Connect to the database securely using TLS/SSL. Choose this option to encrypt communication between
(Prevents data eavesdropping.) the database explorer and the SAP HANA database using
the Transport Security Layer (TLS)/Secure Sockets Layer
(SSL) protocol.

SAP HANA Database Explorer


10 PUBLIC Getting Started With the SAP HANA Database Explorer
Option Description

Verify the server's certificate using the trusted certificate Choose the Verify the server's certificate using the trusted
below. certificate below option and provide a trusted certificate, if
you want to verify the server's certificate when connect­
ing. This prevents server impersonation. The certificate
field must contain the contents of a certificate, and not a
file name. For more information, see the SAP HANA Secur­
ity Guide.

 Note
You can only choose this option if you have also
chosen the Connect to the database securely using
TLS/SSL. (Prevents data eavesdropping.) option.

Choose from the following advanced options.

In the Advanced Options field, specify the advanced options as semi-colon-separated name=value pairs.
For example: locale=en-US, isolationLevel=READ COMMITTED.

Option Description

isolationLevel The isolation level for the connection. The supported val­
ues are: READ COMMITTED, REPEATABLE READ, and SE­
RIALIZABLE. The default is to specify no isolation level.

locale The locale to use for the connection. If you do not set this
option, then the database explorer looks for a locale set­
ting in your user parameter, and then in your browser. If no
locale setting is found, then the locale is set to en-US.

schema The name of the schema that you want to use

CLIENT Sets the session client for the connection. The value is a
three character string. For example, CLIENT=100.

5. (Optional) Choose a display name that is used to identify your database in the database explorer. Each
database must have a unique display name. If you do not choose a display name, then one is generated for
you.
6. Click OK.

Results

The database is added to the database browser.

SAP HANA Database Explorer


Getting Started With the SAP HANA Database Explorer PUBLIC 11
Next Steps

After adding a cockpit database, you can always go back and re-add the database with different user
credentials. Just right-click the cockpit database and click Add Database with Different User.

Related Information

Securing the SAP HANA Database Explorer [page 23]


Open Catalog Objects [page 6]
Execute SQL Statements [page 41]

1.6 Remove Databases from the SAP HANA Database


Explorer

Remove databases from the SAP HANA database explorer if they are no longer required.

Procedure

1. Click on the  (Open the remove databases dialog) icon.


2. Select the databases you want to remove. You can filter for specific databases using the Filter Databases
filter bar.
3. Once you have selected the databases that you want to remove, click the Remove button.

Results

When a database is removed, editors for objects contained by the database are closed automatically, and
consoles are disconnected.

Related Information

Add a Database to the SAP HANA Database Explorer [page 9]

SAP HANA Database Explorer


12 PUBLIC Getting Started With the SAP HANA Database Explorer
1.7 Add HDI Containers and Databases to the SAP HANA
Database Explorer

Add a built HDI container to the SAP HANA database explorer in the SAP Web IDE for SAP HANA , so that you
can browse its catalog objects and test its procedures and functions.

Prerequisites

The HDI container must be configured on the same XS advanced server that the SAP Web IDE is running on.

To add an SAP HANA database to the database explorer, you must have a user ID and a password for that
database.

You must be a space developer of the space that the HDI container is deployed in.

You must be a user of the SAP Web IDE for SAP HANA.

Context

Once an HDI container or database is added to the database explorer, it is listed in the catalog browser pane on
the left.

You cannot add a database to the database explorer that uses LDAP authentication.

Procedure

1. Open the database explorer from the SAP Web IDE by choosing Tools Database Explorer .
2. Add a database by clicking the Add a database to the Database Explorer icon ( ) from the catalog browser
toolbar.
3. From the Database Type dropdown list, choose the type of database to add:

Database Type Action

1. Choose HDI container.


An HDI container
2. Choose an HDI container from the list. The list contains all HDI containers used by the
SAP Web IDE and the database explorer as well as all user-defined HDI containers.
3. Set the XS_APPLICATIONUSER session variable to make the connection personalized for
the current user.

1. Choose SAP HANA database.


An SAP HANA data­
base

SAP HANA Database Explorer


Getting Started With the SAP HANA Database Explorer PUBLIC 13
Database Type Action

2. Specify the fully qualified domain name (FQDN) of the host on which the system is instal­
led. Specify the instance number or port of the database you are adding.
When adding a database that is part of a multi-host system, specify the master host.
You do not have to enter all host names explicitly as they are determined automatically. If
the master host becomes unavailable, then the connection is automatically established
through one of the other hosts. Hosts that are added to the system later are also detected
automatically.

A tenant or the sys­ 1. Choose SAP HANA database (Multitenant).


tem database that is
2. Specify the host and instance number or port of the system database.
part of a multitenant
database container 3. Specify whether you are adding the system database or a tenant database. When adding
system a tenant database, specify the name of the tenant database.

HDI containers con­ 1. Choose Application Managed Service Instances.

tained in instance 2. Specify the instance manager that contains the HDI container you want to add.
managers 3. Choose an HDI container from the list. The list contains all HDI containers used by the
SAP Web IDE and the database explorer as well as all user-defined HDI containers.
4. Set the XS_APPLICATIONUSER session variable to make the connection personalized for
the current user.

4. (Optional) Specify advanced connection properties as required.

Choose from the following encryption options:

Option Description

Save user and password (stored in the SAP HANA secure By default, your database credentials are not saved. Each
store) time you need to connect to an added database, you must
provide your user credentials.

Choose this option to save these user credentials so that


you do not have to re-enter them each time you connect.
These credentials are saved to the SAP HANA secure
store.

Connect to the database securely using TLS/SSL. Choose this option to encrypt communication between
(Prevents data eavesdropping.) the database explorer and the SAP HANA database using
the Transport Security Layer (TLS)/Secure Sockets Layer
(SSL) protocol.

SAP HANA Database Explorer


14 PUBLIC Getting Started With the SAP HANA Database Explorer
Option Description

Verify the server's certificate using the trusted certificate Choose the Verify the server's certificate using the trusted
below. certificate below option and provide a trusted certificate, if
you want to verify the server's certificate when connect­
ing. This prevents server impersonation. The certificate
field must contain the contents of a certificate, and not a
file name. For more information, see the SAP HANA Secur­
ity Guide.

 Note
You can only choose this option if you have also
chosen the Connect to the database securely using
TLS/SSL. (Prevents data eavesdropping.) option.

In the Advanced Options field, specify the advanced options as a semi-colon-separated, option-
name=value pair. For example: locale=en-US, isolationLevel=READ COMMITTED.

Option Description

isolationLevel The isolation level for the connection. The supported val­
ues are: READ COMMITTED, REPEATABLE READ, and SE­
RIALIZABLE. The default is to specify no isolation level.

locale The locale to use for the connection. If you do not set this
option, then the database explorer looks for a locale set­
ting in your user parameter, and then in your browser. If no
locale setting is found, then the locale is set to en-US.

schema The name of the schema that you want to use

CLIENT Sets the session client for the connection. The value is a
three character string. For example, CLIENT=100.

5. Click OK.

Results

The HDI container or database is added to the database browser.

By default, you are connected to the HDI container as the technical user.

Related Information

Open Catalog Objects [page 6]

SAP HANA Database Explorer


Getting Started With the SAP HANA Database Explorer PUBLIC 15
1.8 Remove Groups from the SAP HANA Database Explorer

Remove a group from the SAP HANA database explorer if you no longer require it.

Context

A group or subgroup doesn't have to be empty to remove it. If the group has subgroups or connections (for
example, database connections or file container connections), when you delete the group, you are given the
option to move the connections to the parent of the selected group or to remove the connections when
removing the group.

Procedure

1. Right-click the group or subgroup to be removed and click Remove Group.


2. Click one of the following:

• If the group contains no connections, click Remove Group.


• If the group contains connections, then a message appears indicating the number of connections in
the selected group and subgroups. To move the connections to the parent of the group, click Move
Connections. To remove the connections along with the group, click Remove All.

Results

Your group will be removed from the SAP HANA database explorer. If your group had connections and you
chose to move them, they can be found in the removed group's parent.

Related Information

Create Groups in the SAP HANA Database Explorer


Remove Databases from the SAP HANA Database Explorer

SAP HANA Database Explorer


16 PUBLIC Getting Started With the SAP HANA Database Explorer
1.9 Create Groups in the SAP HANA Database Explorer

Organize your databases in SAP HANA database explorer by creating groups.

Procedure

1. Choose whether to create a regular group or a nested group in the catalog browser.
• To create a regular group in the catalog browser, click the Add a group to the Database Explorer icon in
the catalog browser toolbar on the top left.
• To create a nested group, right-click on an existing group in the catalog browser and click Add Group.
2. When the New Group pop-up dialog appears, enter a unique Group Name.
3. Click Create.

Results

The group is created.

Next Steps

Add a database to the new group, or add a subgroup. You can move an existing group to a new parent group by
dragging and dropping the existing group onto a different folder.

You can also rename a group or remove a group. To rename a group, right-click on the desired group and click
Rename Group. Enter a new name for the group and click Save.

SAP HANA Database Explorer


Getting Started With the SAP HANA Database Explorer PUBLIC 17
2 Security in the SAP HANA Database
Explorer

The database explorer supplies secure authentication, authorization, and connections and provides a simple
method to delete personal information as needed.

2.1 Data Protection in SAP HANA Database Explorer

Data protection is associated with numerous legal requirements and privacy concerns. In addition to
compliance with general data privacy regulation, it is necessary to consider compliance with industry-specific
legislation in different countries. SAP provides specific features and functions to support compliance with
regards to relevant legal requirements, including data protection. SAP does not give any advice on whether
these features and functions are the best method to support company, industry, regional, or country-specific
requirements. Furthermore, this information does not give any advice or recommendation in regards to
additional features that would be required in particular IT environments; decisions related to data protection
must be made on a case-by-case basis, under consideration of the given system landscape and the applicable
legal requirements.

 Note

In the majority of cases, compliance with applicable data protection and privacy laws will not be covered by
a product feature. SAP software supports data protection compliance by providing security features and
specific data protection-relevant functions, such as simplified blocking and deletion of personal data. SAP
does not provide legal advice in any form. Definitions and other terms used in this document are not taken
from any given legal source.

Glossary

Term Definition

Consent The action of the data subject confirming that the usage of his or her personal
data shall be allowed for a given purpose. A consent functionality allows the stor­
age of a consent record in relation to a specific purpose and shows if a data sub­
ject has granted, withdrawn, or denied consent.

Deletion The irreversible destruction of personal data.

SAP HANA Database Explorer


18 PUBLIC Security in the SAP HANA Database Explorer
Term Definition

Personal data Any information relating to an identified or identifiable natural person ("data sub­
ject"). An identifiable natural person is one who can be identified, directly or indi­
rectly, in particular by reference to an identifier such as a name, an identification
number, location data, an online identifier or to one or more factors specific to the
physical, physiological, genetic, mental, economic, cultural, or social identity of
that natural person.

Purpose A legal, contractual, or in other form justified reason for the processing of per­
sonal data. The assumption is that any purpose has an end that is usually already
defined when the purpose starts.

Collection of Personal Data

SAP HANA database explorer stores only personal data entered by users; it never collects personal data
without a user's knowledge. The only personal information stored by the SAP HANA database explorer consists
of the following:

XSA user The XSA user ID is received from the XSA or Cloud Foundry login page and is recorded in both the
ID SAP HANA database explorer and in log files. The following information associated with the user ID
is also stored in the SAP HANA database explorer:

User-Defined SQL Statements User-defined SQL statements are associated with a specific
user and may contain personal data.

Long-Running SQL Queries These queries are associated with a specific user and may
contain personal data.

User ID for Cloud Foundry This ID is retained only until WebIDE is restarted or upgraded.
Login When Connecting to the
Database Explorer from
WebIDE

Database Credentials User credentials associated with a specific user for HANA
databases are stored in the SAP HANA database explorer.

User Preferences These preferences are associated with a specific user and are
stored in the SAP HANA database explorer.

Logging SAP HANA database explorer collects XSA logs (when running on premise), Cloud Foundry logs
(when running on SCP), and audit logs. Audit logs can track read access and changes and may
contain user-specific data.XSA logs are retained indefinitely by XSA. For more information about
XSA logging, see the SAP HANA Developer Guide for XS Advanced Model. Cloud Foundry logs are
retained for one week. Audit logs cannot be deleted.

By default, logging is set to an application-wide level that does not record any personal data.
However, you can set logging to session level, which collects all SQL statements for the current
session. These statements may contain personal data.

SAP HANA Database Explorer


Security in the SAP HANA Database Explorer PUBLIC 19
2.1.1 Delete Personal Data

Delete user-specific information that is stored by the SAP HANA database explorer.

Context

This procedure deletes the following personal data that is associated with the specified user ID:

• All database credentials


• All user-defined SQL statements
• All user preferences
• All background tasks
• All content in open SQL consoles

Procedure

1. Using the xs command-line utility to log in as a user with the SpaceDeveloper role to the organization and
space where the database explorer is installed.

For example, in SAP HANA Express, the command looks similar to the following:

xs login -a https://hxehost:39030 -o HANAExpress -s SAP -u XSA_ADMIN

2. Run the xs env hrtt-service command to find the connection parameters for the hrtt-datasource.
Search the command results for the credentials with path VCAP_SERVICES.hana[0].

The results are similar to the following:

{
"name": "hrtt-datasource",
"label": "hana",
"tags": [
"hana",
"database",
"relational"
],
"plan": "securestore",
"credentials": {
"schema": "USR_BTVXBP585K74Z43VYJBW8WWZU",
"password": "password",
"driver": "com.sap.db.jdbc.Driver",
"port": "port-number",
"host": "hxehost",
"db_hosts": [
{
"port": 39013,
"host": "hxehost"
}
],
"user": "USR_BTVXBP585K74Z43VYJBW8WWZU",
"url": "jdbc:sap://hxehost:39013/?
currentschema=USR_BTVXBP585K74Z43VYJBW8WWZU"
}

SAP HANA Database Explorer


20 PUBLIC Security in the SAP HANA Database Explorer
}

3. Open the database explorer from the SAP HANA cockpit or SAP Web IDE for HANA and add a database by
using the values from the hrtt-datasource entry above.
a. Click the Add a Database to the Database Explorer icon ( ) and choose either SAP HANA Database
(Multitenant) or SAP HANA Database (if you have a single database container).
b. Determine the instance number from the hrtt-service environment port field value. If the port number
is 3<xx>13, then <xx> is the instance number.
c. Enter the user name and the password from the hrtt-service environment.
d. After connecting to your database, navigate to the schema that has the same name as the user. This is
the schema where HRTT stores persistent user data.
4. Open a SQL console and execute the following SQL batch to delete all data for the user, substituting
<user-ID> with the actual user ID:

DO ( IN user_id VARCHAR(56) => '<user-ID>' )


BEGIN
DECLARE c INT;
DECLARE v_sql VARCHAR(1000);
SELECT COUNT(*) INTO c FROM SYS.TABLES WHERE schema_name=current_schema AND
( table_name='ACTIVITY_RESULTS' or table_name='ACTIVITIES_' );
IF c = 2 THEN
v_sql = 'DELETE FROM ACTIVITY_RESULTS AR WHERE AR.ACTIVITY_ID IN (
SELECT ACTIVITY_ID FROM ACTIVITIES_ A
WHERE A.USER_ID = ''' || :<user_ID> || ''' )';
exec :v_sql;
END IF;
SELECT COUNT(*) INTO c FROM SYS.TABLES WHERE schema_name=current_schema AND
table_name='ACTIVITIES_';
IF c = 1 THEN
v_sql = 'DELETE FROM ACTIVITIES_ WHERE USER_ID = ''' || :<user_ID> ||
'''';
exec :v_sql;
END IF;
SELECT COUNT(*) INTO c FROM SYS.TABLES WHERE schema_name=current_schema AND
table_name='STATEMENTS';
IF c = 1 THEN
v_sql = 'DELETE FROM STATEMENTS WHERE OWNER = ''' || :<user_ID> || '''';
exec :v_sql;
END IF;
SELECT COUNT(*) INTO c FROM SYS.TABLES WHERE schema_name=current_schema AND
table_name='USER_DATABASE_LOCKS';
IF c = 1 THEN
v_sql = 'DELETE FROM USER_DATABASE_LOCKS WHERE USERID = '''
|| :<user_ID> || '''';
exec :v_sql;
END IF;
SELECT COUNT(*) INTO c FROM SYS.TABLES WHERE schema_name=current_schema AND
table_name='USER_DATABASES';
IF c = 1 THEN
v_sql = 'DELETE FROM USER_DATABASES WHERE USERID = ''' || :<user_ID> ||
'''';
exec :v_sql;
END IF;
SELECT COUNT(*) INTO c FROM SYS.TABLES WHERE schema_name=current_schema AND
table_name='USER_PREFERENCES';
IF c = 1 THEN
v_sql = 'DELETE FROM USER_PREFERENCES WHERE USERID = ''' || :<user_ID>
|| '''';
exec :v_sql;
END IF;
SELECT COUNT(*) INTO c FROM SYS.TABLES WHERE schema_name=current_schema AND
table_name='XRAY_STORIES';
IF c = 1 THEN

SAP HANA Database Explorer


Security in the SAP HANA Database Explorer PUBLIC 21
v_sql = 'DELETE FROM XRAY_STORIES WHERE CREATED_BY = ''' || :<user_ID>
|| '''';
exec :v_sql;
END IF;
COMMIT;
END;

Results

The data for the specified user is removed from the tables in hrtt-datasource.

2.1.2 Delete Your Personal Data

Delete your personal information stored by the SAP HANA database explorer.

Context

This procedure deletes the following personal data associated with the connected user ID:

• All database credentials


• All user-defined SQL statements
• All user preferences
• All background tasks
• All content in open SQL consoles

Procedure

1. Click the Preferences icon ( ) and click Database Explorer.


2. Click Remove all user data then click Yes.

Results

Your user data is deleted and SAP HANA database explorer restarts.

SAP HANA Database Explorer


22 PUBLIC Security in the SAP HANA Database Explorer
2.2 Securing the SAP HANA Database Explorer

Security considerations for SAP HANA database explorer include authentication, authorization, and secured
connections.

Authentication and Authentication and authorization for the database explorer is governed by the
authorization application in which it resides.

The database explorer is integrated into SAP HANA cockpit and SAP Web IDE for SAP
HANA. To use the database explorer you must be a non-administrator user of one of
these applications.

Access to As a cockpit user, you can access any HDI container that exists in a
registered space in which you have been assigned the SpaceDeveloper role.
cockpit
databases As a cockpit user, you can access any cockpit that is assigned to a
group of which you are a member.

Access to HDI As an SAP Web IDE user, you can access any HDI container that is
containers in configured to run on the same XS advanced server that SAP Web IDE
SAP Web IDE runs on, and that exists in a space in which you have been assigned
the SpaceDeveloper role.

By default, an HDI container user is assigned a few basic database


privileges. For example, the object owner (“#OO” user) is only
assigned the CREATE ANY privilege on the container's run-time
schema (schema “TEST” for an HDI container “TEST”). To access
database objects inside other database schemata or other HDI
containers, and to be able to deploy synonyms into the HDI container
that point to objects outside the container, or to be able to import
catalog objects into an HDI container, you must grant the object
owner additional privileges.

For more information see the SAP HANA Developer Guide (For SAP
HANA XS Advanced Model).

Connections from As a user of the cockpit, you can add any registered database to the database explorer.
the browser to the When the database browser sends a connection request to the XS advanced server that
database explorer is associated with the database explorer, the browser verifies that the host name of the
XS advanced server responding XS advanced server matches the host name that it provides. Specifically the
browser includes the Origin header, which contains the host name of the XS advanced
server in the request. If the host name of the responding XS advanced server does not
match the host name in the Origin header, then the connection does not proceed. You
can provide the XS advanced server with a list of host names to use during this
verification by setting the WEBSOCKET_ORIGIN environment variable (using xs set -
env) for the XS advanced server.

TLS/SSL SAP HANA databases that accept TLS/SSL connections usually use certificates that
connections from are obtained from a Certification Authority (CA), but you can use your own signed
the database

SAP HANA Database Explorer


Security in the SAP HANA Database Explorer PUBLIC 23
explorer to certificates. When adding a database to the database explorer, perform the following
databases steps:

1. Check the box marked Connect to the database securely using TLS/SSL.
2. Check the box marked Verify the server’s certificate using the trusted certificate
below.
3. Copy the root certificate into the box.

Storing database When you specify the credentials to connect to an SAP HANA database, those
user credentials credentials are not saved to your browser. To have the credentials persist between
sessions, save the credentials to the SAP HANA secure store.

Saving SQL console If your browser supports saving content to local storage, then, for the duration of your
information to your session, the SQL content in your SQL console is saved to your browser. (Configure this
browser's local behavior in your user preferences within the SAP Web IDE.)
storage

Exporting and When you export catalog objects, the content that is saved is not encrypted.
importing catalog
objects When you import catalog objects into a database, no automatic virus scan or content
validation of the files is performed before they are imported. Malicious content can be
imported. Use external tools to validate the content of the files and scan them for
viruses before importing them.

Related Information

Getting Started With the SAP HANA Database Explorer [page 4]


Secure User Store (hdbuserstore)
Permissions for Container Objects
Known Security-Related Issues

2.2.1 Secure the SAP HANA Database Explorer from Web


Socket Attacks

When the host name in the URL for the SAP Web IDE for SAP HANA or SAP HANA cockpit does not match the
hostname of its XS advanced server, then you must provide the XS advanced server with the accepted host
names to use when the XS advanced server verifies connections to the SAP HANA database explorer.

Prerequisites

You must have one of the following roles:

• OrgManager

SAP HANA Database Explorer


24 PUBLIC Security in the SAP HANA Database Explorer
• SpaceManager
• SpaceDeveloper

Procedure

1. Connect to the XS command line interface.

For example:

xs login -a https://myhostname.mycorporatesite.com:30030 -u XSA_ADMIN -p


mypassword

2. Set the WEBSOCKET_ORIGIN environment variable for the XS advanced server to the list of acceptable
host names. Use the set-env command and enclose the acceptable host names between square brackets.

On a Unix system, the value must be enclosed in single quotes. For example:

xs set-env hrtt-service WEBSOCKET_ORIGIN '["myhost1", "myhost2"]'

On Windows, the double quote characters must be escaped. For example:

xs set-env hrtt-service WEBSOCKET_ORIGIN [\"myhost1\",\"myhost2\"]

3. Execute the following commands to restage the hrtt-service.

xs restage hrtt-service

4. Execute the following commands to restart hrtt-service.

xs restart hrtt-service

SAP HANA Database Explorer


Security in the SAP HANA Database Explorer PUBLIC 25
3 Analyzing and Diagnosing Errors

The SAP HANA database explorer allows you to configure different types of traces and view diagnostic files for
your database. You can also use the SQL debugger to ensure that your database queries are error-free.

3.1 Set Session Logging

Log all back-end service requests for the specific user session.

Context

Set user-specific session logging when you require debug traces for individual requests, for example to provide
to your cloud administrator for support purposes, but you do not want to expose sensitive data from other
users.

Session-based logging records all SQL statements executed during the database explorer session as well as
their result sets. These SQL statements may contain personal data.

Procedure

1. Click the Preferences icon ( ) and click Database Explorer.


2. Click Debug Logging, confirm the logging changes, then click Save.

Results

Debug logging is now active only for the connected user for the duration of the SAP HANA database explorer
session.

SAP HANA Database Explorer


26 PUBLIC Analyzing and Diagnosing Errors
3.2 View SQLScript Code Coverage Report

Retrieve code coverage information for SQLScript procedures and anonymous blocks.

Prerequisites

To see a database object in the coverage report, you must have the DEBUG object privilege for that object.

You must have a minimum database version of HANA 2.0.030.

Context

Information is provided for code executed within one user-provided SQL session.

Procedure

1. Enter your procedure or anonymous block into the SQL console.

2. Click ANALYZE Report Code Coverage .

Results

The code is executed and a coverage report is generated and is displayed under the Code Coverage Report tab.
The Overview table of the code coverage report contains one row per procedure/anonymous block involved in
the code execution.

SAP HANA Database Explorer


Analyzing and Diagnosing Errors PUBLIC 27
3.3 View Database Procedures in the SAP HANA Database
Explorer

Use the SAP HANA database explorer to view and test a database procedure.

Prerequisites

• You have access to a running SAP HANA system that includes a database procedure.

Procedure

Find your procedure in your catalog browser, and then choose one of the following options:

Option Action

View information about the procedure's parameters Click the procedure to open.

View the CREATE statement associated with the proce­ Open the procedure, and then click the CREATE Statement
dure tab.

Generate a CALL statement for the procedure Open the procedure, and then click Generate CALL
Statement.

Open the procedure to debug it (SAP Web IDE only) Right-click the procedure, and then choose Open for
debugging.

Related Information

Create a Simple "Tiny-World" Application

3.3.1 Debug Procedures in the SAP HANA Database Explorer

Debug your stored procedures by using the SQL debugger in the SAP HANA database explorer.

Prerequisites

You must have the DEBUG object privilege granted on the schema or procedures that you want to debug.

To allow a user to debug a procedure in another user's session, the secondary user must be granted the
ATTACH DEBUGGER privilege. For example, user A can grant the ATTACH DEBUGGER privilege (using the

SAP HANA Database Explorer


28 PUBLIC Analyzing and Diagnosing Errors
GRANT statement) to user B to allow user B to debug a procedure in user A’s session. User B also needs the
DEBUG privilege on the procedure.

Context

In the SAP Web IDE, use the development perspective to create stored procedures in .hdbprocedure
modules and build them into HDI containers. Switch to the database explorer to test and debug the built
procedures. To make corrections to the stored procedures, return to the development perspective.

Using the SQL debugger with user-provided services or application-managed service instances is not
supported.

 Note

If you are debugging a procedure and subsequently make changes to the procedure, then you must restart
the debugging session by detaching and re-attaching the debugger. Each debug session works with a
snapshot of the procedure(s) and any subsequent changes to procedures are not visible in active debug
sessions.

Procedure

1. Choose one of the following options to open the procedure for debugging:

Option Action

From the development perspective: 1. Open the stored procedure (the .hdbprocedure
file.)
2. Right-click in the editor and choose Open Runtime
Object.
The database explorer opens, the HDI container ap­
pears in the catalog browser, and the metadata
viewer for the procedure opens.
3. Right-click the procedure in the catalog browser item
list and click Open for debugging.

From the database explorer: 1. Connect to the database.


2. Locate the stored procedure in the database browser,
and then right-click and click Open for debugging.

The procedure opens in a code editor, the debugger opens on the right sidebar and connects to the
database, and a debugger session starts.

2. Set breakpoints in the code of your stored procedure by clicking a line number.
3. Call the procedure by right-clicking the procedure in the catalog browser item list and clicking Generate
CALL statement.
a. In the code, enter values for any input parameters.
b. Choose Run ( ) from the global toolbar.

SAP HANA Database Explorer


Analyzing and Diagnosing Errors PUBLIC 29
The SQL console opens and it contains the CALL statement for your procedure.

The debugger stops at the first breakpoint and the session is suspended until you resume the debugging.
4. Choose  (Resume module execution (F8)) or  (Step over next function call (F10)) to step through the
code execution.

Next Steps

Once you are finished debugging, click Detach debugger from running application ( ) to stop the debugging
session.

3.4 SAP HANA Database Explorer Debugger Tutorials

Use the database explorer debugger to debug stored procedures and functions.

Use the tutorials in this section to help you understand the following tasks you can perform with the database
explorer debugger:

• Attaching and detaching the debugger from your database


• Using breakpoints to debug procedures and functions
• Working with debugger variables and expressions
• Using the step over feature to debug your code step by step
• Working with watchpoints

 Note

You must have the DEBUG object privilege granted on the schema or procedures that you want to debug.
To allow a user to debug a procedure in another user's session, the secondary user must be granted the
ATTACH DEBUGGER privilege. For more information on debugging prerequisites, see Debug Procedures in
the SAP HANA Database Explorer and Object Privileges (Reference).

Tutorial Requirements

Execute the following statements (using the same line numbering as below) to create the function func_add,
and the procedure dp2, which are used extensively in the debugger tutorials:

CREATE FUNCTION func_add(x DOUBLE, y DOUBLE)


RETURNS result_add DOUBLE LANGUAGE
SQLSCRIPT READS SQL DATA AS
BEGIN
result_add :=x + y;
END;

CREATE PROCEDURE "dp2" ()

SAP HANA Database Explorer


30 PUBLIC Analyzing and Diagnosing Errors
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
--DEFAULT SCHEMA <default_schema_name>
READS SQL DATA AS
BEGIN
DECLARE lt1 TABLE(a INT);
DECLARE category VARCHAR(20) ARRAY;
DECLARE I INT:= 0;
lt1.a[1] = 3;
lt1.a[2] = 4;
lt1.a[3] = 2;
category [1]:= 'CategoryA';
category [2]:= 'CategoryB';
category [3]:= 'CategoryC';
i=FUNC_ADD(2,4);
END;

Related Information

Debug Procedures in the SAP HANA Database Explorer [page 28]

3.4.1 Tutorial: Connecting the Debugger

Attach the database explorer debugger to your database.

Context

Start an active debugging session for a specific database and specific types of connections.

Procedure

1. Click the Debugger icon ( ) on the right-hand tool bar to open the debugger.
2. Click the Attach debugger icon ( ) and click the database you want to attach the debugger to.
3. Click OK.
4. In the Debugger Attach Options dialog, choose one of the following options for how the debugger is
attached:

SQL console connections Debug executions of a procedure from a SQL console

Connections with the Debug connections that use the specified debug token. Click Choose a
following debug token Debug Token... opens a dialog that shows current tokens in use by the
current database.

SAP HANA Database Explorer


Analyzing and Diagnosing Errors PUBLIC 31
Connections with the Debug connections with the given connection IDs are debugged. Click
following HANA Choose a Debug Token... opens a dialog that shows connection IDs for
connection IDs (comma- connections to the HANA database.
separated):

Connections with the Debug connections with the specified HANA database user name and,
following attributes optionally, the specified application user name. Use the Application user
name option primarily for ABAP applications, as ABAP connections use the
same HANA database user name, but a different application user name.

Results

A message appears on the top right corner of the screen indicating that the debugger has successfully
connected and the Active Session dropdown menu shows the name of the connected database.

3.4.2 Tutorial: Debugging a Procedure by Setting


Breakpoints

Create a sample procedure and then set breakpoints where you want the debugging to pause during the
execution of your code.

Prerequisites

You must have created the function func_add, and the procedure dp2, as specified in the SAP HANA Database
Explorer Debugger Tutorials topic.

Context

To debug a procedure, HANA must first compile it. Breakpoints that are set before the procedure is compiled
do not have a checkmark. Once the procedure is compiled, valid breakpoints show checkmarks. Setting a
breakpoint after procedure compilation automatically moves the breakpoint to the next valid line, if it is not
currently on a valid line.

Procedure

1. Right-click the dp2 file and click Open for Debugging.


2. Create a breakpoint on a specific line by clicking next to the line number.

SAP HANA Database Explorer


32 PUBLIC Analyzing and Diagnosing Errors
A blue background appears at the line number, along with a checkmark. The checkmark indicates that the
breakpoint has been validated by HANA as a valid line number for the breakpoint to exist on.
3. Right-click on dp2 again and click Generate CALL Statement.
4. Click Run to execute the procedure.

The procedure starts to run, but stops at the breakpoint, with a message in the top right corner of the
screen indicating that the procedure has been suspended. The Console section of the debugger displays
the message, Stopped at breakpoint.
5. To resume the execution of the procedure, click Resume ( ), or press F8, in the debugger window.

Results

The procedure has successfully executed, pausing at the set breakpoints.

Related Information

SAP HANA Database Explorer Debugger Tutorials [page 30]

3.4.3 Tutorial: Debugging a Function by Setting Breakpoints

Create a sample function and then set breakpoints where you want the debugging to pause during the
execution of your code.

Prerequisites

You must have created the function func_add, and the procedure dp2, as specified in the SAP HANA Database
Explorer Debugger Tutorials topic.

Context

You cannot set breakpoints and debug a function directly. Instead, the function must be called through a
procedure or a table function.

SAP HANA Database Explorer


Analyzing and Diagnosing Errors PUBLIC 33
Procedure

1. Right-click the func_add function and click Open for debugging.


2. Click on a line in the function to create a breakpoint.

A dialog pops up that says that debugging scalar UDFs is only supported if the UDF is assigned to a variable
within a procedure or a table function that also has a breakpoint set.
3. Click OK in the dialog box and call the procedure, dp2, which calls func_add, by right-clicking the procedure
and clicking Generate CALL Statement Run .

Results

When dp2 is called, you can see that func_add breaks on the set breakpoints, since dp2 calls the function at
line 17.

Related Information

SAP HANA Database Explorer Debugger Tutorials [page 30]

3.4.4 Tutorial: Debugging an Anonymous Block

Create a function that contains an anonymous block and then set breakpoints where you want the debugging
to pause during the execution of your code.

Prerequisites

To set breakpoints in an anonymous block, set the Stop at execution start option in the Debugger Attach
Options dialog when you attach the debugger to your database.

Context

You cannot set breakpoints and debug a function directly. Instead, the function must be called through a
procedure or a table function.

When debugging anonymous blocks, breakpoints and watchpoints are not persisted between executions.

SAP HANA Database Explorer


34 PUBLIC Analyzing and Diagnosing Errors
Procedure

Call the procedure dp2, which contains an anonymous block, by right-clicking the dp2 procedure in the
Procedures item list and clicking Generate CALL Statement.

Results

When you execute the SQL, a second, read-only editor tab opens and execution is paused at the start of the
SQL. You can step through the code, set breakpoints, and debug just as you can when debugging procedures
and functions.

3.4.5 Tutorial: Debugging a SQLScript Library

Debug a SQLScript Library in the SAP HANA database explorer.

Prerequisites

You must be running a HANA database of version 2.0 SPS 04 or later.

To set a watchpoint in the SQLScript library, you must first set the SQLScript library member in the Add
Watchpoint dialog.

Procedure

Right-click the SQL library that you want to debug and click Open for Debugging.

Results

The library opens in the debugging editor where you can set breakpoints.

SAP HANA Database Explorer


Analyzing and Diagnosing Errors PUBLIC 35
3.4.6 Tutorial: Working With Expressions in the Debugger

Select one or more expressions to evaluate during the debugging session.

Prerequisites

You must have created the function func_add, and the procedure dp2, as specified in the SAP HANA Database
Explorer Debugger Tutorials topic.

Context

The Expressions tab in the debugger allows you to watch expressions as executions are paused. As you step
through the code, the debuggers watches the expression and returns any results.

Procedure

1. Right-click the dp2 file and click Open for Debugging.


2. Click the Expressions tab and then click Add Watch Expression ( ).
3. Choose SQLScript in the Module type drop-down menu.
4. In the Expression Text field, type the expression i + 5.

The debugger watches the expression during the debug session and will return all values for i plus 5.
5. Click Add.
6. (Optional) To edit an expression, select the expression and click Edit ( ).
7. Set breakpoints on lines 13 and 18 in the dp2 procedure and run the procedure by right-clicking dp2 and
clicking Generate CALL Statement Run .

The procedure stops at line 13, and in the Expressions tab, the value of i + 5 is displayed as 5, since i was
declared as 0 on line 9.

8. Click Resume ( ) to continue execute the procedure.

The procedure now stops at line 18, and in the Expressions tab, the value of i + 5 has changed from 5 to
11. This is because on line 17, the value of i became 6, when the code i=FUNC_ADD(2,4); was executed.

Results

You have run a debugging session on procedure dp2, where the expression i + 5 was watched and returned
varying results, depending on the breakpoint set.

SAP HANA Database Explorer


36 PUBLIC Analyzing and Diagnosing Errors
3.4.7 Tutorial: Working with Variables in the Debugger

View variable values within the procedure or function that you are debugging.

Prerequisites

You must have created the procedure dp2, as specified in the SAP HANA Database Explorer Debugger Tutorials
topic.

Context

The Variables tab in the debugger allows you to view variables and their definitions as executions are paused
during the debug session.

Procedure

1. Right-click the dp2 file and click Open for Debugging.


2. Set a breakpoint at line 14.

3. Right-click the procedure and click Generate CALL Statement Run to run the procedure.

The procedure pauses on line 14.


4. Click Variables and click Local to view the different variables in your procedure along with their values.
5. Click the LT1: table[3] variable and then click Display Content ( ) to view the contents of the selected
variable.
6. If the variable can be changed, then the Edit icon ( ) is enabled and you can click the icon to change value.

The following global and local variable types can be changed:

• BINARY, VARBINARY
• BOOLEAN
• STRING
• CHAR, NCHAR, VARCHAR, NVARCHAR, VARCHAR3, VARCHAR2
• DATE, TIME, TIMESTAMP, DAYDATE, SECONDTIME, LONGDATE, SECONDDATE
• INTEGER, INT, TINYINT, SMALLINT, BIGINT
• DECIMAL, SMALLDECIMAL
• REAL, DOUBLE, FLOAT

SAP HANA Database Explorer


Analyzing and Diagnosing Errors PUBLIC 37
Results

You have run a debugging session on procedure dp2, where you examined the definition for the variable LT1:
table[3], when the procedure paused execution at line 14.

3.4.8 Tutorial: Working With Watchpoints in the Debugger

Setting a watchpoint in the debugger to pause code execution when a specified condition is encountered.

Prerequisites

You must have created the function func_add, and the procedure dp2, as specified in the SAP HANA Database
Explorer Debugger Tutorials topic.

Context

A watchpoint acts like a breakpoint, but rather than specifying a line at which to pause code execution, you
specify a condition at which to pause code execution. For example, you can pause code execution when the a
specified expression is true or when the result of a specified variable changes values.

Procedure

1. Right-click the dp2 file and click Open for Debugging.


2. Click Add Watchpoint ( ) to add a watchpoint.
3. In the Add Watchpoint dialog, choose the condition When expression is true from the Watchpoint condition
dropdown menu.
4. Specify i=6 in the Expression after field.

Notice that the watchpoint is added to the Breakpoints view.

5. Run the dp2 procedure by clicking Generate CALL Statement Run .

The procedure stops at line 18 with a message in the Console box stating that the procedure execution
stopped due to the specified watchpoint.
6. (Optional) Edit the expression in the watchpoint.
a. Click the watchpoint and click Edit Watchpoint ( ).
b. Change the value in Expression after to i<6.
7. Re-run procedure dp2.

SAP HANA Database Explorer


38 PUBLIC Analyzing and Diagnosing Errors
The code now pauses execution at line 11, since that is the first instance where the value of the variable i is
less than 6.

Results

You have successfully created and edited a watchpoint in the debugger.

3.4.9 Tutorial: Quitting the Debugging Session

Explicitly quit your debugging session by detaching the debugger from your application, or by setting a
debugger timeout limit.

Context

Procedure

1. Quit your debugging session.


a. Click Detach Debugger from Running Application ( )

A message appears on the top right of the screen, indicating that the debugger is detatched.
2. Set the timeout limit for the debugger.
a. Click Preferences ( ).
b. Click the SQLScript Debugger option.
c. Enter the number of minutes you want to set the debugger session timeout limit to and click Save.

Results

You have quit your current debug session and set a timeout (in minutes) preference for all debugging sessions.

SAP HANA Database Explorer


Analyzing and Diagnosing Errors PUBLIC 39
4 Querying the Database

Execute queries on your database using the SQL console. These queries can be run as background activities.

The database explorer SQL console includes the following functionality:

• Executes batches of statements, separated by semicolons.


• Includes a code-completion feature, as well as a code-formatting feature. Right-click within the SQL
console to run these features.
• Includes the SQL analyzer to help you analyze the performance of your queries.

To view keyboard shortcuts, right-click anywhere in the SQL console and then click Keyboard Shortcuts from
the context menu.

SQL Console Preferences

Set preferences for your SQL consoles by clicking the  (Preferences) icon and navigating to Global
Preferences SQL Console .

You can set the following preferences:

• The theme and font size for your console editor


• The behavior of results sets, such as:
• LOB byte limit
• Display format of NULL values
• The maximum numbers of rows to display
• The maximum number of open results
• Whether to search for a custom command separator when parsing
• Whether to continue, stop, or provide a prompt when a SQL error is encountered
• Whether SQL statements should be prepared before executing
• Whether potential SQL errors should be indicated
• Whether or not text should be parsed into multiple statements before executing
• Whether to close results before executing another SQL statement
• Auto-saving the contents of your console to your local storage for the duration of your session (if your
browser supports saving content)
• Auto-committing new SQL console contents (by default DML contents are auto-committed)

Statement Syntax Help

Use the SQL console side panel to access syntax for SQL statements and to view metadata SQL objects. You
can view the following information:

SAP HANA Database Explorer


40 PUBLIC Querying the Database
Statement/Syntax View the syntax of the statement you are currently editing and use the statement link
to access full reference documentation for the statement.

Tables and Views View information on the tables or views being referenced in the current console and
use the title link to open the table or view definition.

Procedures and View information on procedures or functions being referenced in the current console
Functions and use the link to open the procedure or function definition.

SQL Functions View information on built-in functions and use the link to access full reference
documentation for the function.

Statement History

View the 50 most recently executed SQL statements in the History tab, located beside the Results and
Messages. Double-click a statement in the History tab to load it into the text editor. Closing the SQL console
erases the current statement history.

4.1 Execute SQL Statements

Execute SQL statements and analyze their results by using the SQL console that is included with the SAP
HANA database explorer.

Prerequisites

You must have the required privileges in the SAP HANA database to execute your SQL statements.

Context

Be default, DML contents are autocommited and syntax errors are indicated.

To view keyboard shortcuts, right-click anywhere in the SQL console and then click Keyboard Shortcuts from
the context menu.

Procedure

1. Open an SQL console from the database explorer by right-clicking your database and clicking Open SQL
Console.

SAP HANA Database Explorer


Querying the Database PUBLIC 41
2. Specify a SQL statement.

For example, the following statement returns users who have the EXPORT or IMPORT system privilege:

SELECT * FROM EFFECTIVE_PRIVILEGE_GRANTEES WHERE (OBJECT_TYPE =


'SYSTEMPRIVILEGE')
AND (PRIVILEGE = 'EXPORT' OR PRIVILEGE='IMPORT');

You can also import SQL directly into the console by clicking the Import File icon (  ) and choosing a local
file.
3. Execute on or more statements by choosing one of the following options:

Option Action

Execute all statements Click the Run icon ( ) from the global toolbar or press
F8.

Execute individual statements Highlight the statement, and then click the Run icon ( )
from the global toolbar or press F8.

Execute a SQL query on multiple databases Open a SQL console, create your query and then click
Run Run on Multiple Databases . Click the data­
bases, groups, or resources where you want to run the
query. The query runs as a background activity. Option­
ally, click Cancel all queries on SQL error, to stop subse­
quent queries from running on all databases if one of your
queries encounters a SQL error. Click Run SQL.

Execute a query and open the SQL analyzer to view in­ Open the Run dropdown list from the global toolbar, and
formation about the query's plan then choose Analyze SQL.

A new tab opens to display the query plan for your state­
ment in the SQL analyzer.

To save the plan, click Analyze SQL and Save Plan and
specify a filename for the plan. You can also specify
whether to run the analysis as a background activity.

Execute the content of the current line Open the Run dropdown list from the global toolbar, and
then choose Run Line.

Prompt for the values of parameters before executing Open the Run dropdown list from the global toolbar, and
the statement then choose Prepare Statement.

Results

The Result pane appears with the results. Multiple Result tabs appear when there is more than one result set.
By default, only the first 1000 rows in a result set are retrieved.

All warnings are displayed in the Messages tab. A warning icon ( ) also appears next to the relevant statement
in the SQL console, and you can view the warning message by hovering over it or using the Alt+E keyboard
shortcut.

SAP HANA Database Explorer


42 PUBLIC Querying the Database
Related Information

Introduction to SQL
SAP HANA SQL Reference
About SAP HANA SQLScript
Setting User Preferences
Run a Query as a Background Activity [page 44]
Use the Statement Library to Administer Your Database [page 45]
Analyzing Statement Performance

4.2 Execute Parameterized Statements

Create and execute parameterized statements in the SQL console.

Context

Parameterized statements provide more flexibility to your application when the name of an object, or the value
for a statement option, is not known until execution time.

Procedure

1. Enter your statement in the SQL console and click Run.

For example:

SELECT * FROM SYS.TABLES WHERE SCHEMA_NAME=?;

A Parameters tab appears below the code.


2. Provide the parameter value by either entering it in the field provided or uploading it from a CSV file.
3. Click the Run button on the Parameters tab to execute the statement with the given parameter values.
4. (Optional) To prepare the parameterized statement again, click the Run button on the SQL console. Any
parameter values that were entered in the Parameters tab are discarded.

Results

The statement executes with the given parameters and the results are returned on the Result tab.

SAP HANA Database Explorer


Querying the Database PUBLIC 43
4.3 Run a Query as a Background Activity

Set a query to run as a background activity, which continues running even if the browser window is closed.

Context

Run a query as a background activity when the query is expected to run for a long time, for example, a query
that exports a schema or merges trace files.

Running a query as a background activity stores the query status and results, which can be retrieved at a later
time, and immediately disconnects you from the SQL console where the query was run from. The disconnected
SQL console remains open and can be reconnected to the same, or a different, database. Various operations
within the database explorer can run as background activities. You can view their status using the Background
Activity Monitor.

Background activities have the following limitations:

• Once the background activity has started running, the connection from the SQL console that started the
query is used to run the query. Once the background activity completes, the connection is closed. You
cannot reconnect to a connect that has been used by a background activity.
• Result sets are stored compressed and encrypted. You can store a maximum of 100 MB of background
activity results. If this limit is exceeded, background activity results are no longer stored and you cannot
create new background activities until you free up space by deleting completed background activities.
• The first 256 characters of the query are stored unencrypted as part of the query's description.

Procedure

1. Choose one of the following options to run your query as a background activity:

Option Action

Execute a long-running SQL query as a background ac­ Open a SQL console, create your query and then click
tivity Run Run as Background Activity .

Execute a SQL query on multiple databases Open a SQL console, create your query and then click
Run Run on Multiple Databases . Click the data­
bases, groups, or resources where you want to run the
query. Click Run SQL.

The query runs as a background activity and you are disconnected from the SQL console where the query
was run.

2. (Optional) To view or manage background activities, choose one of the following options:

SAP HANA Database Explorer


44 PUBLIC Querying the Database
Option Action

View the status of your background activities Click the  (Background Activities Monitor) icon in the
bottom, right-hand corner of your screen to open the
Background Activities Monitor.

View the results of one or more background activities In the Background Activities Monitor, double-click a single
query to view its results in a new SQL console, or select
more than one query and click the  (Open Details for
Selected Row(s)) icon. The results for each background
activity open in a separate console.

Cancel a background activity In the Background Activities Monitor, select the back­
ground activity you want to cancel and click the  (Cancel
Selected Row(s)) icon.

Delete a background activity In the Background Activities Monitor, select the back­
ground activity you want to delete from the monitor and
click the  (Delete Selected Row(s)) icon.

Download SQL results for one or more background ac­ In the Background Activities Monitor, select the query or
tivities queries you want to download the results from and click
the  (Download SQL Results for Selected Row(s)) icon.
Your SQL results will then be able to be viewed in a JSON
file.

Related Information

Execute SQL Statements [page 41]


Use the Statement Library to Administer Your Database [page 45]

4.4 Use the Statement Library to Administer Your Database

The statement library in the SAP HANA database explorer contains default system statements and can also be
used to store user-defined statements.

Prerequisites

The maximum size allowed per user for all stored statements is 10 MB, uncompressed.

Only user-defined statements can be accessed by HDI containers.

You cannot use forward slashes (/) in a statement name. Otherwise, there are no character restrictions.

SAP HANA Database Explorer


Querying the Database PUBLIC 45
Context

Default system statements include all statements available in the M_SYSTEM_INFORMATION_STATEMENTS


system view and all statements included in SAP Note 1969700.

You can edit statement contents and descriptions in the SQL console and then save them back to the
statement library as a new statement, or by replacing the old version.

Create your own SQL statements for administration purposes directly in the SQL console and add them to the
statement library. Alternatively, you can import statements saved as ZIP files, .sql files, or .txt files from
your local computer or network file server.

The content of statements stored in the statement library is encrypted, except for the statement description;
do not include sensitive information in your statement description.

The statement library is user-specific, therefore all stored statements are available for every database
associated with a specific user.

Action Description

Create and add statements 1. In the catalog browser, right-click your database and
click Open SQL Console.
2. Enter your SQL statement. Including a header is
optional. However, a description for your SQL
statement will not show up in the statement library
unless you create one in your statement header. The
format for your statement description is as follows:

/*
[DESCRIPTION]
--Sample description
*/

The statement description shows the first line of the


content after the [DESCRIPTION] section header.
3. Click the  (Add to Statement Library) icon to add the
statement to your statement library. You can change
the statement name and see how the name and
statement description will show up in the library.

Import statements 1. To import a SQL statement or set of statements to your


statement library, right-click your database and click
Show Statement Library.
2. Click the  (Import) icon.

A file browser opens that allows you to import an individual


statement in a .sql, .txt, or XML file, or a set of
statements in a ZIP file.

ZIP file hierarchies are flattened.

SAP HANA Database Explorer


46 PUBLIC Querying the Database
Action Description

Export statements
 Note
You can only export statements with the type USER.

Export a statement by clicking the row and clicking the 


(Export) icon dropdown menu.

For an individual statement, click As SQL.

For multiple statements, click one of: As tgz archive, As tar


archive, or As XML archive.

Edit statements Edit a stored SQL statement by clicking its folder and
clicking the  (Open in SQL Console) icon.

The statement opens in the SQL console where you can edit
the syntax and description and add it back into the
statement library under the same name or a different name.

Delete statements Delete a single statement from the statement library by


either right-clicking the statement and clicking Delete, or
selecting the row and clicking the  (Delete) icon.

Related Information

SAP Note 1969700


M_SYSTEM_INFORMATION_STATEMENTS System View

4.5 Work With Graph Workspaces in SAP HANA Database


Explorer

View and work with graph workspaces in the SAP HANA database explorer.

Prerequisites

You must have an existing graph workspace in your database.

Context

Running an algorithm expands 1000 vertices. Applying a filter returns a maximum of 1000 records.

SAP HANA Database Explorer


Querying the Database PUBLIC 47
Configure the number of vertices that expand when you double-click to a maximum of 50.

For more information about graph workspaces, see the SAP HANA Graph Reference guide.

Procedure

View graph workspaces in the database explorer.


a. Click the Graph Workspaces object in the catalog browser.

A list of all available graph workspaces for your database appears both in the graph workspaces editor and
in the catalog browser item list.

Option Action

View schema information for a graph workspace Right-click a graph workspace and click Open to view infor­
mation about the graph workspace, such as the names of
the edge and vertex tables, the schema the graph workspace
belongs to and its creation time.

View data in a graph workspace Right-click a graph workspace and click View Graph. The
graph workspace opens in the graph visualizer and allows
you to perform the following actions:

Add Fil­ Narrow your result set by setting conditions for


ter ( ) both your vertices and edges. To apply a filter, se­
lect a column, operator, and value. Multiple filters
can be added.

Apply Apply one of the following algorithms:


Algo­
rithm Neighbor­ Returns neighboring nodes of a
( ) hood specific vertex. Specify a start ver­
tex, direction, and depth.

Shortest Find the shortest path between


Path the source and target vertices.

Strongly Shows a group of nodes where ev­


Connected ery node is reachable from every
other node to form a strongly con­
nected component. Nodes belong­
ing to the same component are
shown in the same colour.

Cypher Write a cypher query using edge


and vertex variables to define a
pattern of subgraphs. The result
contains subgraphs that match
the pattern defined in the query.

Set­ Change the labels of your vertices and edges.


tings Highlight vertices containing a specific value with
( ) the same color. Use the Preferences option to set
the vertex expansion limit when you double-click,
or set the forced layout threshold time.

SAP HANA Database Explorer


48 PUBLIC Querying the Database
Option Action

Proper­ The drop-down properties pane on the left side of


ties the screen, shows all attributes associated with
the selected vertex and edge and the number of
incoming and outgoing edges. It also contains
quick links for algorithms.

Reset your graph at anytime by clicking 

SAP HANA Database Explorer


Querying the Database PUBLIC 49
5 Analyzing Performance

Improve the performance of query execution by analyzing SQL statements, and procedures and functions
written in SQLScript.

5.1 Configure Tracing in the SAP HANA Database Explorer

Various types of tracing are available in the SAP HANA database explorer for obtaining detailed information
about your database system operations.

Prerequisites

To configure tracing, you must have the TRACE ADMIN system privilege.

You must be connected to an SAP HANA database. You cannot configure tracing for HDI containers or cockpit
resources.

Procedure

1. Right-click your database and click Trace Configuration.


2. Click Edit on the type of tracing that you want to configure.
3. On the Trace Configuration editor, configure your trace settings and click OK.

Results

You have configured your tracing type and can now view and download tracing results from either your
Database Diagnostic Files folder or your Host Diagnostic Files folder.

Related Information

Traces

SAP HANA Database Explorer


50 PUBLIC Analyzing Performance
5.2 View Diagnostic Files in the SAP HANA Database
Explorer

Diagnose and analyze errors in an SAP HANA database by viewing the relevant diagnostic files in the SAP
HANA database explorer.

Context

In the catalog browser, diagnostic files for online databases are grouped by host and then by service. In a multi-
host system, check each host folder to view all diagnostic files associated with a particular service.

Procedure

Choose one of the following options:

Option Description

View diagnostic files Open the Database Diagnostic Files folder of your database, then right-click the diagnostic file that
for a database that is you want to examine and click Show Files to open the file in an editor. If the trace file is binary, then
online and available
it cannot be opened in the database explorer, but can be downloaded. The Database Diagnostic
Files folder contains all diagnostic files that are available through the database's M_TRACEFILES
system view.

View diagnostic files Open the Host Diagnostic Files folder of your cockpit database, then right-click the diagnostic file
for a cockpit data­ that you want to examine and click Show Files to open the file in an editor. If the trace file is binary,
base that is either
then it cannot be opened in the database explorer, but can be downloaded. The Host Diagnostic
online or offline
Files folder contains all diagnostic files that have been configured for the SAP Host Agent.

For more information about configuring the SAP Host Agent, see the SAP Host Agent documenta­
tion.

The cockpit database must have valid SAP Control Credentials set in the cockpit. If the user has
not set valid SAP Control Credentials, then an error is returned.

View diagnostic files Under the Database Diagnostic Files folder of your database, right-click the folder of the tenant da­
for tenant databases tabase that you want to view trace files for, and then click Show Files to open the file in an editor.
in an MDC system
 Note
You must be connected to the system database as the SYSTEM user.

SAP HANA Database Explorer


Analyzing Performance PUBLIC 51
Related Information

Collecting Diagnosis Information for SAP Support

5.2.1 Viewing the Trace File List

See all the trace files in your system.

Seeing trace files currently in your system is useful for SAP HANA database monitoring and analysis.

To view the trace file, open the SAP HANA database explorer. Right-click the desired host folder, and click Show
Files.

The trace file list opens, showing all trace files currently in the system. You can also see their metadata such as
the host, service, file name, size, and the time the file was modified.

To support monitoring and analysis, you can perform the following actions on the trace file list:

• Define the sorting order of the trace files


• Filter the results according to a desired parameter
• See the trace file’s contents by selecting its row from the table
• In the contents view, you can choose to show the start of the trace file, the end of the trace file, or the entire
trace file.

5.2.2 View Diagnosis Files of an Unavailable Tenant Database

If a tenant database is unavailable, for example because it's stopped or experiencing major performance
problems, the tenant database administrator can't access diagnosis files. In this case, you as the system
administrator can access the diagnosis files of the tenant database from the system database using the SAP
HANA database explorer.

Procedure

Open the Host Diagnostic Files folder of your cockpit database, then click the diagnostic file that you want to
examine to open it in an editor. The Host Diagnostic Files folder contains all diagnostic files that have been
configured for the SAP Host Agent.

 Note

You cannot open binary trace files (marked with a binary icon) in the database explorer. You can only
download binary trace files.

For more information about configuring the SAP Host Agent, see the SAP Host Agent documentation.

SAP HANA Database Explorer


52 PUBLIC Analyzing Performance
The cockpit database must have valid SAP Control Credentials set in the cockpit. If the user has not set valid
SAP Control Credentials, then an error is returned.
The diagnosis files of the system database are displayed.

Next Steps

If more detailed diagnosis information is required (for example for SAP Support), you can trigger the collection
of a full system information dump for tenant databases. For more information, see Collecting Diagnosis
Information for SAP Support in the SAP HANA Administration Guide.

Related Information

Add a Database to the SAP HANA Database Explorer [page 9]


View Diagnostic Files in the SAP HANA Database Explorer [page 51]
SAP Host Agent

5.3 Traces

SAP HANA provides various traces for obtaining detailed information about the actions of the database system
for troubleshooting and error analysis.

The following types of traces can be configured in the SAP HANA database explorer:

• Database Trace
• SQL Trace
• User-Specific Trace
• End-to-End Trace
• Kernel Profiler
• Expensive Statements Trace
• Performance Trace
• Plan Trace

For more information on how these traces work, see the relevant topic in the Traces section of the SAP HANA
Administration Guide for SAP HANA Platform.

Related Information

Traces

SAP HANA Database Explorer


Analyzing Performance PUBLIC 53
5.4 Analyze Procedure and Function Performance

Analyze a procedure or function written in SQLScript to search for patterns indicating problems in code quality,
security or performance.

Prerequisites

You must be connected to a HANA database that has the SQLScript Code Analyzer.

You must have the required database permissions to run the SQLScript Code Analyzer.

Context

The SQLScript Code Analysis Results editor only shows the first 1,000 results.

Procedure

1. Choose from one of the following options:

Option Action

To analyze all procedures and functions for a database Right-click on the database or schema and click Analyze
or schema SQLScript Code.

To analyze all procedures or all functions for a database Right-click on the Procedures folder or the Functions folder
or schema of the database or schema and click Analyze SQLScript
Code.

To analyze an individual procedure or function • Open the list of procedures or functions by clicking
the Procedures folder or the Functions folder. Right-
click a procedure or function in the catalog browser
list and click Analyze SQLScript Code.
• Click the procedure or function to open its definition
and then click Analyze SQLScript Code.
• Right-click on the procedure or function and click
Analyze SQLScript Code.

To analyze a specific set of procedures or functions Open the list of procedures or functions by clicking the
Procedures folder or the Functions folder. Click on the pro­
cedures or functions that you want to analyze, then right-
click and click Analyze SQLScript Code.

The SQLScript Code Analysis Results editor opens and the results of the analysis are loaded.

2. (Optional) Search for a specific result using the search bar or download the results in CSV format by
clicking the download button ( ).

SAP HANA Database Explorer


54 PUBLIC Analyzing Performance
3. (Optional) Right-click on a result and click Open CREATE Statement to open the procedure or function in a
code editor where the problematic portion of the code is marked.

5.5 View Execution Plans for SQL Statements, Procedures,


and Anonymous Blocks

View the details of a compiled execution plan for a SQL statement, procedure, or an anonymous block.

Context

Running Explain Plan generates the SQLScript engine's execution plan for a given statement, procedure or
anonymous blocks. The results of the execution plan are stored in a global temporary table. For SQL
statements, the results are stored in the EXPLAIN_PLAN_TABLE temporary table. For procedures and
anonymous blocks, results are stored in the EXPLAIN_CALL_PLANS temporary table, and only if you are using
HANA 2.0 or higher.

Procedure

1. Enter your SQL statement or procedure in the SQL console.

You can enter multiple SQL statements at once.

2. Click Analyze Explain Plan .

Results

The plan information for each statement is displayed separately. The results are visible only within the session
where the EXPLAIN PLAN call is executed.

Related Information

Query Plan Analysis


Anonymous Block

SAP HANA Database Explorer


Analyzing Performance PUBLIC 55
6 Importing, Exporting, and Accessing Data

Import or export schemas and database objects and create and manage remote sources and virtual objects.

6.1 Create a Remote Source

Use SAP HANA database explorer to create a remote source to another database.

Prerequisites

• You have the CREATE REMOTE SOURCE system privilege.


• To create the remote source by using a DSN entry, it must already exist in the ODBC.ini file.
• The remote data source must be accessible from your the network.

Context

The connection properties depend on your adapter type and connection mode.

Smart Data Access Connection Properties

Connection Properties Description

Data Source Name The DSN as defined in the odbc.ini file.

Configuration File • For SAP Event Stream Processor and SAP Streaming Analytics, specify
property_esp.ini.
• For SAP MaxDB, specify property_maxdb.ini.
• For SQL Server, specify property_mss.ini.
• For IBM DB2, specify property_db2.ini.
• For Oracle, specify property_orcl.ini.
• For IBM Netezza, specify property_db2.ini.
• For Google BigQuery, specify property_bq.ini.

Driver The library name containing the driver for the specified adapter.

SAP HANA Database Explorer


56 PUBLIC Importing, Exporting, and Accessing Data
Connection Properties Description

Server/ServerNode The SAP HANA server. For failover, list the failover server name, separated by a comma. For exam­
ple, server_name1:30015,failover_server_name1:30015.

Port The server port number.

Authentication Mode An optional Rserve authentication mode.

SSL mode Specifies whether to use SSL. Specify use SSL or no SSL.

Database Name The name of the database you are creating the remote source for.

DML Mode Specifies if the remote source is readwrite (default), or readonly.

Extra Adapter Proper­ Additional connection properties. Choose one of the following:
ties
SAP (Session Connection Information Only)
HANA
sessionVariable:<session_variable_name>=?

SAP Specify the additional properties to complete the remote connection as follows:
IQ
ServerName=<iq_computer_name>;CommLinks=tcpip(host=<IQ_host>;port=<IQ_por

For example, the additional properties to connect to the demo database would be:

ServerName=<iq_machine_name>_iqdemo;

CommLinks=tcpip(host=<iq_machine_name>;port=2638)

SAP (For failover only) Enables automatic failover for the remote source. Enter:
ASE
HASession=1;AlternateServers=<failover_server>:<failover_port_number>

Smart Data Integration Connection Properties

Connection Properties Description

Application Server The server of the application.

Client The name of the client.

Host The name of the computer where the client is located.

Instance Number The instance number of the client.

Port Number The port number of the computer where the client is located.

System Object Prefix The prefix for object names of the specified database system.

SAP HANA Database Explorer


Importing, Exporting, and Accessing Data PUBLIC 57
Procedure

1. In the SAP HANA database explorer, right-click the Remote Sources object in your database catalog and
click Add Remote Source.
2. Specify a remote source name, adapter name, and, optionally, a source location. The Source Location field
defaults to indexserver for SDA adapters, and dpserver for smart data integration.
3. Specify an adapter version and connection mode. Choose Data Source Name if you are using a DSN entry.
Otherwise, choose the default setting, Adapter Properties.
4. Fill in the other required connection property fields, which are marked with an *.
5. Specify one of the following credential modes (enter your user name and password as required):

Technical User All connections to the remote data source share the same credentials.

Secondary One set of credentials is used per data source.


Credentials
At least one set of secondary credentials should exist before creating the remote
source.

SSO Kereberos Single sign-on (SSO) with Kereberos is used to connect to the data source.

None No credentials are required to connect to the remote data source.

6. Click OK.

Related Information

Managing Secondary Credentials


Managing Single Sign-On (SSO) with Kerberos
Managing Single Sign-On (SSO) with Kerberos
SAP HANA Smart Data Access
Managing Virtual Tables

6.2 Edit a Remote Source

View the properties of a remote source and edit the parameters that were used to create the remote source.

Prerequisites

The remote data source must be accessible from your the network.

SAP HANA Database Explorer


58 PUBLIC Importing, Exporting, and Accessing Data
Procedure

1. In your catalog browser, click Remote Sources to bring up an item list of your remote sources.
2. Click the remote source that you want to edit to open the remote source editor.
3. Click Edit and make the changes to your remote source properties.
4. Click Save.

The system saves the change and then tests the new connection properties. If the connection fails, then a
message appears. If defined, then all filters are reset and the remote object list is cleared.

Related Information

Managing Secondary Credentials


Managing Single Sign-On (SSO) with Kerberos
Managing Single Sign-On (SSO) with Kerberos
SAP HANA Smart Data Access
Managing Virtual Tables

6.3 Create Virtual Objects (Smart Data Access)

Create a virtual object from a remote source object.

Prerequisites

You must either be the creator of the remote source or have the CREATE VIRTUAL TABLE object privilege on
the remote source.

Procedure

1. In the catalog browser, click Remote Sources.

A list of remote sources appears in the catalog browser item list.


2. Click a remote source from the item list to open the remote source editor.
3. Use the Search functionality to return a set of remote objects that is displayed in the editor table as a flat
list.

Alternatively, you can display all remote objects of a specific type using the Type drop-down menu.

SAP HANA Database Explorer


Importing, Exporting, and Accessing Data PUBLIC 59
4. Select one or more remote object(s) and click Create Virtual Object(s).
5. Name your virtual object(s).

If you select only one remote object, then either use the default virtual object name or give it a new name. If
you select more than one remote object, then you can either leave the Object Names Prefix field blank so all
objects are created with their default names, or you can specify a prefix that is added to the name of the
new virtual objects.
6. Specify the schema to create the virtual object(s) in.
7. Click Create.

Results

You can view your new virtual object in the relevant catalog object list. For example, if you click on Functions,
you will see a list of all functions, including virtual functions in the catalog object list below. Virtual objects are
differentiated from other objects by the inclusion of a green highlight on their icon.

Related Information

Managing Secondary Credentials


Managing Single Sign-On (SSO) with Kerberos
Managing Single Sign-On (SSO) with Kerberos
SAP HANA Smart Data Access
Managing Virtual Tables

6.4 Create Virtual Objects (SAP HANA Smart Data


Integration)

Create a virtual object from a remote source object.

Prerequisites

You must either be the creator of the remote source or have the CREATE VIRTUAL TABLE object privilege on
the remote source.

SAP HANA Database Explorer


60 PUBLIC Importing, Exporting, and Accessing Data
Context

For more information about smart data integration, see SAP HANA Smart Data Integration and SAP HANA
Smart Data Quality .

Procedure

1. In the catalog browser, click Remote Sources.

A list of remote sources appears in the catalog browser item list.


2. Click a remote source from the item list to open the remote source editor.
3. Use the Search functionality to return a set of remote objects displayed in the editor as a flat list.

 Note

The search functionality is only enabled if a dictionary is created for a remote source. A dictionary is a
local copy of the objects in a remote source. Searching is performed only on dictionaries for
performance purposes.

Use the Dictionary section of your remote source editor to create, refresh, or clear your dictionary.

4. Select one or more remote object(s) and click Create Virtual Object(s).
5. Name your virtual object(s).

If you select only one remote object, then either use the default virtual object name or give it a new name. If
you select more than one remote object, then you can either leave the Object Names Prefix field blank so all
objects are created with their default names, or you can specify a prefix that is added to the name of the
new virtual objects.
6. Specify the schema to create the virtual object(s) in.
7. Click Create.

6.5 Import Schemas, Tables, and Other Catalog Objects

Import catalog objects, including schemas, into your database by using the SAP HANA database explorer.

Prerequisites

• Import data must be compressed in .tar.gz format, which is provided during the database explorer
export. Data exported by the SAP HANA studio must be compressed to .tar.gz before it can be
imported.
• The database objects being imported must have been exported by using the export feature in the database
explorer.

SAP HANA Database Explorer


Importing, Exporting, and Accessing Data PUBLIC 61
• In the destination database you must have the INSERT/UPDATE, DROP, or CREATE object privileges for the
destination catalog objects and you must have the IMPORT system privilege.
By default, these privileges are not granted to an HDI container user; they must be granted.
• If you are importing binary files, then those files must have been generated on an SAP HANA system that
has the same endianness as the destination system.

Context

You cannot import a database object larger than 2 GB. If you are importing a database object larger than 1 GB,
then import the object to the SAP HANA computer rather than to the local computer.

An import operation can only contain objects from a single database.

Procedure

1. In the SAP HANA database explorer, right-click the schema that you want to import the objects to, and
choose Import Catalog Objects.
2. Specify where you're importing the file from. You have the following options:
• Local Computer
• SAP HANA Server
• Amazon S3 (if supported by your database)
• Azure (if supported by your database)
3. Specify the filepath for the object you want to import.

 Note

For Amazon S3 and Azure you have the option of either manually providing the filepath or editing the
region (Amazon S3) and path. Clicking the Edit button allows you to enter the path components
separately. The components vary depending on the source. After entering the components and clicking
OK, the path components are composed into the path string and populate the S3 Path or Azure Path
input box on the main dialog.

Once you've provided the filepath, click Load to view all the catalog objects from the specified import
file.

You can repeat the above operation to import multiple catalog objects.

4. Specify the scope of the import by choosing the relevant options:

Option Description

Include Dependent objects of the selected objects are also imported. For example, if a table has any trig­
dependencies gers or indexes associated with it, then these definitions are imported.

Include object data Import the table data along with the table definitions.

If you deselect this option, then only the table definitions are imported.

SAP HANA Database Explorer


62 PUBLIC Importing, Exporting, and Accessing Data
Option Description

Replace existing If objects with the same names already exist in the destination database, then they are overwrit­
objects ten by the objects being imported.

Fail import if it If you are including object data when importing a catalog object, then selecting this checkbox
contains invalid data ensures that your import is canceled if any of the object data is incomplete or corrupt.

Number of Parallel Increasing the number of threads can speed up the import and affect database performance.
Threads Consider the following guidelines when choosing the number of threads to use:

• For a view or procedure, use two or more threads, up to the number of dependent objects.
• For a whole schema, consider using more than ten threads, up to the number of CPU cores
in the system.
• For an SAP BW or SAP ERP system with tens of thousands of tables, using many threads is
reasonable (up to 256).

5. Click Import.

Results

The catalog objects are imported. The length of time that the export process takes depends on the number of
objects being imported and the scope of the import.

You can monitor the progress of a running import with the M_IMPORT_BINARY_STATUS monitoring view.

Related Information

Permissions for Container Objects


Roles (.hdbrole)
Export Schemas, Tables, and Other Catalog Objects [page 68]
IMPORT Statement (Data Import Export)
M_IMPORT_BINARY_STATUS System View
Import ESRI Shapefiles Using SQL Commands

6.6 Import Data Into a New or Existing Table

Import data from your local system into a new or existing database table.

Prerequisites

You cannot import CSV files larger than 200 MB.

SAP HANA Database Explorer


Importing, Exporting, and Accessing Data PUBLIC 63
The file content must follow the data type format supported by SAP HANA as documented in the SAP HANA
SQL and System Views Reference guide.

Context

Unlike using the IMPORT statement, which only allows you to import data if you are creating or replacing a
table, this feature allows you to add rows of data to an existing table.

Procedure

1. Right-click one of the following catalog objects to open the context menu:
• Your database
• Your database's Tables icon
• The table you are importing data into
2. In the context menu, click Import Data.
3. Choose one of the following import types and complete the corresponding actions:

Option Action

Import Data
1. Import Source
Choose one of the following import sources:

Local If you want to remove whitespace


from the beginning and end of your
data string, then leave Trim
whitespace checked by default. If
not, then un-check the box.

You can enter a custom CSV


separator in the Field Delimiter field.

Amazon S3, Enter the respective region or path


Azure for the external source you select.
Storage,
Alibaba Cloud
OSS, or
Google Cloud
Storage

 Note
If the first row of your file contains a header, then
leave File has header in first row checked by

SAP HANA Database Explorer


64 PUBLIC Importing, Exporting, and Accessing Data
Option Action

default. If the first row of your file contains data,


then un-check the box. Please note that if you
un-check the box, then the first row of your file is
considered data content and must contain data
in every column.

2. Import Target
Whether you are creating a new table or adding data
to an existing table, you must choose an existing
schema to import data into.

 Note
If you are importing into an HDI container or an
Application Managed Service Instance, then you
can only import your data into an existing table.

If you are importing into an SAP HANA single or


multitenant database, then you can import your
data into a new table or add data to an existing
table.

3. Table Mapping
If you are creating a new table, then specify your
table type, column names, and properties. Some
properties such as Data Type and Length are set to
default values, but you can modify them according to
your preferences.
If you are importing data into an existing table, then
configure the source column names for the target
columns.
If source column names are not provided in the CSV
file, the system will automatically populate the
Source Column Name fields in the order of the values
in the dropdown list. You can modify these names by
selecting new values from the dropdown list.

 Note
When dragging a column into the table, you
must drag it either directly above or below
another column.

4. Import Options
If you are importing from an external source and
have selected CSV as the File Format, then you must
set up additional options such as an escape
character, the number of parallel threads, and date
and time formats. Most of these options are set to

SAP HANA Database Explorer


Importing, Exporting, and Accessing Data PUBLIC 65
Option Action

default values, but you can enter custom values


according to your preferences.
5. Error Handling
Choose how you want the system to proceed if it
detects errors.
If you are importing data from a local source, click
Review to view an Import Summary.
If you are importing data from an external source:
• Fail import if it contains invalid data is checked
by default.
• You can select the Enable Error Logging
checkbox to create a file containing information
about records that failed to import.

Import ESRI Shapefiles 1. Import Source


Shapefiles can be imported from the following
sources:
• Local: shapefiles must be in .tar.gz file
format.

 Note
When creating your tar.gz file, select
individual files rather than the parent
directory to avoid inadvertently including
hidden directories in your import file.

• Amazon S3
• Azure Storage
• Alibaba Cloud OSS
• Google Cloud Storage
2. Import Target
If you are importing shape files, then you can create
a new schema to import the files into, or import
them into an existing schema.
3. Import Options
Specifying the SRID automatically sets the Spatial
Reference System Name.

 Note
If you do not specify, the default SRID will be
used.

For more information about SRIDs and spatial


reference system names, see the Spatial Reference

SAP HANA Database Explorer


66 PUBLIC Importing, Exporting, and Accessing Data
Option Action

Systems (SRS) and Spatial Reference Identifiers


(SRID) topic in the Related Links section below.

4. Click Import Into Database, if importing from a local source, or click Import, if importing shape files.

Results

The data is imported into the specified table. You can press Cancel at any time to roll back the import
operation. If you are importing data from a local source, then you can view the import progress on the Import
Status page.

Related Information

Spatial Reference Systems (SRS) and Spatial Reference Identifiers (SRID)

6.7 Import HDI Containers

Import an HDI container from a local computer.

Prerequisites

You must have the HDI Container Group Administrator permission for at least one container group in the
database.

The HDI container cannot contain tables bigger than 2 GB.

Context

tbd

SAP HANA Database Explorer


Importing, Exporting, and Accessing Data PUBLIC 67
Procedure

1. Right-click your database and click Import HDI Container.


2. Select a .tar.gz file from your local computer to import and click Upload File.
3. Confirm that you want to upload the file to a staging table by clicking Upload.

You can view the upload progress in the Import HDI Container tab.
4. Once the file has completed uploading to a staging table, give it a new HDI container name and assign it to
an HDI container group.
5. Click Import HDI Container and then Import, to confirm the process.

The import operation runs as a background activity.


6. Once the import activity shows the status SUCCESS, your import process has successfully completed and
you can delete the background activity.
7. Delete the background activity and (optionally) the staging table.

Staging tables are saved in your database and are named according to the
format: .SAP.HRTT.ImportHDI.<timestamp>.
a. Right-click the import background activity and click Delete.
b. Select whether to delete just the background activity, or the background activity and the staging table.

Keeping the staging table allows you to reuse it for future imports.

Results

The new container has been imported into the database successfully.

6.8 Export Schemas, Tables, and Other Catalog Objects

Export catalog objects, including schemas, from your database by using the SAP HANA database explorer.

Prerequisites

• You must have the SELECT privilege for the catalog objects that you want to export.
• You must have the EXPORT system privilege.

Context

An export operation can only contain objects from a single database.

SAP HANA Database Explorer


68 PUBLIC Importing, Exporting, and Accessing Data
Procedure

1. In the catalog browser, right-click the object that you want to export, and then choose Export Catalog
Objects.
2. Specify a file name for the object being exported and choose where to export the object to. You have the
following options:
• Local Computer
• SAP HANA Server
• Amazon S3 (if supported by your database)
• Azure (if supported by your database)

Option Description

Local Choose this option to save the export as a compressed file to a directory on your local machine.
Computer
To avoid sending large amounts of data across the network, do not use this option when exporting large
amounts of table data. Instead choose to export to the same computer as the SAP HANA server. An ex­
port (as well as an import) will fail if the resulting compressed file is larger than 2GB.

The contents of the compressed file are not encrypted, so do not use this option if your local machine is
not secure.

SAP HANA Choose this option to save the export to a directory in the database server's file system.
Server
If you specify a different directory from the default, then:

• The directory path must exist.


• The directory path cannot contain symbolic links.
• When the database is part of a distributed system, specify a directory on a shared disk.
• You can specify the backup or the work directory of the database instance, but you cannot specify
any another database instance directory. For example, if the database instance is located in
the /usr/sap/HDB/HDB00 directory, then you could specify: /usr/sap/HDB/HDB00/
backup or /usr/sap/HDB/HDB00/work as a directory for the export.

The contents of the export are not encrypted.

Amazon S3 Choose this option to export the database objects to an Amazon S3 directory.

You can either provide the filepath manually, or click Edit to formulate a filepath by providing individual
component values. The components vary depending on the source.

Include the file extension .tar.gz or .tgz on <archive_file_name> to export the data to an archive file.
Each file added to the archive file must not exceed 8 GB in size or it will become corrupt. There is no size
restriction on the archive file itself.

Azure Choose this option to export the database objects to an Azure directory.

You can either provide the filepath manually, or click Edit to formulate a filepath by providing individual
component values. The components vary depending on the source.

Include the file extension .tar.gz or .tgz on <archive_file_name> to export the data to an archive file.
Each file added to the archive file must not exceed 8 GB in size or it will become corrupt. There is no size
restriction on the archive file itself.

SAP HANA Database Explorer


Importing, Exporting, and Accessing Data PUBLIC 69
3. Specify the scope of the export with the following options:

Export option Description

Include Select this option to export the objects as well as any objects that depend on them. For example,
dependencies if a table has any triggers or indexes associated with it, then their definitions are exported.

Include object data When exporting tables, select this option to export the data, in addition to the definitions.

Clear this option to export only the table object definitions.

Replace existing When exporting tables, select this option to replace existing tables with exported tables of the
exported tables same name.

Number of Parallel Increasing the number of threads can speed up the export and affect database performance.
Threads Consider the following guidelines when choosing the number of threads to use:

• For a view or procedure, use two or more threads, up to the number of dependent objects.
• For a whole schema, consider using more than ten threads, up to the number of CPU cores
in the system.
• For an SAP BW or SAP ERP system with tens of thousands of tables, using many threads is
reasonable (up to 256).

Export Format Specify the format to use when exporting tables:

• Choose CSV when you are exporting row-store tables or when you must read the contents of
the export.
• Choose Binary to speed up the export time when you are exporting column-store tables.

Advanced Options Choose whether to include the following:

• Statistics objects
• Statistic object data

4. Click Export.

Results

The catalog objects are exported to the specified location. The length of time that the export process takes
depends on number of objects being exported and the scope of the export.

Monitor the progress of a running export by using the M_EXPORT_BINARY_STATUS monitoring view.

Related Information

EXPORT Statement (Data Import Export)


Import Schemas, Tables, and Other Catalog Objects [page 61]
M_EXPORT_BINARY_STATUS System View

SAP HANA Database Explorer


70 PUBLIC Importing, Exporting, and Accessing Data
6.9 Export Data Into a File

Export data from an existing database table or view into a local or external file.

Prerequisites

The file content must follow the data type format supported by SAP HANA as documented in the SAP HANA
SQL Reference Guide for SAP HANA Platform.

You must be connected to an SAP HANA database.

Procedure

1. Right-click any of the following catalog objects:


• Your database
• Your database's Tables icon
• The table you want to export the data to
• Your database's Views icon
• The view you want to export the data to.
• Your database's JSON Collections icon
2. In the context menu, click Export Data.

The export wizard opens.


3. Configure your Export Source by selecting the Schema and Table/View controls.
4. Click Step 2 to configure your Export Target and choose one of the following sources to export your data to:
• Amazon S3
• Enter an S3 Region, and enter or compose an S3 Path.
• Azure Storage
• Enter or compose an Azure Path.
• Alibaba Cloud OSS
• Enter an OSS Region, and enter or compose an OSS Path.
• Google Cloud Storage
• Compose a GCS path.
5. Click Step 3 to configure your Export Options.
• (Optional) Select the Use column names as first row in file check box.
• For the Record Delimiter, enter a custom value or select one of the following options: Newline or
Newline+Carriage.
• For the Field Delimiter, enter a custom value or select one of the following options: Tab, Semicolon,
Comma, or Space.
• For the Escape Character, enter a custom value or use the Backslash option.

SAP HANA Database Explorer


Importing, Exporting, and Accessing Data PUBLIC 71
• (Optional) Select the Field Enclosure check box. Either enter a custom value or select one of the
following options: Single quote or Double quote.
• Enter a numeric value for the Number of Parallel Threads or retain the default value of 1.
6. Click Export.

Results

The data is exported into the specified table.

6.10 Export HDI Containers

Export an HDI container as a local file.

Prerequisites

You must have the HDI Container Group Administrator permission for at least one container group in the
database.

The HDI container cannot contain tables bigger than 2 GB.

Context

Exporting an HDI container requires two steps:

Preparing the HDI container for Saves the HDI container contents to a staging table. This staging table
download is created in your default schema.

Downloading the HDI container as a Downloads the contents of the staging table to your local machine as a
file tar.gz file.

Procedure

1. Prepare the HDI container for download.


a. Right-click the database and click Export HDI Container.
b. On the Export HDI Container tab, pick the HDI container you want to export and click Prepare HDI
Container for Download.

SAP HANA Database Explorer


72 PUBLIC Importing, Exporting, and Accessing Data
c. Click Prepare to confirm the HDI container that you want to export.
2. Download the HDI container as a local file.
a. Double-click the "Prepare HDI Container" background activity and click Download.

The HDI container is downloaded as a tar.gz file.


3. Delete the background activity and (optionally) the staging table.

Staging tables are saved in your database and are named according to the
format: .SAP.HRTT.ExportHDI.<timestamp>.

a. Right-click the "Prepare HDI Container" background activity and click Delete.
b. Select whether to delete just the background activity, or the background activity and the staging table.

Keeping the staging table allows you to reuse it for future imports using the SQL console.

Results

Your HDI container has been successfully downloaded to your computer's default download folder

6.11 Deleting Tables and Data

Learn how to remove data from tables in your instances using SAP HANA database explorer.

Prerequisites

You must be a user of the database that you want to explore and have the required privileges to view the
catalog items. In order to complete certain operations, you may need to be the owner of the table.

Context

There are three main methods used to remove data from tables. Depending on your needs and the setup of
your instance, you can choose between dropping, deleting, or truncating data from your table.

Procedure

1. In the catalog browser, click the database you wish to explore.


2. In the Catalog folder, click Tables to display all the tables in your database.

SAP HANA Database Explorer


Importing, Exporting, and Accessing Data PUBLIC 73
3. Right-click on your table and click Delete in the context menu.
4. In the Delete dialog, select one of the following options.

Option Description

Drop the table if no other objects depend on it Completely delete the table, including the following:
• Table structure
• Table contents
• Indexes
• Privileges

Drop the table and any other objects that depend on it Completely delete the table and all of its dependent ob­
jects, including the following:
• Table structure
• Table contents
• Indexes
• Privileges

Delete all rows from the table Delete only the content of the table.

Table structure, indexes, and privileges remain intact.

Truncate the table Delete only the content of the table. Data deleted by click­
ing Truncate the table is not logged in any way, making it
faster and more resource efficient than clicking Delete all
rows from the table.

Table structure, indexes, and privileges remain intact.

 Note
The truncate option can only be used if there are no
dependencies on the table's contents.

5. Click Delete.

Related Information

Open Catalog Objects [page 6]


DROP TABLE Statement (Data Definition)
DELETE Statement (Data Manipulation)
TRUNCATE TABLE Statement (Data Manipulation)

SAP HANA Database Explorer


74 PUBLIC Importing, Exporting, and Accessing Data
7 Important Disclaimer for Features in SAP
HANA

For information about the capabilities available for your license and installation scenario, refer to the Feature
Scope Description for SAP HANA.

SAP HANA Database Explorer


Important Disclaimer for Features in SAP HANA PUBLIC 75
Important Disclaimers and Legal Information

Hyperlinks
Some links are classified by an icon and/or a mouseover text. These links provide additional information.
About the icons:

• Links with the icon : You are entering a Web site that is not hosted by SAP. By using such links, you agree (unless expressly stated otherwise in your
agreements with SAP) to this:

• The content of the linked-to site is not SAP documentation. You may not infer any product claims against SAP based on this information.

• SAP does not agree or disagree with the content on the linked-to site, nor does SAP warrant the availability and correctness. SAP shall not be liable for any
damages caused by the use of such content unless damages have been caused by SAP's gross negligence or willful misconduct.

• Links with the icon : You are leaving the documentation for that particular SAP product or service and are entering a SAP-hosted Web site. By using such
links, you agree that (unless expressly stated otherwise in your agreements with SAP) you may not infer any product claims against SAP based on this
information.

Videos Hosted on External Platforms


Some videos may point to third-party video hosting platforms. SAP cannot guarantee the future availability of videos stored on these platforms. Furthermore, any
advertisements or other content hosted on these platforms (for example, suggested videos or by navigating to other videos hosted on the same site), are not within
the control or responsibility of SAP.

Beta and Other Experimental Features


Experimental features are not part of the officially delivered scope that SAP guarantees for future releases. This means that experimental features may be changed by
SAP at any time for any reason without notice. Experimental features are not for productive use. You may not demonstrate, test, examine, evaluate or otherwise use
the experimental features in a live operating environment or with data that has not been sufficiently backed up.
The purpose of experimental features is to get feedback early on, allowing customers and partners to influence the future product accordingly. By providing your
feedback (e.g. in the SAP Community), you accept that intellectual property rights of the contributions or derivative works shall remain the exclusive property of SAP.

Example Code
Any software coding and/or code snippets are examples. They are not for productive use. The example code is only intended to better explain and visualize the syntax
and phrasing rules. SAP does not warrant the correctness and completeness of the example code. SAP shall not be liable for errors or damages caused by the use of
example code unless damages have been caused by SAP's gross negligence or willful misconduct.

Bias-Free Language
SAP supports a culture of diversity and inclusion. Whenever possible, we use unbiased language in our documentation to refer to people of all cultures, ethnicities,
genders, and abilities.

SAP HANA Database Explorer


76 PUBLIC Important Disclaimers and Legal Information
SAP HANA Database Explorer
Important Disclaimers and Legal Information PUBLIC 77
www.sap.com/contactsap

© 2022 SAP SE or an SAP affiliate company. All rights reserved.

No part of this publication may be reproduced or transmitted in any form


or for any purpose without the express permission of SAP SE or an SAP
affiliate company. The information contained herein may be changed
without prior notice.

Some software products marketed by SAP SE and its distributors


contain proprietary software components of other software vendors.
National product specifications may vary.

These materials are provided by SAP SE or an SAP affiliate company for


informational purposes only, without representation or warranty of any
kind, and SAP or its affiliated companies shall not be liable for errors or
omissions with respect to the materials. The only warranties for SAP or
SAP affiliate company products and services are those that are set forth
in the express warranty statements accompanying such products and
services, if any. Nothing herein should be construed as constituting an
additional warranty.

SAP and other SAP products and services mentioned herein as well as
their respective logos are trademarks or registered trademarks of SAP
SE (or an SAP affiliate company) in Germany and other countries. All
other product and service names mentioned are the trademarks of their
respective companies.

Please see https://www.sap.com/about/legal/trademark.html for


additional trademark information and notices.

THE BEST RUN

You might also like