请教有关加锁和解锁的问题,急用,谢谢!

castaway 2002-10-17 05:36:54
就是客户端访问数据库中的某一条记录,要知道这条记录是否上锁,若没有,则上锁。还有一个解锁的方法,若没有解锁,则解锁。请问应该如何调用?
...全文
20 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
charity 2002-10-22
  • 打赏
  • 举报
回复
TO:hours24(lxd)
真的?我倒没遇到过,我这大概有六七个SYBASE服务全是在WINDOWS平台上
hours24 2002-10-20
  • 打赏
  • 举报
回复
sp_lock
go
sp_who

一同用就可大致看出被锁客户和加锁原因客户,还可看出被锁表,再KILL就可。但小心的是若事物大可能杀不了,甚至数据库死掉。但好在sybase重启一般不会出问题.(可恶也在此,sybase常会重启)
hobbylu 2002-10-18
  • 打赏
  • 举报
回复
同意charity的方法,你将该表设置为行级锁
alter table tablename lock datarows
charity 2002-10-18
  • 打赏
  • 举报
回复
first you must set the lock of the table as "row level".
then u can check the master..syslocks for whether the row of the table is locked, if already locked,u can only use kill to "release" the lock and the locking transcation will be killed too(It's a not good idea to do this, because who knows whether the transcation to be killed is active in doing the right thing?)
And u can use a simple update to lock this row.
wanghai 2002-10-17
  • 打赏
  • 举报
回复
解锁只能杀进程KILL 锁对应的进程
tramplai 2002-10-17
  • 打赏
  • 举报
回复
可以通过客户端来看是否有表被锁!!!加锁可以用存储过程:sp_lock!!

2,596

社区成员

发帖
与我相关
我的任务
社区描述
Sybase相关技术讨论区
社区管理员
  • Sybase社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧