数据库是网络环境下多用户使用的共享资源,数据库在处理多线程大量数据存取过程中很可能出现死锁现象。文中介绍了Oracle数据库锁机制和死锁发生的原因,Oracle数据库检测死锁采用的相关视图。详细叙述了SQL语句检测死锁、死锁的定位方法和解决数据库死锁的方法。编写了在Linux环境中死锁检测脚本,模拟Oracle数据库死锁测试了脚本的正确性。实际应用表明该方法可以有效监测程序中的主要模块是否发生死锁,而且简单有效。%The database is a shared resource of multi-user in network environment,database deadlock phenomenon is likely to occur in multi-threaded process by large amounts of data access. Introduce the Oracle database locking mechanism and the causes the deadlock oc-curs,the Oracle database detects the related views deadlock uses. A detailed description is conducted for the SQL states the deadlock de-tection,the positioning method of deadlock and the resolution of the database deadlock. Compiled the deadlock detection script in the Linux environment,simulate the Oracle database deadlock to test the correctness of the script. Practical application shows that the script can be effective monitoring whether the program's main module is deadlock or not,with simplicity and effectiveness.
展开▼