Automate Your Oracle Session Initialization with KeepTool

Published 07. February 2017

Updated October 2025


Introduction

When working with Oracle databases, it is often necessary to set session parameters right at the start — especially the NLS settings.
These parameters determine how data is formatted, displayed, and interpreted.

Normally, the Oracle Client performs this initialization automatically by reading values from the operating system’s registry variables.
However, when working in direct TCP/IP mode, this automatic initialization is missing — the session then starts with Oracle’s default values.

To ensure your environment is still configured correctly, KeepTool provides an option in the connect dialog to define an initialization script.
This script is executed automatically each time a new connection is established, ensuring that your preferred NLS parameters are active right from the beginning.


Why Session Initialization Matters

The NLS parameters (National Language Support) affect the following aspects of your Oracle session:

  • Date and time formats (e.g., DD.MM.YYYY)

  • Decimal and thousand separators

  • Character sets and sorting orders

  • Language and locale settings (e.g., NLS_LANGUAGE, NLS_TERRITORY)

If these parameters are not set consistently, issues can easily occur — such as misinterpreted date values, incorrect decimal separators, or differing sort orders.
These inconsistencies can be difficult to trace, especially in more complex applications or scripts.


Difference Between Oracle Client and Direct TCP/IP Connection

When using the Oracle Client, the NLS parameters are automatically taken from the Windows registry when the connection is established.
This means that the session starts with the predefined settings, without requiring any additional commands.

In direct TCP/IP mode, however, no such initialization takes place.
The connection is established independently of the Oracle Client, and therefore the NLS parameters are not read from the registry.
As a result, your session starts with Oracle’s default values, which may not match your usual regional format.

Initialization Script Setting in the Connect Dialog

Initialization Script Setting in the Connect Dialog

This is where KeepTool provides a solution:
In the expandable section of the connect dialog, you can define an initialization script that will be executed automatically after the connection is established.

Sample Initialization Script

Sample Initialization Script

This ensures that your preferred NLS parameters and other session variables are always set correctly — regardless of which connection method you use.


Automatic Execution During Connection

As soon as you connect to your database, Hora automatically executes the stored initialization script.
All ALTER SESSION commands defined in the script are executed sequentially, ensuring that your session immediately runs with the desired parameters.

System Tray Notification

System Tray Notification

If you later wish to adjust additional session parameters, you can edit the script directly in the connect dialog — for example, to include extra environment variables or optimizer settings.

This way, you always maintain full control over your session initialization, regardless of whether you are using the Oracle Client or direct TCP/IP mode.


Advantages of the Initialization Script

Using an initialization script offers several practical benefits:

  • Consistency: All connections start with identical NLS parameters.

  • Reliability: Incorrect formats or separators are avoided.

  • Automation: No manual adjustment of session parameters is required.

  • Flexibility: Easily adaptable for different users or environments.


Conclusion

Automatic session initialization is an important part of a stable Oracle environment.
While the Oracle Client automatically applies parameters from the registry, KeepTool Hora ensures a consistent environment even in direct TCP/IP mode.

The initialization script in the connect dialog provides the simplest solution:
It is executed automatically when a connection is established and reliably sets all desired NLS parameters or other session options.


➡️ Try KeepTool for free

KeepTool's Oracle tools are designed specifically for developers, DBAs, and support teams.
Based on over 25 years of experience, we continuously optimize our software to make your database analysis and documentation faster, more efficient, and clearer.