Solution to unlock a table or kill a session
hi
can anyone provide solution to kill a session that has locked some my tables and henceforth i'm unable to work on those tables
regards
vkc
Hi,
First you have find the blocking sessions then execute this statement:
SQL> ALTER SYSTEM KILL SESSION 'sid,serial#';
You can access the details through the link below.
http://www.oracle-base.com/articles/misc/KillingOracleSessions.php
Hope this helps,
Cheers.
Cuneyt
Similar Messages
-
hello frnds
i am using proc.in that proc i select data from a table(PRMASUP) and then insert into a another table(AFPBLRMPDTL) which in remote database.my problem is the prmasup table is locked every timer i run the proc.when i am trying to kill the session it is killed but still it is not release the lock.in dba studio it is showing it killed.but when i restart the server the lock is released.but after another two to three process it is again showing locked and same old problem occours.
can u give the permanent solution for this.
regards souravMaybe, you must make In-Doubt Transactions.
Please refer [url http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/ds_txnman.htm#ADMIN032] Managing Distributed Transactions. -
URGENT HELP Required: Solution to avoid Full table scan for a PL/SQL query
Hi Everyone,
When I checked the EXPLAIN PLAN for the below SQL query, I saw that Full table scans is going on both the tables TABLE_A and TABLE_B
UPDATE TABLE_A a
SET a.current_commit_date =
(SELECT MAX (b.loading_date)
FROM TABLE_B b
WHERE a.sales_order_id = b.sales_order_id
AND a.sales_order_line_id = b.sales_order_line_id
AND b.confirmed_qty > 0
AND b.data_flag IS NULL
OR b.schedule_line_delivery_date >= '23 NOV 2008')
Though the TABLE_A is a small table having nearly 1 lakh records, the TABLE_B is a huge table, having nearly 2 and a half crore records.
I created an Index on the TABLE_B having all its fields used in the WHERE clause. But, still the explain plan is showing FULL TABLE SCAN only.
When I run the query, it is taking long long time to execute (more than 1 day) and each time I have to kill the session.
Please please help me in optimizing this.
Thanks,
SudhindraCheck the instruction again, you're leaving out information we need in order to help you, like optimizer information.
- Post your exact database version, that is: the result of select * from v$version;
- Don't use TOAD's execution plan, but use
SQL> explain plan for <your_query>;
SQL> select * from table(dbms_xplan.display);(You can execute that in TOAD as well).
Don't forget you need to use the {noformat}{noformat} tag in order to post formatted code/output/execution plans etc.
It's also explained in the instruction.
When was the last time statistics were gathered for table_a and table_b?
You can find out by issuing the following query:select table_name
, last_analyzed
, num_rows
from user_tables
where table_name in ('TABLE_A', 'TABLE_B');
Can you also post the results of these counts;select count(*)
from table_b
where confirmed_qty > 0;
select count(*)
from table_b
where data_flag is null;
select count(*)
from table_b
where schedule_line_delivery_date >= /* assuming you're using a date, and not a string*/ to_date('23 NOV 2008', 'dd mon yyyy'); -
iTunes is unable to run. I tried to run iTunes and a message comes up that says "the iTunes library.itl file is locked, on a locked disk, or you do not have write permission for this file." what is the solution to unlock it ?!
I have tried both suggestions, unfortunately neither fixed this for me. Hoping there's another possible fix. Thanks in advance.
Empty/corrupt iTunes library after upgrade/crash and/or Repair security permissions for iTunes for Windows. -
Official solution for unlocking for an old iPhone 3GS
Last summer, I purchased an iPhone 3GS together with a 2-year contract with Swisscom, one of the mobile telephone operators in Switzerland. A few weeks ago, my phone was stolen while I was on a trip. I contacted Swisscom and informed them that the phone had been stolen. They deactivated the old SIM card, and sent me a replacement SIM card. I reported the theft to the police too. My understanding is that the IMEI number of my old iPhone will be added to a blacklist so that it cannot be used on any mobile telephone networks anymore.
My father, who lives in Texas, recently upgraded from an iPhone 3GS to an iPhone 4. He extended his original contract with AT&T and simply moved his number over to the new phone. Because he no longer had a need for his old iPhone 3GS, he agreed to send it to me. At my suggestion, he went first to the Apple Store in Austin and requested that they unlock the phone. The folks at the Apple Store informed him that they could not unlock it. They suggested that Apple or the mobile carrier in Switzerland could unlock the phone.
My father shipped his old iPhone 3GS to me, and I received it yesterday. This morning, I went to the Apple Store in Zürich and asked if they could unlock the phone so that I could use it with my Swisscom SIM card—the one Swisscom sent me to replace the one in my stolen iPhone. They told me that they could not do this, and that only the original carrier, AT&T could unlock the phone.
What is the official solution for unlocking an old iPhone 3GS?
I have posted this question to the AT&T discussion forum also.
http://forums.wireless.att.com/t5/Apple/Official-solution-for-unlocking-for-an-o ld-iPhone-3GS/td-p/1998765wjosten wrote:
Does Apple have a recommendation?
Read my post. There is nothing that Apple can do for you. The decision as to whether to unlock your phone or not rests entirely with AT&T, & they will not do so under any circumstances.
I read your post, and appreciate your having taken the time to write it. However, I would like to get an official reply from someone at Apple.
Apple is a company that prides itself on its commitment to the highest standards of environmental stewardship.
http://www.apple.com/environment/
Apple’s partner AT&T is also committed to being a good corporate citizen and protecting the natural environment.
http://www.att.com/gen/corporate-citizenship?pid=8506
Re-using old products to extend their useable lifetimes is one of the most effective ways of reducing the impact we have on the environment. When my phone was stolen, it seemed like a perfect opportunity to put this philosophy into action, using my dad’s old phone to use instead of just throwing it away, or leaving it on a shelf to be discarded later.
I think it would be a shame if there were no officially sanctioned way to put an old device to good use. -
Hi how to handel the lock and unlock the table
Hi,
i am having the one scenario like,for lock and unlock the table i used the function modules ENQUEUE_E_TABLE and DEQUEUE_E_TABLE but it allowing the edit the first user and suppose to try the editing the second user it is giving the error message it correct but again the second user press any button it is leaving the program it should not happened please help me that.
regards,
Hari.Hi,
i assume it's in table JEST
so select:
SELECT * FROM JEST
WHERE OBJNR = aufk-OBJNR
AND STAT IN S_STATI
Andreas -
Lock and Unlock a table:AFVU
Hi Folks.
I want to modify a standard table (AFVU ) with new user dates from User.For this,First I need to lock and unlock the table.
When I am trying for the standard table lock object (EAFVU) ,it was not there in the system.
Is there any way to find out the lock object for a particular table?
How to proceed for this?
Any Pointers are much helpful.Hi,
Go to SE11 and display your table - do a where used list and select lock objects.
I really hope when you say you are modifying a standard table you are only updating custom appends on that table, and not directly updating standard SAP fields...
Gareth. -
Time before unlocking locked tables
Hello,
i have a problem once again:
I execute several SQLs in a database (p.e. insert, update and so on). Before i can execute the transaction commit, the connection to the database breaks. So i can do neither the commit less the rollback.
In the database my session is inactive, the tables stay locked for some time.
And now the question: is it possible for me (or the administrator) to change this internal timer, which controls the unlock of tables in inactive sessions?
greetings
Sabine HerdejürgenBefore i can execute the transaction commit, the connection to the database breaks. So i can do neither the commit less the rollback.
no problem process monitor perfrom these task when
when connection break ,or any other error
The background process PMON cleans up after failed processes by:
Rolling back the users current transaction
Releasing all currently held table or row locks
Freeing other resources currently reserved by the user
and enjoy your life:-)
kuljeet pal singh -
Howto unlock a table in oracle when all sessions are close ...
but ... not commit or roollback has been made ...
Could I try to run any script for unlock the table or the row?
Thanks a lotIf a session is closed, by definition all transactions associated with that session must have ended, either by having the changes committed or rolled back. So the premise does not make sense.
If a table is locked, some session has that lock. If the session goes away, the lock goes away. If the lock is still there, the session must still be there.
Justin -
FM for locking n unlocking a table for update
I have to update a table named bnka, can anyone tel me the FM for locking and unlocking a table before updating the same..
thnkx
amityou can use FM ENQUEUE_EFBNKA to lock the table vbak
and DEQUEUE_EFBNKA to unlock it
Example:
call function 'ENQUEUE_EFBNKA'
EXPORTING
MODE_BNKA = 'E'
BANKS = bnka-banks
BANKL = bnka-bankl
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
update BNKA .....
call function 'DEQUEUE_EFBNKA'
EXPORTING
MODE_BNKA = 'E'
BANKS = bnka-banks
BANKL = bnka-bankl. -
Solution for unlocking legally an US iPhone and use it in France
Hello,
what is the solution to unlock legally an iPhone US in order to use it in France with Orange Carrier.
ThanksYou can't unless ATT is willing to give you an unlock code which is unlikely.
-
Unlocking a table??
Can anyone tell me how to unlock a table that I add so I can adjust the column sizes etc.? I click on the table but UNLOCK is not an option, only merge!! I've tried several things and nothing seems to work!!
ThanksSounds like your selecting a range (a number of cells at once). When selecting cells you will get Merge as an option.
The table is not locked, you must use the grey column or row bars at the top and left of the table itself to select the column or row. When you use the top grey bar you are selecting the entire column. You can then resize, format, etc...
Might i suggest walking through the "getting started" document present in Numbers? Tab #3 is titled "Table Basics" and covers all of this. If that is not enough for your particular needs, you can use the help function under the Wrench icon on the top right. Go to the "Get STarted in Numbers" section, then "Add, Remove, Resize and rearrange rows and columns."
Jason -
PL/SQL procedure to kill inactive session
Hi all ,
Please i am trying to write a procedure to kill inactive sessions of the shema 'TESTSCHEMA' .This is my first procedure , am not use to pl/sql but i went through many turtorial but have some errors at compliation .when i try to compile the procedure the errors are as below :
15:50:28 Start Find Objects [TESTSCHEMA@TESTDB_UNIX(2)] ...
15:50:28 End Find Objects [TESTSCHEMA@ TESTDB_UNIX(2)]
15:50:32 Start Compiling 1 object(s) ...
15:50:32 Executing ALTER PROCEDURE fib_dead_cnx_cleanup COMPILE ...
15:50:32 [13:2] PL/SQL: ORA-00933: SQL command not properly ended
15:50:32 [9:3] PL/SQL: SQL Statement ignored
15:50:32 [18:12] PLS-00103: Encountered the symbol "(" when expecting one of the following:
15:50:32 constant exception <an identifier>
15:50:32 <a double-quoted delimited-identifier> table LONG_ double ref
15:50:32 char time timestamp interval date binary national character
15:50:32 nchar
15:50:32 The symbol "<an identifier>" was substituted for "(" to continue.
15:50:32 [18:21] PLS-00103: Encountered the symbol "LOOP" when expecting one of the following:
15:50:32 := ; not null default character
15:50:32 The symbol "; was inserted before "LOOP" to continue.
15:50:32 [27:8] PLS-00103: Encountered the symbol "ALTER" when expecting one of the following:
15:50:32 begin case declare exit for goto if loop mod null pragma
15:50:32 raise return select update while with <an identifier>
15:50:32 <a double-quoted delimited-identifier> <a bind variable> <<
15:50:32 close current delete fetch lock insert open rollback
15:50:32 savepoint set sql execute commit forall merge pipe
15:50:32 Compilation complete - 5 error(s) found
15:50:32 End Compiling 1 object(s)
below is the procedure code :
CREATE OR REPLACE
PROCEDURE fib_dead_cnx_cleanup
AS
l_serial CHAR(100);
l_sid CHAR (100);
l_sid_serial CHAR(100);
l_count NUMBER(10,0);
CURSOR session_cur IS
SELECT sid,serial#,sid||','||serial# as sid_serial
FROM v$session
WHERE username='EBBFCAT' and schemaname='TESTSCHEMA'
and status='INACTIVE'
BEGIN
BEGIN
l_count := 0;
OPEN session_cur;
WHILE ( 1 = 1) LOOP
BEGIN
FETCH session_cur INTO l_sid ,l_serial,l_sid_serial ;
EXIT WHEN session_cur%NOTFOUND ;
BEGIN
alter system kill session 'l_sid_serial' ;
END;
END;
END;
CLOSE session_cur;
END;
END FIB_DEAD_CNX_CLEANUP;
ThanksHi,
Never write, let alone post, unformatted code.
When posting any formatted text on this site, type these 6 characters:
{code}
(small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
Among the benefits of formatting: you can indent to show the extent of blocks, such as BEGIN-END.
Different types of blocks need modifiers after the end, such as "END *IF* " and " END *LOOP* ". If each opening statement (BEGIN, IF, LOOP) is directly above its corresponding END, then it's easy to check if you got the right modifier.
Here's what you code looks like with some formatting, and a couple of corrections added. Look for -- comments.
CREATE OR REPLACE
PROCEDURE fib_dead_cnx_cleanup
AS
l_serial CHAR(100);
l_sid CHAR (100);
l_sid_serial CHAR(100);
l_count NUMBER(10,0);
CURSOR session_cur IS
SELECT sid
, serial#
, sid || ','
|| serial# as sid_serial
FROM v$session
WHERE username = 'EBBFCAT'
and schemaname = 'TESTSCHEMA'
and status = 'INACTIVE'; -- need semicolon here
BEGIN
BEGIN -- Why?
l_count := 0;
OPEN session_cur;
WHILE ( 1 = 1)
LOOP
BEGIN -- Why?
FETCH session_cur
INTO l_sid
, l_serial
, l_sid_serial ;
EXIT WHEN session_cur%NOTFOUND ;
BEGIN -- Why?
alter system kill session 'l_sid_serial' ; -- Not a PL/SQL command
END;
END;
END LOOP; -- LOOP ends with END LOOP
CLOSE session_cur;
END;
END FIB_DEAD_CNX_CLEANUP;Take baby steps.
I've been wrtiing PL/SQL for 20 years, and I would never write that much code at once. If you're a beginner, all the more reason to start small. Write as little as possible, test, debug and test again (if necessary). When you have someting working, add 2 or 3 more lines and test again.
It looks like you have three BEGIN statements that don't serve any purpose. You should get rid of them (and their corresponding END statements, of course).
One error I did not fix: ALTER SYSTEM is not a PL/SQL statement. It's a SQL statement. You can run a SQL statement inside PL/SQL by using dynamic SQL, where you construct a string containing the SQL statement, and then use dbms_sql or EXECUTE IMMEDIATE to run it.
Edited by: Frank Kulash on Aug 18, 2009 12:37 PM -
Call function RFC in a loop and kill old session
Hi,
we have a problem with a program.
here's a part of the code:
DO.
CALL FUNCTION 'YC_REFRESH_GPT_START_CM25' STARTING NEW TASK 'TEST'
EXPORTING
i_profile = p_prfl
i_werks = p_werks
i_arbpl_low = s_arbpl-low
i_arbpl_high = s_arbpl-high
TABLES
t_arbpl = it_arbpl.
PERFORM wait_for_refresh.
PERFORM terminate_session.
ENDDO.
So the program does a call function, waits a while, then terminates the session and recalls the function.
Apparently, like this the data should be updated.
But in the terminate session, the session is terminated using:
CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_delete_mode
ID 'MODE' FIELD l_mode.
And it works the first time, but the second time there is a dump.
So, is there another way to achieve what this program is trying to do?
Or is there another way to kill the session?
Thanks!!Hi,
the DLL will stay in memory as long as there is a program running which has not closed (unloaded) the DLL.
Doing repetitive calls to the DLL is irrelevant in this context. LV opens the DLL as soon as needed and will only unload it when there is no VI in memory which has a CLN to that DLL...
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
Killing all sessions at once who are locking the objects
Hello all,
i am working in 9i Oracle RDBMS on AIX IBM OS
most of the time we face locking issue and there comes more then different 50 sessions which locking different tables.
here is my script to find out what sessions are locking what tables.
set lines 200
set pages 50000
col SID for 99999
col SERIAL# for 999999
col username format a12
col sql format a55
col event format a50
col program format a40
col MINS for 9999
col ID1 for 999999
col object_name for a35
col locktype for a8;
select /*+ ORDERED */ s.sid,s.serial#,s.status,round(s.last_call_et/60) MINS,s.program,l.ID1,d.object_name,d.object_type,l.type as locktype
from v$lock l,v$session s, dba_objects d
where l.sid = s.sid
and l.ID1 = d.object_id
and s.username = 'MULDMS'
and last_call_et > 120 and l.type <> 'TX' order by s.status,MINS,l.ID1,l.type; and the out put it gives something like
SID SERIAL# STATUS MINS PROGRAM ID1 OBJECT_NAME OBJECT_TYPE LOCKTY
8981 1069 ACTIVE 2 frmweb@Appsdms31 (TNS V1-V3) 30407 VH_BTN TABLE TM
1642 512 ACTIVE 15 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
690 1057 ACTIVE 17 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
699 1787 ACTIVE 17 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
690 1057 ACTIVE 17 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
690 1057 ACTIVE 17 [email protected] (TNS V1-V3) 30643 VT_CHECK_INOUT TABLE TM
10877 895 ACTIVE 18 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
6654 1085 ACTIVE 18 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
1912 1655 ACTIVE 18 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
10877 895 ACTIVE 18 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
6654 1085 ACTIVE 18 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
1912 1655 ACTIVE 18 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
1754 1582 ACTIVE 18 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
10877 895 ACTIVE 18 [email protected] (TNS V1-V3) 30643 VT_CHECK_INOUT TABLE TM
6654 1085 ACTIVE 18 [email protected] (TNS V1-V3) 30643 VT_CHECK_INOUT TABLE TM
10708 982 ACTIVE 19 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
5428 855 ACTIVE 19 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
10708 982 ACTIVE 19 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
5428 855 ACTIVE 19 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
10278 897 ACTIVE 20 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
6261 1056 ACTIVE 20 frmweb@appsdms12 (TNS V1-V3) 28846 AM_DOCS TABLE TM
6598 1413 ACTIVE 20 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
1312 1000 ACTIVE 20 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
10278 897 ACTIVE 20 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
6261 1056 ACTIVE 20 frmweb@appsdms12 (TNS V1-V3) 30407 VH_BTN TABLE TM
1312 1000 ACTIVE 20 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
3521 717 ACTIVE 20 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
6598 1413 ACTIVE 20 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
6598 1413 ACTIVE 20 [email protected] (TNS V1-V3) 30643 VT_CHECK_INOUT TABLE TM
1312 1000 ACTIVE 20 [email protected] (TNS V1-V3) 30643 VT_CHECK_INOUT TABLE TM
9131 1002 INACTIVE 2 [email protected] (TNS V1-V3) 30455 VH_PSF TABLE TM
4887 1040 INACTIVE 2 [email protected] (TNS V1-V3) 30455 VH_PSF TABLE TM
151 1982 INACTIVE 2 [email protected] (TNS V1-V3) 80224 RD_ENQEXD TABLE TM
846 988 INACTIVE 3 [email protected] (TNS V1-V3) 29228 GM_VIN TABLE TM
5364 1149 INACTIVE 3 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
9934 789 INACTIVE 3 [email protected] (TNS V1-V3) 30455 VH_PSF TABLE TM
7511 1092 INACTIVE 3 [email protected] (TNS V1-V3) 30455 VH_PSF TABLE TM
3595 1104 INACTIVE 3 [email protected] (TNS V1-V3) 30455 VH_PSF TABLE TM
846 988 INACTIVE 3 [email protected] (TNS V1-V3) 30455 VH_PSF TABLE TM
945 670 INACTIVE 3 [email protected] (TNS V1-V3) 30455 VH_PSF TABLE TMand then i have to kill the session one by one . thaat is a tedious task to do.
i want to modify this script which will give me all the kill statement and i just have to run it
can someone help me in this regard as i am weak in sql/plsql
thanks and many thanks>
i want to modify this script which will give me all the kill statement and i just have to run it
>
Karthick's script will 'kill' the sessions but before you use that script you may want to read the docs about the KILL and DISCONNECT clauses.
See the DISCONNECT SESSION and KILL SESSION clauses in the SQL Language doc
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_2013.htm#sthref4724
>
DISCONNECT SESSION Clause
Use the DISCONNECT SESSION clause to disconnect the current session by destroying the dedicated server process (or virtual circuit if the connection was made by way of a Shared Sever).
The IMMEDIATE setting disconnects the session and recovers the entire session state immediately, without waiting for ongoing transactions to complete.
KILL SESSION Clause
The KILL SESSION clause lets you mark a session as terminated, roll back ongoing transactions, release all session locks, and partially recover session resources.
IMMEDIATE Specify IMMEDIATE to instruct Oracle Database to roll back ongoing transactions, release all session locks, recover the entire session state, and return control to you immediately.
>
For DISCONNECT the IMMEDIATE clause will recover the session state 'immediately'.
Using KILL, even with the IMMEDIATE clause, you are telliing Oracle to roll back any ongoing transactions and that can take a lot of time.
Make sure you are really doing the operation you want to do. If you want to get the locks released immediately you need to use 'DISCONNECT IMMEDIATE'.
Maybe you are looking for
-
What file format do I need to put a movie on my ipod?
I don't know how to get movies on my ipod. Do I have to use an imac? Does it have to be in mp4 format? Can it be QuickTime?
-
Is this even possible in numbers?
I have a list that I'm trying to group into categories. I want to select multiple cells and either in the same table, group their total together to be displayed on a chart, or put the sum of those cells into another table where I can then create a ch
-
I have downloaded I-Cloud and the new ios program. Where do my text go through now if they don't show up on my bill in the data usage section? When I get a text from friends sometime their e-mail address shows at the top of the message instead of the
-
It is common many time I open link or try to attach a file to email I get script not working message. This at times not go away even I stop it and I can't close sites also. I have to close through Ctrl+Alt+Delete route. What could be the reason and a
-
Hi Experts, We want to create an Alert at the time of Oracle Applications Login time for specific user and responsibility only. How can I accomplish this ? Can anyone help me in this regards ? Thanks in advance Sanjay