Home » RDBMS Server » Server Administration » Many lock on Oracle Database using Oracle Forms (Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi)
Many lock on Oracle Database using Oracle Forms [message #549424] |
Fri, 30 March 2012 08:16 |
marcossantos
Messages: 123 Registered: June 2008
|
Senior Member |
|
|
Hi,
I have a RAC environment with 3 nodes and application using Oracle Forms Reports that access the database. Every day the application cause many locks on database when execute insert, update and delete. I dont undestand why so much locks. Are there a way to avoid this? Always I have to eliminate session causing locks.
Can someone help me?
Marcos Santos
|
|
|
Re: Many lock on Oracle Database using Oracle Forms [message #549430 is a reply to message #549424] |
Fri, 30 March 2012 08:42 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
You really need to identify what is being locked, by what code, for what reason. Which means looking in the code.
We can't really help you with that as we don't have the code.
If you find a particular bit of code that you think is an issue then you can certainly ask us about it, but as it stands your problem is too vague for us to help.
|
|
|
|
|
Re: Many lock on Oracle Database using Oracle Forms [message #549434 is a reply to message #549424] |
Fri, 30 March 2012 09:03 |
marcossantos
Messages: 123 Registered: June 2008
|
Senior Member |
|
|
Hi,
thanks for your help!
On the database side i can see only dml command like this:
INSERT INTO HUMASTER.TB_EVENTO_ANEXADO
(CD_ITEM,CD_EVENTO_ANEXADO,CD_EVENTO,DS_EVENTO_ANEXADO,DT_EVENTO,
HR_EVENTO,CD_TRAMITE,NU_DIAS_PRAZO,CD_SETOR_DESTINO,CD_GUIA,
NU_VOLUMES_ANDAMENTO,NU_ANEXOS_ANDAMENTO,NU_APENSOS_ANDAMENTO)
VALUES (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13)
Marcos Santos
[Updated on: Fri, 30 March 2012 10:15] by Moderator Report message to a moderator
|
|
|
|
|
Re: Many lock on Oracle Database using Oracle Forms [message #549439 is a reply to message #549424] |
Fri, 30 March 2012 09:31 |
marcossantos
Messages: 123 Registered: June 2008
|
Senior Member |
|
|
Hi,
every day I detect many locks on the database. I detect what session causing the lock and eliminate the session. Its necessary resolve this because I left many times monitoring and eliminate this lock session. Our RAC environment has a GRID Control. Via GRID control i can detect what is the database blocking. If there is a way to correct this via database i do. But, if not i pass to developer correct this.
Thanks,
Marcos Santos
|
|
|
|
Re: Many lock on Oracle Database using Oracle Forms [message #549441 is a reply to message #549439] |
Fri, 30 March 2012 09:36 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
You're eliminating sessions just because you see locks in the GRID control?
Locks are a normal part of a forms app.
Are the users complaining about this issue?
If the app is locking more than it should then that is an issue for the developers to fix.
|
|
|
|
|
Re: Many lock on Oracle Database using Oracle Forms [message #549444 is a reply to message #549443] |
Fri, 30 March 2012 09:45 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
The foreign key thing is only an issue when you come to delete parent records,
or update the foreign key column of a parent record (which you generally shouldn't be doing).
Don't guess what is causing the locking issue. Find out.
Which would involve seeing what users are doing when they get blocked and seeing what code they are trying to run.
|
|
|
|
|
Re: Many lock on Oracle Database using Oracle Forms [message #549447 is a reply to message #549424] |
Fri, 30 March 2012 10:00 |
marcossantos
Messages: 123 Registered: June 2008
|
Senior Member |
|
|
Thaks,
its happening now.
Username Term Kill String Table Name Lock Held Lock Requested Seconds
---------- ------ ------------- ----------------------------------- -------------------- -------------------- ----------
MARILENE None 408,31142 HUMASTER.TB_GUIA Row Exclusive 1142
HUMASTER.TB_AUDITORIA Row Exclusive 1142
REL_RH None 444,7994 SYS._NEXT_OBJECT Row Exclusive 66409
SYS._NEXT_OBJECT Row Exclusive 66409
SYS._NEXT_OBJECT Row Exclusive 66409
SYSTEM None 162,30259 PUBLIC.USER_SUMMARY_JOINS Share 88542
101078 None 233,62632 APADMIN.TB_INTEIRO_TEOR Row Exclusive 298
101313 None 210,48695 UNIFICADAS.DUVIDAS Exclusive 0
APADMIN.TB_INTEIRO_TEOR Row Exclusive 0
102025 None 212,58197 APADMIN.TB_INTEIRO_TEOR Row Exclusive 68
MArcos Santos
[Updated on: Fri, 30 March 2012 10:19] by Moderator Report message to a moderator
|
|
|
Re: Many lock on Oracle Database using Oracle Forms [message #549448 is a reply to message #549447] |
Fri, 30 March 2012 10:06 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
The fact that you have locks doesn't mean you have a problem.
As I said before a forms app is supposed to lock things. It does so by design.
If there's no locks that means no one is using the system.
If you go around killing sessions just because they've got a lock you're going to annoy your users, and possibly get yourself sacked.
Again, what makes you think the locks are an actual problem?
|
|
|
|
Re: Many lock on Oracle Database using Oracle Forms [message #549455 is a reply to message #549424] |
Fri, 30 March 2012 10:35 |
marcossantos
Messages: 123 Registered: June 2008
|
Senior Member |
|
|
Hi,
I take from metalink.
SET ECHO off
REM NAME: TFSLKILL.SQL
REM USAGE:"@path/tfslkill"
REM ------------------------------------------------------------------------
REM REQUIREMENTS:
REM SELECT on V$LOCK, V$SESSION, SYS.USER$, SYS.OBJ$
REM ------------------------------------------------------------------------
REM PURPOSE:
REM The report generated by this script gives information on sessions
REM which are holding locks and gives the information needed to kill
REM using the ALTER SYSTEM KILL SESSION command.
REM ------------------------------------------------------------------------
REM Main text of script follows:
set linesize 132 pagesize 66
break on Kill on username on terminal
column Kill heading 'Kill String' format a13
column res heading 'Resource Type' format 999
column id1 format 9999990
column id2 format 9999990
column lmode heading 'Lock Held' format a20
column request heading 'Lock Requested' format a20
column serial# format 99999
column username format a10 heading "Username"
column terminal heading Term format a6
column tab format a35 heading "Table Name"
column owner format a9
column Address format a18
column ctime heading "Seconds"
select nvl(S.USERNAME,'Internal') username,
nvl(S.TERMINAL,'None') terminal,
L.SID||','||S.SERIAL# Kill,
U1.NAME||'.'||substr(T1.NAME,1,20) tab,
decode(L.LMODE,1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Exclusive',
6,'Exclusive',null) lmode,
decode(L.REQUEST,1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Exclusive',
6,'Exclusive',null) request,
l.ctime
from V$LOCK L,
V$SESSION S,
SYS.USER$ U1,
SYS.OBJ$ T1
where L.SID = S.SID
and T1.OBJ# = decode(L.ID2,0,L.ID1,L.ID2)
and U1.USER# = T1.OWNER#
and S.TYPE != 'BACKGROUND'
order by 1,2,5
/
Marcos Santos
|
|
|
|
|
Re: Many lock on Oracle Database using Oracle Forms [message #549458 is a reply to message #549424] |
Fri, 30 March 2012 11:33 |
marcossantos
Messages: 123 Registered: June 2008
|
Senior Member |
|
|
Hi,
I understand that lock is normal. But, many locks causing many wait dont permit normal use of database and I take many time eliminate session of databse.
I consider that the number of locks and waits on database are unacceptable. I have to correct this or pass to developer correct the application. If i can correct via database, its ok.
But if not, its ok. I pass to developer to correct this.
Regards,
Marcos Santos
|
|
|
Re: Many lock on Oracle Database using Oracle Forms [message #549459 is a reply to message #549424] |
Fri, 30 March 2012 11:46 |
marcossantos
Messages: 123 Registered: June 2008
|
Senior Member |
|
|
Again...
Username Term Kill String Table Name Lock Held Lock Requested Seconds
---------- ------ ------------- ----------------------------------- -------------------- -------------------- ----------
REL_RH None 176,40740 SYS._NEXT_OBJECT Row Exclusive 17
SYS._NEXT_OBJECT Row Exclusive 16
SYS._NEXT_OBJECT Row Exclusive 16
SYSTEM None 162,30259 PUBLIC.USER_SUMMARY_JOINS Share 94899
100902 None 229,24112 HUMASTER.TB_PROCESSO Row Exclusive 239
100961 None 312,14379 APADMIN.TB_INTEIRO_TEOR Row Exclusive 415
101055 None 376,26317 APADMIN.TB_INTEIRO_TEOR Row Exclusive 9
101931 None 348,34483 UNIFICADAS.HISTORICO_CLASSES Exclusive 5343
APADMIN.TB_INTEIRO_TEOR Row Exclusive 5343
|
|
|
|
Re: Many lock on Oracle Database using Oracle Forms [message #549464 is a reply to message #549458] |
Fri, 30 March 2012 13:18 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
marcossantos wrote on Fri, 30 March 2012 17:33
I consider that the number of locks and waits on database are unacceptable. I have to correct this or pass to developer correct the application
As I said earlier:
If the app is locking more than it should then that is an issue for the developers to fix.
There is no mystical DB setting that will fix this. The only thing you can do is index the foreign keys if they aren't already, and that's only worth doing if that's what is causing the locks.
If you don't know what code is causing the locks, then someone, probably one of the developers, needs to work it out.
|
|
|
Re: Many lock on Oracle Database using Oracle Forms [message #550473 is a reply to message #549424] |
Mon, 09 April 2012 13:44 |
marcossantos
Messages: 123 Registered: June 2008
|
Senior Member |
|
|
Hi,
thanks for answer.
I find more this sugestion on metalink.
Quote:
Hello,
the answer to the original question is in the other answers, so I want to add a remark on something "slightly different".
JFr, you are correct: the column used as reference is indexed (by a unique index), but we are here in the "other direction"...
Example:
PARENT( parent_id, ... ), primary key (parent_id)
CHILD( child_id, parent_id, ...), primary key (child_id), foreign key (parent_id) references PARENT(parent_id)
There is no obligation to index "CHILD(parent_id)".
But it is advisable! If we issue "UPDATE parent SET parent_id = <new_value> WHERE ..." or "DELETE parent WHERE ...", then Oracle has to check that this would not cause "orphans" in the table CHILD. If the field is not indexed in CHILD, this implies a full table scan. What's more, a lock will prevent modifications of the table as long as the operation on "PARENT" is not completed... This can have a huge performance impact.
Only if we are sure that the keys of PARENT will never be modified or removed we can live without an index on CHILD(parent_id), but frankly, "if we are sure" is something that doesn't happen so often... I have seen cases where "impossible things had to be done exceptionally". On such days, if it take ages because we wanted to "spare" an index, ;-(
Best regards,
Bruno Vroman.
Marcos Santos
|
|
|
|
Re: Many lock on Oracle Database using Oracle Forms [message #551075 is a reply to message #550538] |
Sun, 15 April 2012 08:28 |
|
d_seng
Messages: 78 Registered: November 2011 Location: UK
|
Member |
|
|
I've recently faced this problem.
Oracle forms issues updates/deletes to the database using ROWID and not the primary key. In such a case, absence of indexes on FK columns on child tables will cause table locks on child tables.
We had created new child tables and not added indexes on them which caused lots of instances of the application hanging even when two different users were working on two different data sets. Thankfully it was caught during the test phase. Adding the indexes sorted out problems straight away.
I guess your best bet will be to index all FK columns and see if it helps.
Dhruva
|
|
|
Goto Forum:
Current Time: Mon Jan 27 11:39:13 CST 2025
|