{"id":4657,"date":"2025-07-09T14:12:40","date_gmt":"2025-07-09T14:12:40","guid":{"rendered":"https:\/\/w3buddy.com\/?p=4657"},"modified":"2026-01-15T12:44:05","modified_gmt":"2026-01-15T07:14:05","slug":"how-to-fix-ora-00054-resource-busy-and-acquire-with-nowait-specified-or-timeout-expired","status":"publish","type":"post","link":"https:\/\/w3buddy.com\/blog\/how-to-fix-ora-00054-resource-busy-and-acquire-with-nowait-specified-or-timeout-expired\/","title":{"rendered":"How to Fix ORA-00054: Resource Busy and Acquire with NOWAIT Specified or Timeout Expired"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">While working with Oracle databases, you might encounter:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired\n<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you\u2019re wondering:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Why does this error occur?<\/strong><\/li>\n\n\n\n<li><strong>What action should I take to fix it?<\/strong><\/li>\n\n\n\n<li><strong>How do I avoid it in the future?<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This post will clarify these questions simply so you can handle this confidently in your DBA workflow.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is ORA-00054?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This error indicates that:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You tried to <strong>acquire a lock on a table or row<\/strong>,<\/li>\n\n\n\n<li><strong>NOWAIT or a timeout was specified<\/strong>,<\/li>\n\n\n\n<li>But <strong>the resource is already locked by another session<\/strong>, so Oracle cannot acquire the lock immediately.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This typically happens when you:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run <code>ALTER TABLE<\/code> or <code>DROP TABLE<\/code> on a table that is currently in use.<\/li>\n\n\n\n<li>Execute DDL statements on objects locked by active transactions.<\/li>\n\n\n\n<li>Attempt DML with <code>SELECT FOR UPDATE NOWAIT<\/code> while another session is holding the lock.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Why does it occur?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Oracle uses locks to maintain <strong>data consistency and concurrency control<\/strong>. If you request a lock with <code>NOWAIT<\/code>, Oracle will not wait for the resource to become available and throws <strong>ORA-00054<\/strong> if it is already locked.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>ALTER TABLE employees ADD (new_column NUMBER);\n<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">will fail with ORA-00054 if:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Another session is updating <code>employees<\/code>.<\/li>\n\n\n\n<li>A long-running transaction is holding a lock on <code>employees<\/code>.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">What action is needed?<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">1\ufe0f\u20e3 Identify the locking session<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>SELECT \n    l.session_id, \n    s.serial#, \n    s.username, \n    s.machine, \n    s.program \nFROM \n    v$locked_object l, dba_objects o, v$session s \nWHERE \n    l.object_id = o.object_id \n    AND l.session_id = s.sid \n    AND o.object_name = 'EMPLOYEES';<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>'EMPLOYEES'<\/code> with your table name.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This will show <strong>who is holding the lock<\/strong> on your object.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2\ufe0f\u20e3 Wait or Kill the session (with caution)<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If the locking session is running a valid transaction:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Wait for it to complete<\/strong> before retrying your operation.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If it is blocking and you need to proceed:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check with your team and, if safe, you can kill the session:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>ALTER SYSTEM KILL SESSION 'sid,serial#';\n<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u26a0\ufe0f Use this with <strong>extreme caution<\/strong> in production, ensuring you are not interrupting critical transactions.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">3\ufe0f\u20e3 Retry without NOWAIT<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If your statement used <code>NOWAIT<\/code>, consider removing it to allow Oracle to wait until the lock is released:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>SELECT * FROM employees FOR UPDATE;\n<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">instead of<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>SELECT * FROM employees FOR UPDATE NOWAIT;\n<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Or handle it in application logic to retry after waiting.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">4\ufe0f\u20e3 Schedule DDL during maintenance windows<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">DDL operations should ideally be performed during <strong>low-activity windows<\/strong> to avoid conflicts with active transactions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How to Avoid ORA-00054 in the Future?<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Schedule DDL changes during maintenance or periods of low user activity.<\/li>\n\n\n\n<li>Use <code>DBMS_LOCK<\/code> or application logic to manage custom locking and avoid clashes.<\/li>\n\n\n\n<li>Monitor sessions with scripts\/tools before running DDL.<\/li>\n\n\n\n<li>Train your team to communicate active locking operations before large changes.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Summary<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Why it occurs:<\/strong> Another session is holding a lock when you requested NOWAIT or a timeout expired.<\/li>\n\n\n\n<li><strong>What to do:<\/strong> Identify the blocking session, wait, kill if necessary, or retry without NOWAIT.<\/li>\n\n\n\n<li><strong>Prevention:<\/strong> Schedule DDL carefully and monitor active sessions.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">By understanding <strong>ORA-00054<\/strong> and how to handle it systematically, you will <strong>avoid unnecessary production disruptions<\/strong> and strengthen your Oracle administration confidence.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While working with Oracle databases, you might encounter: If you\u2019re wondering: This post will clarify these questions simply so you can handle this confidently in your DBA workflow. What is ORA-00054? This error indicates that: This typically happens when you: Why does it occur? Oracle uses locks to maintain data consistency and concurrency control. If [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"googlesitekit_rrm_CAowu461DA:productID":"","footnotes":""},"categories":[1225],"tags":[],"class_list":["post-4657","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/posts\/4657","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/comments?post=4657"}],"version-history":[{"count":1,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/posts\/4657\/revisions"}],"predecessor-version":[{"id":4658,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/posts\/4657\/revisions\/4658"}],"wp:attachment":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/media?parent=4657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/categories?post=4657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/tags?post=4657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}