Pages

Tuesday, June 16, 2026

Unexpected Error: ORA-02054: transaction 94.44.4071354 in-doubt

Scenario
A transaction on a local and on a remote database fails at commit
The error:
Unexpected Error: ORA-02054: transaction 94.44.4071354 in-doubt

To see real error, check alert.log on the remote server.
The actual error is not propagated to the local server
Error 2091 trapped in 2PC on transaction 94.44.4071354. Cleaning up.
Error stack returned to user:
ORA-02054: transaction 94.44.4071354 in-doubt
ORA-02091: transaction rolled back
ORA-00001: unique constraint (USER_A.TABLE_A_UK) violated
ORA-02063: preceding 2 lines from REMOTE_DB

Sunday, June 7, 2026

Oracle Obsolete Parameters

ORA_NLS32 vs ORA_NLS33 vs ORA_NLS10
ORA_NLS33 and ORA_NLS10 are Oracle environment variables used to locate National Language Support (NLS) files, which dictate how the database handles locales, character sets, and linguistic sorting.

ORA_NLS32
Used for Oracle versions 7.3.x.

ORA_NLS33
Was used for Oracle versions Oracle 8, 8i, and 9i.
It typically points to $ORACLE_HOME/ocommon/nls/admin/data directory

ORA_NLS10
Used for Oracle 10g and later. 
It typically points to $ORACLE_HOME/nls/data directory

Deprecation
In Oracle 10g and newer, Oracle embeds the NLS path automatically. 
Setting ORA_NLS or ORA_NLS33 is often unnecessary unless you are running legacy 9i applications on a newer client.

If an older client is required to connect to a newer database, you can sometimes set ORA_NLS10 to point to older 9i data files 
to preserve backward-compatible definitions

ORACLE_LPPROG and ORACLE_LPARGS
These are legacy Oracle environment variable used on UNIX and Linux operating systems to specify the name or path of the system's line printer spooler utility (LPR).

ORACLE_LPPROG
Defines the command executable itself. 
By default, Oracle assumes standard UNIX printing utilities like lp or lpr.

ORACLE_LPARGS
Acts as its companion variable, used to define the command-line arguments or flags passed to that printer program.

ORA-07222
If Oracle tries to print directly from an application and fails due to misconfigured variables, 
it will return the operating system-specific error ORA-07222: slspool: line printer spooler command exited with an error. 
To resolve that error, one would need to set ORACLE_LPPROG and ORACLE_LPARG properly.

Modern Enterprise
In Modern Enterprise reporting and printing are now handled via middle-tier application servers 
rather than spawning command-line lpr processes straight out of the database instance or local terminal profile.
Making these variables obsolete.


ORACLE_TERM
ORACLE_TERM is a legacy Oracle environment variable used to define the terminal type for character-mode Oracle tools, 
such as SQL*Plus, Oracle Forms , and Oracle Menu.
It is obsolete as of Oracle 10g.
It tells Oracle how to interpret keystrokes and map functional keyboard shortcuts inside a text-based, terminal-oriented interface.
Key Mapping: It points Oracle to a specific keyboard definition file (a .res or resource file).
Display Layout: It ensures that text-based boxes, lines, and colors render correctly in a command-line terminal window.
Compatibility: It translates hardware terminal signals (like an old VT100 physical terminal or an xterm window) into commands Oracle utilities understand.

ORACLE_TERM vs TERM
The TERM OS variable tells the Linux/UNIX shell how to draw the terminal screen.
ORACLE_TERM tells the Oracle application how to translate your keyboard inputs into database utility commands.

Sunday, May 31, 2026

Golden gate Error - ERROR OGG-08048 Failed to initialize timezone information.

Golden gate on Oracle Extract fails to start with these errors

==================
Errors
==================
2026-05-27 15:33:32  ERROR   OGG-02022  Logmining server does not exist on this Oracle database.
2026-05-27 15:33:32  ERROR   OGG-01668  PROCESS ABENDING.
2026-05-27 15:40:43  ERROR   OGG-00303  Unable to connect to database using user ogg. Ensure that the necessary privileges are granted to the user.
2026-05-27T15:47:38.869+0000  ERROR   OGG-01668  Oracle GoldenGate Delivery for Oracle, rep_i_01.prm:  PROCESS ABENDING.
2026-05-27T15:47:38.879+0000  ERROR   OGG-02615  Oracle GoldenGate Delivery for Oracle, rep_s_01.prm:  Login to the database as user ogg failed because of error Error while trying to retrieve text for error ORA-01804.
2026-05-27T15:47:38.879+0000  ERROR   OGG-08048  Oracle GoldenGate Delivery for Oracle, rep_s_01.prm:  Failed to initialize timezone information. Check location of ORACLE_HOME.
2026-05-27T15:47:38.879+0000  ERROR   OGG-00664  Oracle GoldenGate Delivery for Oracle, rep_s_01.prm:  OCI Error ORA (status = 1804-Error while trying to retrieve text for error ORA-01804).
                              
==================
What to check
==================
1. Check LD_LIBRARY_PATH
ORACLE_HOME should be in the path
echo $LD_LIBRARY_PATH
/software/oracle/19c/lib:/lib:/usr/lib

2.Check PATH
ORACLE_HOME should be in the path
echo $PATH
/software/oracle/oracle/.local/bin:/software/oracle/oracle/bin:/usr/sbin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/software/oracle/19c/bin:/software/oracle/oracle/bin

3.Check prm files of the extract
EXTRACT ext_i_01

setenv (ORACLE_SID="orainst")
setenv (ORACLE_HOME="/software/oracle/122")  <=== Should be 19c!!

==================
How to fix
==================

1. Edit all the parameter files for the exatract processes.
2. Restart Extract processes.

Thursday, May 28, 2026

Golden Gate - old files are not purged

Issue
Old transaction files are not purged from server.
/software/ogg/191/dirdat/01/in
/software/ogg/191/dirdat/01/out

Evidences
When checking mgr.prm:

dirprm/mgr.prm
PORT 7809
SYSLOG NONE

AUTOSTART EXTRACT *
AUTOSTART REPLICAT *
AUTORESTART EXTRACT *, RETRIES 5, WAITMINUTES 2, RESETMINUTES 60
AUTORESTART REPLICAT *, RETRIES 5, WAITMINUTES 2, RESETMINUTES 60

DOWNREPORTMINUTES 5
LAGCRITICALMINUTES 5

purgeoldextracts /software/ogg/191/dirdat/01/in/*, USECHECKPOINTS, MINKEEPHOURS 2
purgeoldextracts /software/ogg/191/dirdat/01/out/*, USECHECKPOINTS, MINKEEPHOURS 4

But when checking in MGR.rpt, there is no evidence of these parameters

Parameters...
PORT 7809
***********************************************************************
**                     Run Time Messages                            **
*********************************************************************

Seems the parameters file was not loaded correctly.

Reason
Unknown

How to fix

%> ggsci
GGSCI (ITMIL7DB00001) 1>  REFRESH MANAGER

Sending REFRESH request to MANAGER ...
Mgr Params Updated

less MGR.rpt

PORT 7809
SYSLOG NONE

AUTOSTART EXTRACT *
AUTOSTART REPLICAT *
AUTORESTART EXTRACT *, RETRIES 5, WAITMINUTES 2, RESETMINUTES 60
AUTORESTART REPLICAT *, RETRIES 5, WAITMINUTES 2, RESETMINUTES 60

DOWNREPORTMINUTES 5
LAGCRITICALMINUTES 5

purgeoldextracts /software/ogg/191/dirdat/*/in/*, USECHECKPOINTS, MINKEEPHOURS 2
purgeoldextracts /software/ogg/191/dirdat/*/out/*, USECHECKPOINTS, MINKEEPHOURS  4


Now, old files are getting purged
2026-05-28 14:47:16  INFO    OGG-00957  Purged old extract file '/software/ogg/191/dirdat/01/in/es000000022', applying UseCheckPoints purge rule: Oldest Chkpt Seqno 30 > 22.

2026-05-28 14:47:16  INFO    OGG-00957  Purged old extract file '/software/ogg/191/dirdat/01/in/es000000023', applying UseCheckPoints purge rule: Oldest Chkpt Seqno 30 > 23.

2026-05-28 14:47:16  INFO    OGG-00957  Purged old extract file '/software/ogg/191/dirdat/01/in/es000000024', applying UseCheckPoints purge rule: Oldest Chkpt Seqno 30 > 24.

2026-05-28 14:47:16  INFO    OGG-00957  Purged old extract file '/software/ogg/191/dirdat/01/in/es000000025', applying UseCheckPoints purge rule: Oldest Chkpt Seqno 30 > 25.

2026-05-28 14:47:17  INFO    OGG-00957  Purged old extract file '/software/ogg/191/dirdat/01/in/es000000026', applying UseCheckPoints purge rule: Oldest Chkpt Seqno 30 > 26.

Tuesday, May 19, 2026

Datapump is not starting. WARNING OGG-01221 Connect failed to 10.10.51.38:7819, error 111:Connection refused.

Datapump is not starting
OGG Report showing:
WARNING OGG-01221  Connect failed to 10.20.30.40:7819, error 111:Connection refused.

What to check
=====================
Site A
=====================
oracle@qa-1-dbs-1b>% lsof -i TCP | grep 7819

extract    6917 oracle   17u  IPv4 4553207      0t0  TCP qa-1-dbs-1b:30163->qa-2-dbs-01:7819 (ESTABLISHED)
server    19087 oracle    6u  IPv4 4535342      0t0  TCP *:7819 (LISTEN)
server    19087 oracle   14u  IPv4 4533293      0t0  TCP qa-1-ora-01:7819->qa-2-dbs-01:51406 (ESTABLISHED)

oracle@qa-1-dbs-1b>% lsof -i TCP | grep 51406

server    19087 oracle   14u  IPv4 4533293      0t0  TCP qa-1-ora-01:7819->qa-2-dbs-01:51406 (ESTABLISHED)

oracle@qa-1-dbs-1b>% ps -ef | grep 
19087
oracle   19087 15558  0 19:46 ?        00:00:01 ./server -w 300 -p 7819-12818 -m 7809 -k -l /software/ogg/191/ggserr.log

oracle@qa-1-dbs-1b>% ps -ef | grep 
6917
oracle    6917 15558  0 19:52 ?        00:00:00 /software/ogg/191/extract PARAMFILE /software/ogg/191/dirprm/dpm_i_01.prm REPORTFILE /software/ogg/191/dirrpt/DPM_I_01.rpt PROCESSID DPM_I_01
oracle    7124  6917  0 19:52 ?        00:00:00 oracleigt (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

=====================
Site B
=====================
oracle@qa-2-dbs-01>% lsof -i TCP | grep 7819

extract   70353 oracle   17u  IPv4 1204012      0t0  TCP qa-2-dbs-01:51406->qa-1-ora-01:7819 (ESTABLISHED)
server    70832 oracle    6u  IPv4 1208335      0t0  TCP *:7819 (LISTEN)
server    70832 oracle   14u  IPv4 1208369      0t0  TCP qa-2-dbs-01:7819->qa-1-dbs-1b:30163 (ESTABLISHED)

oracle@qa-2-dbs-01>% lsof -i TCP | grep 30163

server    70832 oracle   14u  IPv4 1208369      0t0  TCP qa-2-dbs-01:7819->qa-1-dbs-1b:30163 (ESTABLISHED)

oracle@qa-2-dbs-01>% ps -ef | grep 
70832
oracle     70832    2703  0 19:52 ?        00:00:00 ./server -w 300 -p 7819-12818 -m 7809 -k -l /software/ogg/191/ggserr.log

oracle@qa-2-dbs-01>% ps -ef | grep 
70353
oracle     70353    2703  0 19:46 ?        00:00:01 /software/ogg/191/extract PARAMFILE /software/ogg/191/dirprm/dpm_i_01.prm REPORTFILE /softwar/ogg/191/dirrpt/DPM_I_01.rpt PROCESSID DPM_I_01
oracle     70358   70353  0 19:46 ?        00:00:00 oracleigt (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

What to check
The server process is running with parameters:
./server -w 300 -p 7819-12818 -m 7809 -k -l /software/ogg/191/ggserr.log

oracle@qa-2-dbs-01>% ls -l /software/ogg/191/ggserr.log
-rw-r----- 1 oracle dba 3337659 May 19 20:01 /software/ogg/191/ggserr.log


File /software/ogg/191/ggserr.log must be owned by oracle, else the server process would not start.
Incase this file owner is root, without write permissions to user oracle, Golden Gate process cannot start, and it does not listen to incoming calls from the remote gate.

Solution
as root
chown oracle:dba /software/ogg/191/ggserr.log

Tuesday, May 12, 2026

Oracle Encryption - Encrypt data on storage with wallet

 --Specify location for wallet root
ALTER SYSTEM SET WALLET_ROOT='$ORACLE_BASE/admin/igt/wallet' SCOPE=SPFILE;

Restart Oracle is required here

SHUTDOWN IMMEDIATE;
STARTUP;

SHOW PARAMETER WALLET_ROOT

--Specify keystore type
ALTER SYSTEM SET TDE_CONFIGURATION="KEYSTORE_CONFIGURATION=FILE" SCOPE=BOTH;

SHOW PARAMETER TDE_CONFIGURATION
SELECT con_id, keystore_mode FROM V$ENCTYPTION_WALLET;

Auto-Login Keystore         - can be opened from a remote servers
Local Auto-Login Keystore   - can be opened from a local server
Password-Protected Keystore - can be opened only after providing a password


ADMINISTER KEY MANAGEMENT CREATE KEYSTORE IDENTIFIED BY Abcd@2026;

This will create an ewallet.p12 file under $ORACLE_BASE/admin/igt/wallet/TDE

SELECT wrl_type, wrl_parameter, status, con_id
FROM V$ENCTYPTION_WALLET;

At this point, password walled is closed
Need manually to open password protected keystore.

ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY Abcd@2026;

SELECT con_id, keystore_mode, status FROM V$ENCTYPTION_WALLET;

Status should be OPEN_NO_MASTER_KEY

Now, create Master Key
ADMINISTER KEY MANAGEMENT SET KEY IDENTIFIED BY Abcd@2026 WITH BACKUP;


SELECT masterkey_activated FROM V$DATABASE_KEY_INFO

Should be YES

Now, Alter key to be auatologin
ADMINISTER KEY MANAGEMENT CREATE auto_login keystore FROM KEYSTORE '$ORACLE_BASE/admin/igt/wallet/tde' IDENTIFIED BY Abcd@2026;

Configuration completed!

====================
How to use:
====================

====================
Encrypt Tablespace
====================
CREATE TABLESPACE IGT_ENC_TBS DATAFILE '/some/patn/to/datafile/encypted_tbs.dbf' SIZE 10M AUTOEXTEND ON MAXSIZE 10000M;
ALTER TABLESPACE IGT_ENC_TBS ENCRYPTIONONLINE ENCRYPT;

SELECT tablespace_name, status, encrypted FROM DBA_TABLESPACES;



Deafult Encryption is AES192. Salt and MAC are added by default

Salt - random string added before encryption. More strength to encryption. required additional 16 bytes for each encrypted data value. Cannot be used on indexed columns.

MAC  - Message Authentication Code. Used for Data Integrity checking. Adds additional 20 bytes for each encrypted data value.

Encrypt a column
CREATE TABLE TOKEN_USAGE 
(id          NUMBER,
 usage_name  VARCHAR2(100),
 usage_value NUMBER ENCRYPT;
);

ALTER TABLE TOKEN_USAGE ADD (CONSTRAINT TOKEN_USAGE_PK PRIMARY KEY  (id) USING INDEX TABLESPACE IGT_INDEX;

INSERT INTO TOKEN_USAGE (id, usage_name, usage_value) VALUES (1,'Usage Name',20);

Thursday, May 7, 2026

Oracle Encryption - encrypt data

Permissions on Oracle package DBMS_CRYPTO
========================================
GRANT EXECUTE ON DBMS_CRYPTO TO TEST_USER;
========================================

Create a wrapper package.
p_text - is the encrypted value
p_key - a key passed from application
The encrypted value - is stored in database instead of the real value
The key - should be stored outside of the database.
========================================
CREATE OR REPLACE PACKAGE DBMS_CRYPT AS
  FUNCTION encrypt_text (p_text IN VARCHAR2, 
                         p_key  IN VARCHAR2) RETURN VARCHAR2;
 
  FUNCTION decrypt_text (p_text IN VARCHAR2, 
                         p_key  IN VARCHAR2) RETURN VARCHAR2;
END DBMS_CRYPT;
/
========================================
CREATE OR REPLACE PACKAGE BODY DBMS_CRYPT AS
FUNCTION encrypt_text (p_text IN VARCHAR2,
                       p_key  IN VARCHAR2) RETURN VARCHAR2 IS
 v_return_value  VARCHAR2(1000);
BEGIN
  SELECT DBMS_CRYPTO.encrypt(UTL_RAW.cast_to_raw(p_text), 4353, UTL_RAW.cast_to_raw(p_key))
  INTO v_return_value
  FROM DUAL;
  RETURN v_return_value;
END;

FUNCTION decrypt_text (p_text IN VARCHAR2,
                       p_key  IN VARCHAR2) RETURN VARCHAR2 IS
 v_return_value  VARCHAR2(1000);
BEGIN
  SELECT UTL_RAW.cast_to_varchar2(SYS.DBMS_CRYPTO.decrypt(p_text, 4353, UTL_RAW.cast_to_raw(p_key)))
  INTO v_return_value
  FROM DUAL;
  RETURN v_return_value;
END;

END DBMS_CRYPT;
/

Usage 
========================================

SELECT DBMS_CRYPT.encrypt_text(p_text => TO_CHAR(1234), p_key => 'Apr2026@Tomia') FROM DUAL;
SELECT DBMS_CRYPT.decrypt_text(p_text => 'B067B800BC18271C', p_key => 'Apr2026@Tomia') FROM DUAL;


Usage with table
========================================
CREATE TABLE TOKEN_USAGE 
(id               NUMBER,
 usage_name       VARCHAR2(100),
 usage_value      VARCHAR2(1000),
 ts_last_modified DATE DEFAULT SYSDATE
) TABLESPACE IGT_TABLE;

ALTER TABLE TOKEN_USAGE ADD CONSTRAINT TOKEN_USAGE_PK PRIMARY KEY  (id) USING INDEX TABLESPACE IGT_INDEX;

INSERT INTO TOKEN_USAGE (id, usage_name, usage_value) VALUES (1,'Tomia Chat Bot',DBMS_CRYPT.encrypt_text(p_text => TO_CHAR(1234), p_key => 'Apr2026@Tomia'));

SELECT id, usage_name, usage_value FROM TOKEN_USAGE;

        ID USAGE_NAME     USAGE_VALUE
---------- -------------- -----------------
         1 Tomia Chat Bot B067B800BC18271C


SELECT id, usage_name, DBMS_CRYPT.decrypt_text(p_text => usage_value, p_key => 'Apr2026@Tomia') as usage_value, ts_last_modified FROM TOKEN_USAGE
WHERE id=1;S
        ID USAGE_NAME     USAGE_VALUE
---------- -------------- -----------------
         1 Tomia Chat Bot 1234