i have application where user logs and perform manipulation operation such as insert and update on database table.some time its possible that same user login twice, i just want to hold one session until and unless dml operation perform by another session gets complete.how to accomplish this in database level .
we know we can see lock mode held in session can be analysed using LM column in v$lock.But i confused in seeing LM column it all shows in numbers from 0 to 6.
I have an urgent requirement to kill an existing session if a new session starts for the same user. I have been reading lot of blogs and posts on the above topic, but could clearly tell me how to do it.
I thought of putting a process in 101 page when login button is pressed to catch this and kill the old session.
We are using Apex 4.0/Oracle 10gR2/ Hp-Ux, We noticed that there is a process Running in Two Sessions that seems running since 3 Hours using 60% CPU,** 30% given below sql it executes in two Sessions!
declare function x return boolean is begin -- if instr(upper(:F4000_P4651_PLUG_SOURCE),'ORDER BY')>0 then declare l_position number := 0; begin loop l_position := instr(upper(:F4000_P4651_PLUG_SOURCE),'ORDER BY ',l_position + 1) ; exit when instr(upper(:F4000_P4651_PLUG_SOURCE),'ORDER BY ',l_position + 1) = 0 ;
In my current project, I am handling an Oracle database with version 10.2.0.3. I analyzed the AWR report for the past month abd saw the following wait events consistently:
CPU time - 45.6% (% Total Call Time) db file sequential read - 30.6% (% Total Call Time) enq: TX - row lock contention - 18.8 % (% Total Call Time)
I have uploaded the report for your reference.What should be my approach to troubleshoot this?
Attached File(s)
awr_report.html ( 382.28K ) Number of downloads: 6
how one can lock a particular row in a table.for example i have a employee table in which 50 records. now i want to lock only 10 records of the employee table.
I have a transaction table with some custom properties and two status columns. There are 2 different applications(.Net and Pl/SQL Procedure) using the table. Both the process run parallel and fetch records one by one, perform some calculation and update the status column.
There are likely more chances that both applications will fetch the sane record and try to update the same row. This will cause a lock. Can i use row level lock before update by each application? Or is there any other methods/process in which this can be handled. ?
begin for i in 1..10000 loop update table1 set col1= col1+1 where type =1; commit; end loop; end;
My question is, if a strored procedure contains the script above and the said procedure will be invoked by two or more sessions at the same time. Does it mean that the 1st session will lock the related rows and other sessions will have to wait for loop in session one to finish?
I am unable to compile my package because of a lock being held on it . Let me provide the details for better clarity .
select * from dba_ddl_locks where session_id=111 and owner='RAHUL';
session_id owner name type mode_held mode_requested 111 RAHUL RAHUL_PKG BODY NULL None 111 RAHUL RAHUL_PKG Table/Procedure/Type NULL NoneThe session details of the session id 111 is as below
select sid,serial#,user#,username,command,status,process,sql_exec_start from v$session where sid=122
sid serial# user# username command status process SQL_EXEC_START 111 3558 222 RAHUL 47 KILLED 4420 13-DEC-12 02.00.00 AM
The strange this is that we have tried killing this session and the status above even shows ' 'KILLED', stilll the dba_ddl_locks is showing the lock details on the package RAHUL_PKG and we are unable to compile the package (the locking session is running since 13-Dec-2012 ) and we are unable to kill that . Also , is it like if i have executed a package that is referencing some other package then we wont be able to compile the referenced package until and unless the dependent package has completed its execution ??
In my trace file am getting the following error, I understand this is due to the row level deadlock between two sessions accessing the same rows in a table.
The following deadlock is not an ORACLE error. It is a deadlock due to user error in the design of an application or from issuing incorrect ad-hoc SQL. The following information may aid in determining the deadlock:
Deadlock graph: ---------Blocker(s)-------- ---------Waiter(s)--------- Resource Name process session holds waits process session holds waits TX-016e0017-0001e10f 75 2370 X 153 2269 X TX-0217000f-00009247 153 2269 X 75 2370 X
session 2370: DID 0001-004B-0015DCCEsession 2269: DID 0001-0099-000FB698 session 2269: DID 0001-0099-000FB698session 2370: DID 0001-004B-0015DCCE
----- Information for the OTHER waiting sessions ----- Session 2269: sid: 2269 ser: 36409 audsid: 563917587 user: 107/PICKLE flags: 0x8000041 pid: 153 O/S info: user: oracle, term: UNKNOWN, ospid: 27324 image: oracle@snokhup4000 client details: O/S info: user: appsrv, term: , ospid: 1234 machine: snokhup255 program: current SQL:
DELETE FROM moderation_queue WHERE parent_id =:1 AND submission_type =:2 AND site_id IN ( select site_id from sites where personna_id= 1 ) ----- End of information for the OTHER waiting sessions -----
Information for THIS session:
----- Current SQL Statement for this session (sql_id=5rywrxc0mpcc1) ----- delete from shadow_users where user_id=:1 and personna_id=:2
In the past, we setup a standby database on our production server. My OS is HPUX, Oracle 10g and my database is in archive mod. We are no longer using the standby database method. My problem now is that one of my tablespace (/oradata/tn/rd2_temp 20gb) became 100% full on my production system. In trying to provide more space, I removed one of the standby redo logs. Instead of using ALTER database, I just did a rm from the OS. As I said earlier my STANDBY DB is inoperatable.
When I tried to drop the tablespace(/oradata/tn/rd2_temp it is 20gb), I am getting an oracle error (ora-19528 redo logs being cleared may need access to files). Im also getting and INSTANCE LOCK on ARC4. The rd2_temp tablespace is now offline. If I get rid of rd2_temp, I will be able to gain more space back to /oradata/tn.
I have a situation where I need to check if a row in the table locked i.e (Select for Update with NO WAIT applied on it). If yes go fetch the next row .
While i am trying to execute below mentioned query i am facing "DEADLOCK FOUND WHEN TRYING TO GET LOCK" error.
UPDATE PLAN SET PLAN_PMS_BLOCK_ID ='' WHERE PLAN_PMS_BLOCK_ID<>'' AND PLAN_PMS_BLOCK_ID NOT BETWEEN '0' AND '9' AND PLAN_PMS_BLOCK_ID NOT BETWEEN 'A' AND 'Z' AND PLAN_PMS_BLOCK_ID NOT IN('-') AND LENGTH(PLAN_PMS_BLOCK_ID )=1;
We are using the following statement to obtain a row lock in a table in the database(ORACLE 10G), SELECT * FROM {TABLE_NAME} WHERE ID = 1 for update and if we succeed grabbing the row lock we will continue to issue a update statement every 30 seconds to preserve the lock as far as possible. here is the update statement to preserve the lock,
UPDATE {TABLE_NAME} SET time = ? WHERE ID = 1.
As you see more longer we keep holding the row lock , more update statements are submitted in the pending transaction. In normal case our application can grab the exclusive row lock and works for a long time,however sometimes a connection reset exception is thrown and our application will close the connection(I assume the pending transaction will be rolled back by the database) and exit the JVM. Since other applications will keep trying to grab the same row lock to become the master role, we expect one of them can succeed but they are all failed because the database has not released the row lock as expected. how and when the row lock can get released in our use case?
I keep getting an ora-04020: deadlock detected while trying to lock object XDB. SDNRB..The statement I'm trying to issue is:
REVOKE execute on abc."descript_T" FROM PUBLIC;
I am not able to find a solution for this besides the fact of trying the operation again at a later time.I did, but get the same error every single time.
I am getting the Oracle Database error "ORA-00069 cannot acquire lock -- table locks disabled for string" in a stored proc. According to some sites I looked at, it says the Cause is "A command was issued that tried to lock the table indicated in the message. Examples of commands that can lock tables are: LOCK TABLE, ALTER TABLE ... ADD (...), and so on.". And the Action they suggest is "Use the ALTER TABLE ... ENABLE TABLE LOCK command, and retry the command".
I am not doing either a lock table or alter table command in my procedure, so what else could be causing this?
@ the end of the day means After date changes i need to populate the new row in Some of my tables with the previous date values with the new date.. In that time some other Transaction will Occur on those tables so we need to lock all the tables in that time..Even i tried by doing the Exclusive lock on the tables...
execute immediate 'LOCK TABLE CTR_SALES IN EXCLUSIVE MODE NOWAIT'; execute immediate 'LOCK TABLE CTR_STK_ASSIGN IN EXCLUSIVE MODE NOWAIT';
And how to run this function @ 12:00 in the midnight by scheduling.... And 1 more thing how to pick the recent (Transaction) row on that table. I tried from the rowid it's not working
Is there a way to only temporarily lock an account after so many bad logins? I'm being told by my DBA that there is not, and I'm just shocked that Oracle wouldn't build in that functionality.
I am using Oracle 11g in my Windows machine. I wrote a multithreaded program that will be inserting into Oracle database so I was getting this exception before-
ORA-12519: TNS:no appropriate service handler found
So after going through various article on the internet. I found that the solution for above exception is to increase the number of processes- So I followed the below thing and it works fine for me after that.
cmd>sqlplus / as sysdba sqlplus>alter system set processes=300 scope=spfile; sqlplus>shut immediate; sqlplus>startup
Now after some more time, I increased the processes to something like below
alter system set processes=1000000 scope=spfile;
And since then whenever I am starting up my Oracle database, it is giving me this exception below and it is happening since one day.
ORA-10997: another startup/shutdown operation of this instance inprogress ORA-09968: unable to lock file
I want to read 1 table. If the date is less than today, I want to update 4 other tables. I only want to do this update once a day.
While the 4 other tables are being updated, I want the other web users to pause for the update while this procedure runs.
Is there a better way to do this?
Here is what I have:
CREATE OR REPLACE PROCEDURE TEST_TODAY2 AS -- to create the table -- create table test_today(updated_date date); -- insert into test_today(updated_date) values (sysdate-1); -- select * from test_today; cursor daily_update_cur is select updated_date from test_today for update of updated_date;
[Code]...
Please use {noformat}{noformat} tags before and after your code as described in the FAQ: {message:id=9360002}.
I have gathered frequency histogram manually on one of my column of a table to provide more information to optimizer for better calculation of cardinality.
Now i have my weekend job runs for gathering stats on schema level with method_opt as 'For all column size repeat'. But i don't want the stats of above column to be overridden by the stats job. I don't want to lock the statistics of whole table, but i just want to lock the column level stats for this table.