Updating  a  row  in  table  exclusive  lock on entire table

Hi
We have table master table and few child tables .
when we try to update a row in master table , it is locking entire table
i.e seems update process holding exclusive lock on entire table
it is not allowing any furthur update to that table
Could you please tell me what could be the problem for that
Thanks,
- AK

Does the table has primary key - foreign key relationship? Try disabling the constraint and see if it works. If it works then it is about unindexed foreign key issue.

Similar Messages

  • Monitor exclusive lock on a table and send notification email through EM

    Hi,
    I have Oracle10g and EM10G running on different servers.
    now one of my plsql code creates an exclusive lock on one of my tables.
    i want to monitor this exclusive lock on this table through the EM. and when the exclusive lock on the table is continuing for more than 1 hour, i want an email notification sent to me by the EM.
    How can i do this?
    Can someone help me achieve this above situation.
    Thanks.
    Philip.

    One of the nice about OEM is that a lot of the things are self explanatory. E.g. I never read docs to set up our first user defined metrics. It is really just to dive in there. Define a metric and the sql you want to use for monitoring the lock. Then you just go and create email notification for this when it hits warning or critical treshold.

  • Will it lock the entire table?

    Here is the table structure……….
    Table1(columnP, column1, column2) where columnP is the primary key.
    Update Table1 set column1 =’22’ where column1 =’11’
    In the above code,
    1.     Primary key is not used in the where criteria for the update.
    2.     Updating the same column which is used in the WHERE criteria.
    Does the above code will lock the entire table to update the data?
    Oracle 10g R2
    Thank you,
    Smith

    >
    Table1(columnP, column1, column2) where columnP is the primary key.
    Update Table1 set column1 =’22’ where column1 =’11’
    In the above code,
    1. Primary key is not used in the where criteria for the update.
    2. Updating the same column which is used in the WHERE criteria.
    Does the above code will lock the entire table to update the data?
    >
    This would (of course) lock only the rows with column1='11', regardless of your oracle version.
    Regardless also, whether there is a primary key or not, by the way.
    Kind regards
    Uwe
    http://uhesse.wordpress.com

  • Exclusive locks on IFS tables

    We have a servlet application that accesses IFS 9.0.1.1 via the IFS API.
    We are having a problem where sessions are putting an exclusive lock on certain SYS_LOBnnnnnnnnn objects which (in turn) prevents other sessions from gaining an exclusive lock on the ODM_DOCUMENT table.
    Today, the following statement (issued by some IFS API call) was causing an exclusive lock which was never released:
    update odm_document set READBYOWNER := 1 where id = :2
    This statement put an exclusive lock on the SYS_LOB0000046893C00006$$ object and that lock was never released and we had to kill the session.
    Any guidance would be appreciated. Thanks.

    The mappings when run does acquire an exclusive lock on the target table and yes it does only when it is run in set based mode, this is absolutely true. If you run a mapping in set based mode and loading some data in millions it takes an exclusive lock on the target table. You can verify it by querying the v$lock table, or by using the session browser in any of SQL querying tools.
    The problem can be overcome by running in row based mode as suggested by you, but when data volume is huge I dont think the row based mode gives a satisfactory preformance.
    Anyways, thanks for all your suggestions. Lets see if I can find any other way out.

  • Using OleDbDataAdapter Update with InsertCommands and getting blocking locks on Oracle table

    The following code snippet shows the use of OleDbDataAdapter with InsertCommands.  This code is producing many inserts on the Oracle table and is now suffering from contention... all on the same table.  How does the OleDbDataAdapter produce
    inserts from a dataset... what characteristics do these inserts inherent in terms of batch behavior... or do they naturally contend for the same resource. 
    oc.Open();
    for (int i = 0; i < xImageId.Count; i++)
    // Create the oracle adapter using a SQL which will not return any actual rows just the structure
    OleDbDataAdapter da =
       new OleDbDataAdapter("SELECT BUSINESS_UNIT, INVOICE, ASSIGNMENT_ID, END_DT, RI_TIMECARD_ID, IMAGE_ID, FILENAME, BARCODE_LABEL_ID, " +
       "DIRECT_INVOICING, EXCLUDE_FLG, DTTM_CREATED, DTTM_MODIFIED, IMAGE_DATA, PROCESS_INSTANCE FROM sysadm.PS_RI_INV_PDF_MERG WHERE 1 = 2", oc);
    // Create a data set
    DataSet ds = new DataSet("documents");
    da.Fill(ds, "documents");
    // Loop through invoices and write to oracle
    string[] sInvoices = invoiceNumber.Split(',');
    foreach (string sInvoice in sInvoices)
        // Create a data set row
        DataRow dr = ds.Tables["documents"].NewRow();
        ... map the data
        // Populate the dataset
        ds.Tables["documents"].Rows.Add(dr);
    // Create the insert command
    string insertCommandText =
        "INSERT /*+ append */ INTO PS_table " +
        "(SEQ_NBR, BUSINESS_UNIT, INVOICE, ASSIGNMENT_ID, END_DT, RI_TIMECARD_ID, IMAGE_ID, FILENAME, BARCODE_LABEL_ID, DIRECT_INVOICING, " +
        "EXCLUDE_FLG, DTTM_CREATED, DTTM_MODIFIED, IMAGE_DATA, PROCESS_INSTANCE) " +
        "VALUES (INV.nextval, :BUSINESS_UNIT, :INVOICE, :ASSIGNMENT_ID, :END_DT, :RI_TIMECARD_ID, :IMAGE_ID, :FILENAME,  " +
        ":BARCODE_LABEL_ID, :DIRECT_INVOICING, :EXCLUDE_FLG, :DTTM_CREATED, :DTTM_MODIFIED, :IMAGE_DATA, :PROCESS_INSTANCE)";
    // Add the insert command to the data adapter
    da.InsertCommand = new OleDbCommand(insertCommandText);
    da.InsertCommand.Connection = oc;
    // Add the params to the insert
    da.InsertCommand.Parameters.Add(":BUSINESS_UNIT", OleDbType.VarChar, 5, "BUSINESS_UNIT");
    da.InsertCommand.Parameters.Add(":INVOICE", OleDbType.VarChar, 22, "INVOICE");
    da.InsertCommand.Parameters.Add(":ASSIGNMENT_ID", OleDbType.VarChar, 15, "ASSIGNMENT_ID");
    da.InsertCommand.Parameters.Add(":END_DT", OleDbType.Date, 0, "END_DT");
    da.InsertCommand.Parameters.Add(":RI_TIMECARD_ID", OleDbType.VarChar, 10, "RI_TIMECARD_ID");
    da.InsertCommand.Parameters.Add(":IMAGE_ID", OleDbType.VarChar, 8, "IMAGE_ID");
    da.InsertCommand.Parameters.Add(":FILENAME", OleDbType.VarChar, 80, "FILENAME");
    da.InsertCommand.Parameters.Add(":BARCODE_LABEL_ID", OleDbType.VarChar, 18, "BARCODE_LABEL_ID");
    da.InsertCommand.Parameters.Add(":DIRECT_INVOICING", OleDbType.VarChar, 1, "DIRECT_INVOICING");
    da.InsertCommand.Parameters.Add(":EXCLUDE_FLG", OleDbType.VarChar, 1, "EXCLUDE_FLG");
    da.InsertCommand.Parameters.Add(":DTTM_CREATED", OleDbType.Date, 0, "DTTM_CREATED");
    da.InsertCommand.Parameters.Add(":DTTM_MODIFIED", OleDbType.Date, 0, "DTTM_MODIFIED");
    da.InsertCommand.Parameters.Add(":IMAGE_DATA", OleDbType.Binary, System.Convert.ToInt32(filedata.Length), "IMAGE_DATA");
    da.InsertCommand.Parameters.Add(":PROCESS_INSTANCE", OleDbType.VarChar, 10, "PROCESS_INSTANCE");
    // Update the table
    da.Update(ds, "documents");

    Here is what Oracle is showing as blocking locks and the SQL that has been identified with each of the SIDS.  Not sure why there is contention.  There are no triggers or joined tables in this piece of code.
    Here is the SQL all of the SIDs below are running:
    INSERT INTO sysadm.PS_RI_INV_PDF_MERG (SEQ_NBR, BUSINESS_UNIT, INVOICE, ASSIGNMENT_ID, END_DT, RI_TIMECARD_ID, IMAGE_ID, FILENAME, BARCODE_LABEL_ID, DIRECT_INVOICING, EXCLUDE_FLG, DTTM_CREATED, DTTM_MODIFIED, IMAGE_DATA, PROCESS_INSTANCE) VALUES (SYSADM.INV_PDF_MERG.nextval,
    :BUSINESS_UNIT, :INVOICE, :ASSIGNMENT_ID, :END_DT, :RI_TIMECARD_ID, :IMAGE_ID, :FILENAME, :BARCODE_LABEL_ID, :DIRECT_INVOICING, :EXCLUDE_FLG, :DTTM_CREATED, :DTTM_MODIFIED, :IMAGE_DATA, :PROCESS_INSTANCE)
    SID 1452 (BTSUSER,BIZTPRDI,BTSNTSvc64.exe) in instance FSLX1 is blocking SID 1150 (BTSUSER,BIZTPRDI,BTSNTSvc64.exe) in instance FSLX1
    SID 1452 (BTSUSER,BIZTPRDI,BTSNTSvc64.exe) in instance FSLX1 is blocking SID 1452 (BTSUSER,BIZTPRDI,BTSNTSvc64.exe) in instance FSLX1
    SID 1452 (BTSUSER,BIZTPRDI,BTSNTSvc64.exe) in instance FSLX1 is blocking SID 1156 (BTSUSER,biztprdi,BTSNTSvc64.exe) in instance FSLX3
    SID 1452 (BTSUSER,BIZTPRDI,BTSNTSvc64.exe) in instance FSLX1 is blocking SID 6 (BTSUSER,BIZTPRDI,BTSNTSvc64.exe) in instance FSLX2
    SID 1452 (BTSUSER,BIZTPRDI,BTSNTSvc64.exe) in instance FSLX1 is blocking SID 1726 (BTSUSER,BIZTPRDI,BTSNTSvc64.exe) in instance FSLX2
    SID 1452 (BTSUSER,BIZTPRDI,BTSNTSvc64.exe) in instance FSLX1 is blocking SID 2016 (BTSUSER,biztprdi,BTSNTSvc64.exe) in instance FSLX2

  • How to update the Field by  Remove Leading Zeroes in Entire table

    Hi all,
    I need an SQL query to update the Table by upadating a particular field(column) by removing all the leading zeroes for all the rows corresponding to that column.
    Ex:;
    Existing To be changed to::(New Table)
    A B New A New B
    000011 1 11 1
    000012 2 12 2
    000013 3 13 3
    Thanks in Advance,
    plz do reply soon..

    Come on, it's not that hard:
    UPDATE your_table
       SET yourcolumn = ltrim(yourcolumn, '0')
    ;You are aware, that you have to commit those changes afterwards, right? If you don't know, what UPDATE / COMMIT in an Oracle database means, you may want to take a look at the user guides first.
    C.

  • UPDATE single ROW from DATAGRID without refreshing the entire ItemsSource

    Hello there,
       I have a simple datagrid that has an ItemsSource of ObjectQuery<DbDataRecord>.
       Let's say I want to refresh a single row from the datagrid, (Because a specific item i know has been changed) without refreshing the entire ItemsSource because the source query is quite big.
    Any ideas?
    Thanks.
    -- Jorge_M_P

    Whilst you could raise property changed on every field in an item, that would of course mean implementing inotifypropertychanged on a wrapper object, then iterating all of those properties.
    An observablecollection implements the INotifyCollectionChanged interface.
    Amongst the possibilities for changes which that notifies are this one:
    https://msdn.microsoft.com/en-us/library/ms653207(v=vs.110).aspx
    Which notifies of a single item change.
    I usually wrap my entity framework objects.
    Sometimes I wrap all the properties so I can do change tracking in the viewmodel.
    This is a technique similar to the one I use in this sample:
    https://gallery.technet.microsoft.com/WPF-Highlight-Changed-a77976d4
    Which wraps plain classes - but the principle is the same.
    And
    I wrap the object and expose that, as I do in this:
    http://social.technet.microsoft.com/wiki/contents/articles/28209.wpf-entity-framework-mvvm-walk-through-1.aspx
    Note that because I wrap the same objects returned from EF, there is very little overhead in using an observable collection there.
    Hope that helps.
    Recent Technet articles:
    Property List Editing ;  
    Dynamic XAML

  • Shared lock vs exclusive lock

    Hello
    I have a question.
    If we have two scott sessions. I am updating a table EMP in session 1. It means it is exclusively locked.It cannot be used by session 2. Then can we use select command on table EMP in session 2.?? This command shoul not work according to me. But it is working.
    Reply me.
    Thanks in anticipation.

    984426 wrote:
    But in shared / exclusive lock, we have a property that we can't acquire shared lock on data if it is exclusively locked and vice versa. that means readers block writers and vice versa.
    E.g. if T1 is updating a row then how T2 can read that row? If T2 is reading then that is inconsistent data as it will pick the non-updated value of that row until T1 commits.
    Please explain.
    I am having doubts in this topic.
    ThanksYou need to check back again the basic concepts from the Concepts guide. Your understanding about the Oracle's working is completely wrong.
    In Oracle, the Transaction Isolation Level is set to Read Committed . This means any kind of inconsistent data is not possible to be read by you and for that data , Oracle would create for you a consistent image using the Undo Blocks in which the old image is going to be stored till the time that transaction is not over( and even after that too for some time with conditions apply) . So if T1 is updating a row, T2 can't lock the same row as it would be locked exclusively and the S1 (another select) would be seeing an old and consistent image of that change only as long as it's not committed. What you said doesn't and won't work ever in Oracle.
    Read the first link that's given to you already.
    Aman....

  • UL type lock on a table blocking all other users

    Hi,
    We have a referential integrity constraint on a version enabled table, that refers to a non-version enabled table (highly active table..lots of inserts/updates). An insert into the version enabled table is causing a UL type lock and the non-versioned table is locked (literally the table is inaccessible) and we see blocking locks. How can I avoid this situation? Is there any OWM settings that will help me resolve this issue? I am using workspace manager version 10.2.0.4.2.
    Thanks.

    Hi,
    An insert into a child table requires a lock on the parent table which will block updates and deletes into its parent table(s) until the lock is released. This is done to maintain the validity of the constraint. Otherwise, it would be possible to have child rows without parents, which we obviously need to prevent from happening.
    If possible, you could commit/rollback the transaction involving the child table more frequently, so that the locks are released and dmls can proceed on the parent table.
    You can also take a look at the following thread.
    RIC in OWM - ORA-20171 deadlock detected ...
    It is specifically referring to deadlock situations, but it also explains our locking behavior for RIC tables.
    Regards,
    Ben

  • Locking in a Table

    Hello
    i am using oracle 9i.i have twq queries
    1)Is there any way to lock an entire table in the database.
    2)Is there any way to lock a particular row in a table.
    Regards Sourav

    1)Is there any way to lock an entire table in the database.--> there are 5 or 6 level of locks with regard to table.
    There is a command of locking a table.
    lock table ...
    2)Is there any way to lock a particular row in a table.
    --> select .. for update
    --> update a row and no commit

  • Archive data of using DART : Job lock problem in table TSP01

    Hi ,
    I'm facing problem while archiving from Production system to UNIX using DART.
    Using TC: FTW1A to data extract, once data has extracted, we need to do verifaction progess through TC. FTWE1(run a BG jobRTXWCHK4) and FTWD(BG Job RTXWCHK2).
    When I am running TC: FTWD(BG Job RTXWCHK2)to verify, it was holding an extensive lock on the TSP01 table for long period of time which blocking others processing with this table, So We need to terminate this job. For the time being solution is to run this job during weekends.But I want solution for this.
    Is any boby can help me in this problem?
    Regards,
    Nupur S Jaipuriyar

    Locking a row that does not exist can be difficult.
    On most database you can lock an entire table through "LOCK TABLE <table>", however this may be extreme. Potentially you could also insert an empty row into the table with the id that you want to lock, then you would have a write lock on the row until you commit the transaction.

  • Is there anything to figure out what has Updated the Rows?

    Is there any way we can figure out what proceduce/sql script/user has updated a row ?
    Regards,
    Neeraj.

    Hi,
    If the table update was a recent operation (and there is no activity on the DB + you have big redo file), you could find the information in the redo file...
    How to use logminer : take a look at Oracle documentation...

  • GTT table getting Row Exclusive lock

    I have a procedure which loads a table which is used for reporting.
    Currently it is a single process which picks up most of the data after joining 2-3 big tables(around 70-80GB) and then loading the main table.
    The joins are on PI and also partitions are also being used. Then a lot of updates are done on the main table to update other columns which are being picked from different tables.
    As the processing is happening on huge amount of data(around 1M), so processing is taking a lot of time.
    This process is taking around 40-45 minutes.
    I am planning to use parallelism to run it in 75 sessions. So the initial big insert will be faster and later on all the updates will be done on smaller chunks which will benefit the performance.
    I planned to use GTT table so that i dont have to create 75 temp tables for each sessions.
    But while using GTT table(ON COMMIT DELETE ROWS) in parallel sessions, i am seeing that the GTT table is getting Row Exclusive lock and the time taken by overall process is increasing by lot.
    So i tested by using 75 temp tables. There i saw that the performance has increased by lots as assumed initially.
    Please let me know if there is any other way or how to remove the locks on GTT table.

    First you should question why you think you need 75 GTT.
    Also your question contains no useful information
    (no four digit version of Oracle, no OS, no number of processors) , this paragrah
    Currently it is a single process which picks up most of the data after joining 2-3 big tables(around 70-80GB) and then loading the main table.
    The joins are on PI and also partitions are also being used. Then a lot of updates are done on the main table to update other columns which are being picked from different tables.
    As the processing is happening on huge amount of data(around 1M), so processing is taking a lot of time.
    This process is taking around 40-45 minutes.tells nothing,
    so basically your questions boils down to
    - Hey I come from a sqlserver background (this is just an educated guess), how can I find a workaround to wreck Oracle to make it work like sqlserver.
    75 parallel sessions on say 4 to 8 processors is a very bad idea, as these sessions will be simple competing for resources.
    Also a row exclusive lock is just that: a row level lock. This isn't a problem, usually.
    Sybrand Bakker
    Senior Oracle DBA

  • Identifying deadlocked resources in graph with 1 row lock and 1 table lock

    Hi, I have run into repeated occurrences of the deadlock graph at the bottom of this post and have a few questions about it:
    1. It appears that proc 44, session 548 is holding a row lock (X). Is the waiter, proc 30, session 542, trying to acquire a row lock (X) also or an exclusive table lock (X) on the table containing that row?
    2. Under what circumstances would something hold a row exclusive table lock (SX) and want to upgrade that to a share row exclusive table lock (SSX)?
    3. Our table cxml_foldercontent has a column 'structuredDataId' with a FK to cxml_structureddata.id and an ON DELETE SET NULL trigger. Would this help explain why an "update" to one table (i.e.g cxml_foldercontent) would also need to acquire a lock in a foreign table, cxml_structureddata?
    4. What is the difference between "Current SQL statement:" and "Current SQL statement for this session:"? That terminology is confusing. Is session 542 executing the "update" or the "delete"?
    5. In the "Rows waited on:" section is it saying that Session 542 is waiting on on obj - rowid = 0000BE63 - AAAL5jAAGAAA6tZAAK or that it is has the lock on that row and other things are waiting on it?
    A couple of notes:
    - the cxml_foldercontent.structuredDataId FK column has an index on it already
    Deadlock graph:
                           ---------Blocker(s)--------  ---------Waiter(s)---------
    Resource Name                    process session holds waits  process session holds waits
    TX-003a0011-000003d0        44       548     X               30        542             X
    TM-0000be63-00000000       30       542     SX              44        548     SX    SSX
    session 548: DID 0001-002C-000002D9     session 542: DID 0001-001E-00000050
    session 542: DID 0001-001E-00000050     session 548: DID 0001-002C-000002D9
    Rows waited on:
    Session 542: obj - rowid = 0000BE63 - AAAL5jAAGAAA6tZAAK
      (dictionary objn - 48739, file - 6, block - 240473, slot - 10)
    Session 548: no row
    Information on the OTHER waiting sessions:
    Session 542:
      pid=30 serial=63708 audsid=143708731 user: 41/CASCADE
      O/S info: user: cascade, term: unknown, ospid: 1234, machine:
                program: JDBC Thin Client
      application name: JDBC Thin Client, hash value=2546894660
      Current SQL Statement:
    update cascade.cxml_foldercontent set name=:1 , lockId=:2 , isCurrentVersion=:3 , versionDate=:4 , metadataId=:5 , permissionsId=:6 , workflowId=:7 , isWorkingCopy=:8 , parentFolderId=:9 , relativeOrder=:10 , cachePath=:11 , isRecycled=:12 , recycleRecordId=:13 , workflowComment=:14 , draftUserId=:15 , siteId=:16 , prevVersionId=:17 , nextVersionId=:18 , originalCopyId=:19 , workingCopyId=:20 , displayName=:21 , title=:22 , summary=:23 , teaser=:24 , keywords=:25 , description=:26 , author=:27 , startDate=:28 , endDate=:29 , reviewDate=:30 , metadataSetId=:31 , expirationNoticeSent=:32 , firstExpirationWarningSent=:33 , secondExpirationWarningSent=:34 , expirationFolderId=:35 , maintainAbsoluteLinks=:36 , xmlId=:37 , structuredDataDefinitionId=:38 , pageConfigurationSetId=:39 , pageDefaultConfigurationId=:40 , structuredDataId=:41 , pageStructuredDataVersion=:42 , shouldBeIndexed=:43 , shouldBePublished=:44 , lastDatePublished=:45 , lastPublishedBy=:46 , draftOriginalId=:47 , contentTypeId=:48  where id=:49
    End of information on OTHER waiting sessions.
    Current SQL statement for this session:
    delete from cascade.cxml_structureddata where id=:1

    Mohamed Houri wrote:
    What is important for a foreign key is to be indexed (of course if the parent table is deleted/merged/updated, or if a performance reason imposes it). Wether this index is unique or not doesn't matter (as far as i know).But, you should ask your self the following question : what is the meaning of having a 1 to 1 relationship between a parent and a child table ? if you succeed to create a unique index on your FK then this means that for each PK value corresponds at most one FK value!! Isn't it? is this what you want to have?Thanks, as I mentioned above, cxml_structureddata is actually the child table of cxml_foldercontent with 1 or more records' owningEntityId referring to rows in cxml_foldercontent. The reason for the FK on cxml_foldercontent.structuredDataId is a little ambiguous but it explained above.
    Will a TX-enqueue held on mode X always be waited on by another TX-enqueue row lock X? Or can it be waited on by an Exclusive (X) table lock?Not really clear. Sorry, are you saying my question is unclear or it's not clear why type of eXclusive lock session 542 is trying to acquire in the first line of the trace? Do you think that the exclusive lock being held by session 548 in the first line is on rows in cxml_foldercontent (due to the ON DELETE SET NULL on these child rows) or rows in the cxml_structureddata that it's actually deleting?
    Is there any way for me to tell for certain?
    The first enqueue is a TX (Transaction Enqueue) held by session 548 on mode X (exclusive). This session represents the blocking session. At the same time the locked row is waited on by the blocked session (542) and the wait is on mode X (exclusive). So put it simply, we have here session 542 waiting for session 548 to release it lock (may be by commiting/roll backing). At this step we are not in presence of a deadlock.
    The second line of the deadlock graph shows that session 542 is the blocking session and it is doing a TM enqueue (DML lock) held on SX(Shared eXclusive). While session 548(which is the waiting session) is blocked by session 542 and is waiting on SSX mode.
    Here we see that 548 is blocking session 542 via a TX enqueue and session 542 is blocking session 548 via a TM enqueue ---> That is the deadlock. Oracle will then immediately choose arbitrarlly a victim session (542 or 548) and kill its process letting the remaining session continuing its work.
    That is your situation explained here.Thanks, any idea why session 542 (the DELETE from cxml_structureddata) would be trying to upgrade it's lock to SSX? Is this lock mode required to update a child tables foreign key columns when using an ON DELETE SET NULL trigger? Having read more about SSX, I'm not sure I understand in what cases it's used. Is there a way for me to confirm with 100% certainty specifically which tables in the TM enqueue locks are being held on? Is session 548 definitely trying to acquire an SSX mode on my cxml_foldecontent table or could it be cxml_structureddata table?
    (a) Verify that all your FK are indexed (be carreful that the FK columns should be at the leading edge of the index)Thanks, we've done this already. When you say the "leading edge" you mean for a composite index? These indexes are all single column.
    (b) Verify the logic of the DML against cxml_foldercontentCan you be more specific? Any idea what I'm looking for?

  • Unable to update when executed, table gets lock Execution does not stop Execution even for an hour

    Following is my Query unable to update when Executed table gets lock Execution does not stop even for an hour.
    update Employees 
          set Status = 'Close'
          where statusid IN (select statusid 
                                             from MyView 
                                              where DownloadedDate ='2014-07-27 00:00:00.000'
    here Employee contains 3,00,000 of records and Subquery return 1,50,000 Empid 
    i tried in various ways but not able to solve, statusid  column have no index on,  i tried using cursor but it does not work.
    plz let me know how to solve this Issue, THANKS IN ADVANCE.

    Hello,
    You should better post your question to a more related Forum, like Transact-SQL or SQL Server Database Engine; this Forum is for samples & community Projects.
    Have you checked the execution plan if indexes are used?
    You could update the data in chunks, e.g. 10.000 rows per execution. For this you have to add a TOP clause and a filter to update only those, who are not updated yet.
    update TOP (10000) Employees
    set Status = 'Close'
    where statusid IN
    (select statusid
    from MyView
    where DownloadedDate ='2014-07-27 00:00:00.000')
    AND Status <> 'Close'
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

Maybe you are looking for