🧩 ORA-00028: Your Session Has Been Killed


 🧩 Introduction

The ORA-00028 error occurs when your current database session is terminated—either manually by an administrator or automatically by Oracle itself. This can interrupt your work unexpectedly, especially during long-running transactions or maintenance activities.


Error Message Example:


ORA-00028: your session has been killed


Meaning

This message means that your session has been explicitly marked for termination. You cannot continue using the same connection; you must reconnect to the database.


Common Causes


The DBA executed a manual kill command on your session:


ALTER SYSTEM KILL SESSION 'sid,serial#';


The database instance was restarted or aborted.


Resource Manager automatically terminated your session due to resource limits.


You were disconnected for exceeding idle time or session limits defined by profiles.


A Data Guard switchover or failover caused session termination.



Step 1: Confirm the Session Termination

If you’re connected via SQL*Plus or any client tool, you’ll usually see this message immediately after execution of a command. If not, you can check if your previous session was killed:


SELECT username, status 

FROM v$session 

WHERE username = 'YOUR_USERNAME';


If your old session no longer appears, it’s been terminated.


Step 2: Reconnect to the Database

Since the killed session cannot be reused, simply reconnect:


sqlplus user/password@service_name


or through your application’s connection pool, restart the connection.


Step 3: Identify Who or What Killed the Session

DBAs can check the alert log or audit tables to find session kill records.

To find the responsible session:


SELECT username, machine, program 

FROM v$session 

WHERE sid = <SID>;


If auditing is enabled, you can trace user actions.


Step 4: Prevent Future Unintended Kills


Coordinate with DBAs before performing long-running operations.


Ensure your profile does not have strict IDLE_TIME limits:


SELECT resource_name, limit FROM dba_profiles WHERE profile='DEFAULT' AND resource_name='IDLE_TIME';


For batch jobs, use dedicated scheduler jobs or background sessions.


If you are an administrator, use ALTER SYSTEM DISCONNECT SESSION instead of kill—this allows graceful cleanup.



Step 5: Check for Application-Level Impacts

Applications relying on persistent connections may throw errors or hang when a session is killed.

✅ Configure connection pools to automatically retry or reconnect after disconnection.


Conclusion

The ORA-00028 error isn’t necessarily a bug—it’s a signal that your database session was intentionally or automatically terminated. While reconnecting usually resolves the issue, understanding the root cause helps prevent unexpected disruptions in future operations.

Comments