在进行数据库维护的过程中要删除一个中间表,遇到如下错误:
sys@DW>drop table dwods.member_DELTA;
drop table dwods.member_DELTA
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
发现表因为执行dml被锁住,下面给出错误的处理思路和过程,具体情况而异:
1 查看被数据库中被锁的用户信息:
sys@DW>select t2.username,t2.sid,t2.serial#,t2.logon_time
2 from v$locked_object t1,v$session t2
3 where t1.session_id=t2.sid order by t2.logon_time;
USERNAME SID SERIAL# LOGON_TIME
------------------------------ ---------- ---------- -------------------
DWODS 1520 42477 2011-11-17 18:00:40
DWODS 1594 7385 2011-11-17 18:41:27
dwods 被锁住,因为事务是18:41分发起的,所以查看一下sid 为1594的信息,
2 查询出sql信息根据实际情况,进行操作
sys@DW>select sql_text from v$session a,v$sqltext_with_newlines b
2 where DECODE(a.sql_hash_value, 0, prev_hash_value, sql_hash_value)=b.hash_value
3 and a.sid=&sid order by piece;
Enter value for sid: 1594
old 3: and a.sid=&sid order by piece
new 3: and a.sid=1594 order by piece
SQL_TEXT
----------------------------------------------------------------
insert /*+ append +*/ into DWODS.MEMBER_delta (ACTION,
ADDRESS,
........
32 rows selected.
正是发起的那个语句,查看用户的信息进行确认
sys@DW>@user_info
Enter value for sid: 1594
old 12: where a.sid = &sid
new 12: where a.sid = 1594
USERNAME SID SERIAL# OS Process Logon time OSUSER PROGRAM STATUS
--------- ----- ------- ----------------------------- -------- ----------------------- -----------
DWODS 1594 7385 3309 17/11/2011 18:41:27 etl sqlplus@dw1 (TNS V1-V3) ACTIVE
1 row selected.
3 选择kill 掉进程
这里知道此session 可以杀掉,所以杀掉此session
sys@DW>alter system kill session '1594,7385';
System altered.
4 进行确认:
在数据库确认
sys@DW>@user_info
Enter value for sid: 1594
old 12: where a.sid = &sid
new 12: where a.sid = 1594
no rows selected
sys@DW>select t2.username,t2.sid,t2.serial#,t2.logon_time
2 from v$locked_object t1,v$session t2
3 where t1.session_id=t2.sid order by t2.logon_time;
USERNAME SID SERIAL# LOGON_TIME
--------------- ------- ------- -------------------
DWODS 1520 42477 2011-11-17 18:00:40
DWODS 1520 42477 2011-11-17 18:00:40
2 rows selected.
在os层确认,进程已经被杀。
oracle@dw1:/home/oracle>ps -ef | grep 3309
oracle 22565 18543 0 18:59 pts/5 00:00:00 grep 3309
再次执行删除表的操作:
sys@DW>drop table dwods.member_DELTA;
Table dropped.
------附上:
user_info。sql 脚本的内容:
select
a.username,
a.sid,
a.serial#,
b.spid "OS Process",
to_char(a.logon_time,'DD/MM/YYYY hh24:mi:ss') "Logon time",
a.osuser,
a.program,
a.status
from v$session a, v$process b
where a.sid = &sid
and a.paddr = b.addr
/
编辑推荐:
- 【Oracle】ORA-00054 错误解决方法03-03
- 监听配置细节参数详解两则03-03
- [20210323]bbed读取数据块5.txt03-03
- [20210311]如何建立bbed安装包.txt03-03
- [20210312]如何取整月日期.txt03-03
- 需要了解的Data Guard理论知识(一)03-03
- 需要了解的Data Guard理论知识(二)03-03
- 需要了解的Data Guard理论知识(三)03-03
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- Oracle监听日志清除
Oracle监听日志清除
26-03-03 - Oracle 19C RAC open_links_per_instance参数问题
- read by other session 等待事件分析
read by other session 等待事件分析
26-03-03 - Oracle sqlldr工具功能测试
Oracle sqlldr工具功能测试
26-03-03 - SQLServer 2012复制订阅数据订阅过程
SQLServer 2012复制订阅数据订阅过程
26-03-03 - [oracle] 索引低效,导致read by other session等待事件
- 【SQL】SQL表连接方法方式介绍(Oracle/Postgresql)
【SQL】SQL表连接方法方式介绍(Oracle/Postgresql)
26-03-03 - Oracle 19c数据库体系结构-2
Oracle 19c数据库体系结构-2
26-03-03 - 数据库无法注册至监听服务解决办法
数据库无法注册至监听服务解决办法
26-03-03 - Oracle数据库启动过程及状态详解
Oracle数据库启动过程及状态详解
26-03-03
