About synchronized dead lock

I tried to use while instead of wait() and notify() to let two thread communicate. Whether the loop will continue depends on the change of the flag----isFull & isEmpty, how ever it locks during the run . but if I remove the synchronized modifier before the add() and eat() method , it works . Who knows why synchronized will cause the lock , they are modifying two different methods!!!
The who programe i s shown below
Help if who knows thanks a lot to tell me
I want to know the inner mechanism of synchronized
email: [email protected]
class SoupTest {
public static void main(String args[]) {
     Soup s = new Soup();
     Producer p1 = new Producer(s);
     Consumer c1 = new Consumer(s);
     p1.setPriority(10);
     c1.setPriority(1);
p1.start();
c1.start();
class Consumer extends Thread {
private Soup soup;
public Consumer(Soup s) {
     soup = s;
public void run() {
     char c;
     for (int i = 0; i < 10; i++) {
     c = soup.eat();
     System.out.println("Ate a letter: " + c);
     try {
          sleep((int)Math.random() * 2000000000);
     } catch (InterruptedException e) { }
class Producer extends Thread {
private Soup soup;
private String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
public Producer(Soup s) {
     soup = s;
public void run() {
char c;
System.out.println("I am running");
for (int i = 0; i < 10; i++) {
c = alphabet.charAt((int)(Math.random() * 26));
soup.add(c);
System.out.println("Added " + c + " to the soup.");
System.out.print("mimi");
try {
sleep((int)(Math.random() * 100));
} catch (InterruptedException e) { }
System.out.print("kiki");
class Soup {
private char buffer[] = new char[6];
private int eatnext = 0;
private int addnext = 0;
// flags to keep track of our buffer status
public boolean isFull = false;
private boolean isEmpty = true;
public synchronized char eat() {
     char toReturn;
// we can't eat if there isn't anything in the buffer
System.out.println("Empty " + isEmpty) ;
     while (isEmpty) {
          //try {
     //wait();
     //} catch (InterruptedException e) {
     toReturn = buffer[eatnext];
     eatnext = (eatnext + 1) % 6;
// did we eat the last letter ��
     if (eatnext == addnext ) {
     isEmpty = true;
// we know the buffer can't be full, because we just ate
     isFull=false;
//      notify();
// return the letter to the thread that is eating
     return(toReturn);
public synchronized void add(char c) {
// wait around until there's room to add another letter
System.out.print("pipi");
while(isFull) {
     //try {
     //     wait(); // this will exit when isFull turns false
     // } catch (InterruptedException e) {
     // add the letter to the next available spot
System.out.println("add" + addnext) ;
     buffer[addnext] = c;
// change the next available spot
     addnext = (addnext + 1) % 6;
// are we full ?
     if (addnext == eatnext) {
     isFull = true;
     isEmpty = false;
//     notify();
}

Please use code formatting when you post code. No one likes to read code without indentation. (See formating tips just above the text field where you enter your text)
/Kaj

Similar Messages

  • Is this producer-consumer scenario safe about dead-lock?

    Hi friends!
    I'm developing an application with a producer-consumer scenario. It produces a dead-lock 10% of times approx I execute it . I think the real reason of the crashing resides on the concurrency, because executing only the following code it gets the "main" waiting blocked during its execution after looping the do{...}while(true) sometimes. I've developed this code:
    public class CubbyHole
        private int nFinishedThreads;
        private int nTotalThreads;
        public CubbyHole(int TotalThreads)
            this.nTotalThreads = nTotalThreads;
            this.nFinishedThreads = 0;
        public synchronized void put()
            this.nFinishedThreads++;
        public synchronized void get()
            while(nFinishedThreads < nTotalThreads)
                try
                    wait();
                catch(InterruptedException ie){}
            notifyAll();
    //import java.util.Random;
    public class Producer implements Runnable
        private CubbyHole container;
        public Producer(CubbyHole container)
            this.container = container;
        public void run()
            System.out.println(Thread.currentThread().getName() + " has begun");
            try{
                Random rand = new Random();
                Thread.sleep(Math.abs(rand.nextInt()*10));
            catch(InterruptedException ie){}
            System.out.println(Thread.currentThread().getName() + " has finished");
            container.put();
    public class Consumer implements Runnable
        private CubbyHole container;
        public Consumer(CubbyHole container)
            this.container = container;      
        public void run()
            System.out.println(Thread.currentThread().getName() + "is waiting for all threads to be finished");
            container.get();
            System.out.println(Thread.currentThread().getName() + "says all threads have finished");
    public class Application
        public static void main(String Args[])
            do{
                int nThreads = 2;
                CubbyHole container = new CubbyHole(nThreads);
                Thread[] ProducersArray = new Thread[nThreads];
                for(int i=0; i<nThreads; i++)
                    ProducersArray=
    new Thread(
    new Producer(container));
    ProducersArray[i].start();
    Thread finalWait = new Thread( new Consumer(container));
    finalWait.start();
    try
    finalWait.join();
    catch(InterruptedException ie){}
    System.out.println("Application has finished correctly");
    while(true);
    Please, execute it and give me your results: is the "main" waiting blocked to you?
    Is this producer-consumer code safe about dead-lock?
    If the answer is no... Why is it waiting blocked?
    Thank you in advance.
    P.D. I'm spanish, so my english is horrible! I'm sorry!

    Thanks ejp:
    Moreover, I suppose nothing happens if I write notifyAll() in both methods, put() and get(). In fact this matters only if the producer overwrites the memory space where data is stored, which is not my case.
    Is this so?

  • About Dead Lock on apps tables in 11.5.10.2

    Hi All,
    How to find and Kill dead lock on apps table (11.5.10) ?
    Reg
    Chirag Patel

    Chirag,
    Please refer to the following notes, it should be helpful.
    Note: 109061.1 - How to Check Whether an AOL Table is Locked
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=109061.1
    Note: 223559.1 - Oracle Application Object Library Table Lock Data Collection Test
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=223559.1
    Note: 732271.1 - R12 Oracle Application Object Library (FND): Table Lock Data Collection Test
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=732271.1

  • Dead Lock what made by another user!(patition table)

    I have a question about Dead-Lock!
    Our Situation is ..
    User "A" made a Patition Table, ACNT_WONJANG
    (without any Trigger,Function, Procedure)
    When "B" - another user - tried to drop its Partition,
    Dead-Lock invoked.
    but A droped it's Partition well.
    What can i Do?
    this is the trace file.
    /oracle/home/admin/ACNT/udump/ora_44478_acnt.trc
    Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
    With the Partitioning option
    JServer Release 8.1.7.0.0 - Production
    ORACLE_HOME = /oracle/home
    System name: AIX
    Node name: acnt
    Release: 3
    Version: 4
    Machine: 000C962D4C00
    Instance name: ACNT
    Redo thread mounted by this instance: 1
    Oracle process number: 15
    Unix process pid: 44478, image: oracle@acnt (TNS V1-V3)
    *** SESSION ID:(16.394) 2001-10-04 15:00:41.829
    A self-deadlock among DDL and parse locks
    is detected. In most cases, this self-deadlock
    is handled internally.
    This should be reported to Oracle Support
    ONLY IF an error is signalled back to the
    user on a command-line or screen.
    The following information may aid in finding
    user on a command-line or screen.
    The following information may aid in finding
    the problem.
    ORA-04020: deadlock detected while trying to lock object
    F03P.ACNT_WONJANG
    session: 440786b4 request: X
    LIBRARY OBJECT HANDLE: handle=43108348
    name=F03P.ACNT_WONJANG
    hash=76b93583 timestamp=NULL
    namespace=TABL/PRCD/TYPE flags=KGHP/TIM/SML/[02000000]
    kkkk-dddd-llll=0000-0001-0001 lock=S pin=S latch=0
    lwt=43108360[43108360,43108360] ltm=43108368[43108368,43108368]
    pwt=43108378[43108378,43108378] ptm=431083d0[431083d0,431083d0]
    ref=43108350[43108350,43108350] lnd=431083dc[4310824c,425b7ec4]
    LIBRARY OBJECT: object=431080d0
    flags=NEX[0002] pflags= [00] status=VALD load=0
    DATA BLOCKS:
    data# heap pointer status pins change
    0 431082d8 43108154 I/P/A 0 NONE
    HEAP DUMP OF DATA BLOCK 0:
    HEAP DUMP heap name="library cache" desc=0x431082d8
    HEAP DUMP heap name="library cache" desc=0x431082d8
    extent sz=0x224 alt=32767 het=8 rec=9 flg=2 opc=0
    parent=30000030 owner=431080d0 nex=0 xsz=0x0
    EXTENT 0
    Chunk 431080c0 sz= 196 perm "perm "
    alo=196
    431080C0 500000C5 00000000 00000000 000000C4 [P...............]
    431080D0 43108348 431080D4 431080D4 431080DC [C..HC...C...C...]
    431080E0 431080DC 00000000 00000000 00020100 [C...............]
    431080F0 00000000 00000000 00000000 00000000 [................]
    43108100 43108144 00000000 00000000 00000000 [C..D............]
    43108110 00000000 00000000 00000000 00000000 [................]
    Repeat 2 times
    43108140 00000000 431082D8 00000000 43108154 [....C.......C..T]
    43108150 00000000 00000000 00000000 00000000 [................]
    Repeat 1 times
    43108170 00000000 00000000 00000019 00000000 [................]
    43108180 00000000 [....]
    Total heap size = 196
    FREE LISTS:
    Bucket 0 size=0
    Total free space = 0
    UNPINNED RECREATABLE CHUNKS (lru first):
    Total free space = 0
    UNPINNED RECREATABLE CHUNKS (lru first):
    PERMANENT CHUNKS:
    Chunk 431080c0 sz= 196 perm "perm "
    alo=196
    Permanent space = 196

    carlyfromal wrote:
    Here's the thing I myself have an Ipad 3 that I got from Ebay that is activation locked and I have the same issue. Can't get the info. Well,since Apple conveniently decided to discontinue selling the Ipad 3 the only way I could get one was to buy a used one,so it looks to me like they could have some mercy and help a person unlock the thing. We're not dishonest people that go around stealing things,yet because of Apple's brilliant(I use that term sarcastically) idea to put this stupid new crap in place people like us who have to buy second-hand products have to suffer and get screwed out of money we had to save up to buy this stuff! And all anyone can come up with is "well boohoo" or "tough luck" or whatever! But,what about the rights of the rest of us?! Some of you may find this a tad rude, but oh well,tough luck!
    On the other hand, there are those of us that appreciate the theft protection provided by the latest IOS.
    There are certain things to watch out for when purchasing used devices of any sort, the first of which is to ensure that you're not buying stolen property.  Since you are unable to obtain cooperation from the seller, perhaps your device was stolen!

  • What is dead locks with oracle and wht is race condition wrt oracle

    what is dead locks with oracle and wht is race condition wrt oracle

    > And do you know what a race condition is all about?
    It is a term used to indicate several processes attempting to use the same resource that is not capable of servicing all these at the same time. This could be due to the resource not being thread safe or implemented as a serialised resource.
    It is often easy to look up definitions on Google. In the Google search field, type "define:race condition".
    The following [url http://www.google.co.za/search?hl=en&q=define%3Arace+condition&btnG=Google+Search&meta=]web definitions page is displayed.

  • DEAD LOCK ERROR

    When we are using our oracle application, our session hang every time the user update records. the DBA said that we have a dead lock error... the only thing he did is to reset sa database every time we in counter this problem. but we have this error every day, and i don't have an ideal regarding what is dead lock.

    you don't have a deadlock problem, because a deadlock will be "solved" as oracle simply kills the blocking session and rollbacks the changes.He is right. you might have blocking problem not dead lock problem. Find out the blocker and waiter and kill the blocker session.
    Following query would give you an idea about who is blocking and who is waiting for :
    select /*+ ordered */
    a.sid blocker_sid,
    -- c.sql_text,
    a.username blocker_username,
    a.serial#,
    -- a.logon_time,
    b.type,
    b.lmode mode_held,
    b.ctime time_held,
    c.sid waiter_sid,
    c.request request_mode,
    c.ctime time_waited
    from v$lock b, v$enqueue_lock c, v$session a, v$sqltext c
    where c.address=a.prev_sql_addr and
    a.sid = b.sid
    and b.id1 = c.id1(+)
    and b.id2 = c.id2(+)
    and c.type(+) = 'TX'
    and b.type = 'TX'
    and b.block = 1
    order by time_held, time_waited
    Look for blocker_id and waiter_id. If possible, kill blocker using following command.
    select sid,serial# from v$session where sid = blocker_sid;
    alter system kill session 'sid,serial#'';
    Jaffar

  • Where can I get oracle dead lock information

    Hi Experts,
    two days back I find oracle dead lock information at SM21 log file but when I checked today the old data was over written by new data.
    Where can I find oracle dead lock information other than SM21? can anyone please help
    Thanks in advance
    Regards
    Veera
    Edited by: Veerab on Apr 27, 2011 8:22 AM

    Hi,
    Have you refered [SAP Note 84348 - Oracle deadlocks, ORA-00060 |https://service.sap.com/sap/support/notes/84348]? It contains good detailed description about possible oracle deadlock situations and analysis.
    Along with the trace file generated by oracle (at directory /oracle/<SID>/saptrace/usertrace/), You can get historical information from alert<SID>.log file located at /oracle/<SID>/saptrace/background/.
    In alert<SID>.log file the deadlock situation is written with deadlock graph at the time of occurances.
    Regards,
    Bhavik G. Shroff

  • Dead lock effect

    hi friends
    i have one question, Few days before i read that
    " If there is deadlock in your database and if you enter SHUTDOWN IMMEDATE
    then it will wait to resolve the dead lock"
    i want to know that is it correct or not. plz replay
    saurabh

    Deadlock is resolved immediately by Oracle when it encounters one. One of the sessions in deadlock is terminated by Oracle. So I do not see a possibility that you can enter a shutdown immediate command while two other sessions are in deadlock.
    Btw, any reference about that reading?

  • Dead Lock occurred while accessing a Table

    Hi Experts,
    Yesterday i came across to an error Dead Lock occurred while accessing a Table and provides a dump message as"SQL error in the database when accessing a table" while monitoring process chains.I dis manual load it went fine.Can any one give the permanent fix about this issue.
    Thanks in advance,
    Mahesh

    Hi,
    You might need basis help. Just check following thread
    SQL Error in database when accessing a table
    sql error in the database when accessing a table in BW Extracts
    Thanks and regards

  • DB dead lock during update

    Hello,
    In our R/3 Enterprise 4.7 Production system running on Windows NT/MSSQL, I saw update errors in t-code SM13.
    Error details:
    Date : 07/19/2009
    No. of errors : 24
    All errors are for background user BATCH-ID
    Function Module    :    RKE_WRITE_ACT_LINE_ITEM_OP01
    Status     :      DB dead lock during update
    SM12 doesnt have any locks currently, not sure about status when these update errors occured.
    I didnt find any SAPnotes related to this F-module or similar.
    Can you please tell whether it is a serious issue and how to handle such errors?
    Regards,
    Roshan

    Hi,
    can u please let us know how many time u have seen this error in SM13. Also from how many days.
    If its only once u have seen, then no need to worry.
    Function Module : RKE_WRITE_ACT_LINE_ITEM_OP01
    Status : DB dead lock during update
    From above lines its clear that,  Function Module : RKE_WRITE_ACT_LINE_ITEM_OP01 was locked, so the update has failed to access that module. Since it had faield to update, so is the error in sm13 with reason DB dead lock during update.
    Can u please refer to the logs in SM21 and also to the trace files(of related work process) related to the same error(red color errors), Try to analyze from there, If u find any difficulties in doing so. Paste the same here  along with ur system verion/DB/OS/Patch level
    Regards,
    Ravi

  • Regarding the dead lock while index creation

    Hi,
    We have a requirement where we are trying to load and create the index for few cubes simulatneously, but it has resulted in dead lock situation, can you please tell us about this problem in detail.
    Thanks

    Hi Mahesh,
    This kind of problem will arrive when the index creation for ur data targets are happening and those data targets shares some common data like master data, since both will be refering to the same, usually dead locks situation comes into picture
    thanks,
    vinay
    Edited by: vinaykumarhs on Mar 20, 2011 12:26 AM

  • Dead lock and Blocking Lock

    I would like to understand what is major difference between Dead Locks and Blocking Locks in Oracle. If someone could explain or point me to good web Link I would really appreciate
    Thanks.

    Tony's advise is very good.
    In simple terms a blocking lock is a lock being held by one session that is preventing another session from performing an DML operation on the same data until the holding session commits or rollbacks.
    A deadlock is a situation where two or more sessions lock data in such a manner as each session is waiting on a resource held by another session so that none of the session can complete their unit of work. That is session A locks row 1 then session B locks row 2 followed by session A attempts to lock row 2 while session B now attemps to lock row 1. Neither session A or B will ever be able to complete thier transaction releasing the locks and allowing waiting sessions to process since each session is waiting on a resource that the other session has while holding a resource the other session needs. In other words a deadlock. Oracle detects deadlocks and kills one of the sessions freeing resources.
    HTH -- Mark D Powell --

  • Frequenet dead locks in SQL Server 2008 R2 SP2

    Hi,
    We are experiencing frequent dead locks in our application. We are using MSSQL Server 2008 R2 SP2 version. When our application is configured for 5-6 app servers, this issue is occurring frequently.
    But, when the same application is used with the MSSQL Server 2008 R2 or SQL Server 2012, we don't see the dead lock issue. From the error lock and sql trace, the error message is thrown for the database table JobLock. We have a stored procedure to insert/update
    for the above table when the job moves from one service to other. The same procedure works fine when used with the 2008 R2 and SQL Server 2012 Version.
    Is the above issue related to the hotfix from the below url?
    http://support.microsoft.com/kb/2703275
    Following error message is seen frequently in the log file.
    INFO : 03/24/2014 10:26:30:290 PM: [00007900:00005932] [Xerox.ISP.Workflow.ManagedActivity.PersistInTransaction] System.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 62) was deadlocked on lock resources with another process and has been
    chosen as the deadlock victim. Rerun the transaction.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
       at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
       at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
       at Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteNonQuery(DbCommand command)
       at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteNonQuery(DbCommand command, DbTransaction transaction)
       at Xerox.ISP.DataAccess.Data.Utility.ExecuteNonQuery(TransactionManager transactionManager, DbCommand dbCommand)
       at Xerox.ISP.DataAccess.Data.SqlClient.SqlActivityProviderBase.ActivityReady(TransactionManager transactionManager, Int32 start, Int32 pageLength, Nullable`1 ActivityID, Nullable`1 JobId, String ContentUrl, Nullable`1 PrevWorkStep, Nullable`1
    CurrentWorkStep, String Principal, Nullable`1 Status, Nullable`1 ServerID, String HostName, Nullable`1 LockUserID, Nullable`1& ErrorCode, Byte[]& Activity_TS)
       at Xerox.ISP.DataAccess.Domain.ActivityBase.ActivityReady(Nullable`1 ActivityID, Nullable`1 JobId, String ContentUrl, Nullable`1 PrevWorkStep, Nullable`1 CurrentWorkStep, String Principal, Nullable`1 Status, Nullable`1 ServerID, String HostName,
    Nullable`1 LockUserID, Nullable`1& ErrorCode, Byte[]& Activity_TS, Int32 start, Int32 pageLength)
       at Xerox.ISP.DataAccess.Domain.ActivityBase.ActivityReady(Nullable`1 ActivityID, Nullable`1 JobId, String ContentUrl, Nullable`1 PrevWorkStep, Nullable`1 CurrentWorkStep, String Principal, Nullable`1 Status, Nullable`1 ServerID, String HostName,
    Nullable`1 LockUserID, Nullable`1& ErrorCode, Byte[]& Activity_TS)
       at Xerox.ISP.Workflow.ManagedActivity.<>c__DisplayClass2f.<ActivityReady>b__2d()
       at Xerox.ISP.Workflow.ManagedActivity.PersistInTransaction(Boolean createNew, PersistMethod persist)
    ClientConnectionId:9e44a64f-5014-4634-9cee-4581e1b9c299
    I look forward to the suggestions to get the issue resolved. Your input is much appreciated.
    Thanks,
    Keshava.

    If you are having deadlock trouble in your SQL Server instance, this recipe demonstrates how to make sure deadlocks are logged to the SQL ServerManagement Studio SQL log appropriately using
    the DBCC TRACEON, DBCC TRACEOFF, and DBCC TRACESTATUS commands. These functions enable, disable, and check the status of trace flags.
    To determine the cause of a deadlock, we need to know
    the resources involved and the types of locks acquired and requested. For this kind of information, SQL Server provides
    Trace Flag 1222 (this flag supersedes 1204, which was frequently used in earlier versions of SQL Server.)
    DBCCTRACEON(1222,
    -1);
    GO
    With this flag enabled, SQL Server will provide output in the form of a deadlock graph, showing the executing statements
    for each session, at the time of the deadlock; these are the statements that were blocked and so formed the conflict or cycle that led to the deadlock.
    Be aware that it is rarely possible to guarantee that deadlocks will never occur. Tuning for deadlocks
    primarily involves minimizing the likelihood of their occurrence. Most of the techniques for minimizing the occurrence of deadlocks are similar to the general techniques for minimizing blocking problems.

  • Dead lock error while updating data into cube

    We have a scenario of daily truncate and upload of data into cube and volumes arrive @ 2 million per day.We have Parallel process setting (psa and data targets in parallel) in infopackage setting to speed up the data load process.This entire process runs thru process chain.
    We are facing dead lock issue everyday.How to avoid this ?
    In general dead lock occurs because of degenerated indexes if the volumes are very high. so my question is does deletion of Indexes of the cube everyday along with 'deletion of data target content' process help to avoiding dead lock ?
    Also observed is updation of values into one infoobject is taking longer time approx 3 mins for each data packet.That infoobject is placed in dimension and defined it as line item as the volumes are very high for that specific object.
    so this is over all scenario !!
    two things :
    1) will deletion of indexes and recreation help to avoid dead lock ?
    2) any idea why the insertion into the infoobject is taking longer time (there is a direct read on sid table of that object while observed in sql statement).
    Regards.

    hello,
    1) will deletion of indexes and recreation help to avoid dead lock ?
    Ans:
    To avoid this problem, we need to drop the indexes of the cube before uploading the data.and rebuild the indexes...
    Also,
    just find out in SM12 which is the process which is causing lock.... Delete that.
    find out the process in SM66 which is running for a very long time.Stop  this process.
    Check the transaction SM50 for the number of processes available in the system. If they are not adequate, you have to increase them with the help of basis team
    2) any idea why the insertion into the infoobject is taking longer time (there is a direct read on sid table of that object while observed in sql statement).
    Ans:
    Lie item dimension is one of the ways to improve data load as well as query performance by eliminationg the need for dimensin table. So while loading/reading, one less table to deal with..
    Check in the transformation mapping of that chs, it any rouitne/formula  is written.If so, this can lead to more time for processing that IO.
    Storing mass data in InfoCubes at document level is generally not recommended because when data is loaded, a huge SID table is created for the document number line-item dimension.
    check if your IO is similar to doc no...
    Regards,
    Dhanya

  • Restore using TSPITR Results  Dead lock error

    This is the step is followed but i am getting deadlock error .please give your valuable suggestion .
    Product Used:oracle 11g in linux environmnet
    1)Before taking backup get SCN number for restore.
    Command applied: Select current_scn from v$database;
    2)running Full backup of database
    Command applied:
    configure controlfile autobackup on;
    backup database;
    CROSSCHECK BACKUP;
    exit;
    3)Running level 0 incremental backup
    Command applied:
    BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 0 TAG ='WEEKLY' TABLESPACE TEST;
    exit;
    3) Running level 1 incremental backup
    Command applied:
    BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 1 TAG ='DAILY' TABLESPACE TEST;
    4)Before Restore(TSPITR) following procedure are applied under sysdba privilege
    Command applied:
    SQL 'exec dbms_backup_restore.manageauxinstance ('TSPITR',1)';
    5)TSPITR Restore command
    Command applied:
    run
    SQL 'ALTER TABLESPACE TEST OFFLINE'
    RECOVER TABLESPACE TEST UNTIL SCN 1791053 AUXILIARY DESTINATION '/opt/oracle/base/flash_recovery_area';
    SQL 'ALTER TABLESPACE TEST ONLINE';
    and i tried with this option also(the same error i was getting)
    Command applied:
    run
    SQL 'ALTER TABLESPACE TEST OFFLINE';
    SET UNTIL SCN 1912813;
    RESTORE TABLESPACE TEST ;
    RECOVER TABLESPACE TEST UNTIL SCN 1912813 AUXILIARY DESTINATION '/opt/oracle/base/flash_recovery_area';
    SQL 'ALTER TABLESPACE TEST ONLINE';
    The follwing error i get for above mentioned restore command
    Recovery Manager: Release 11.2.0.1.0 - Production on Tue Aug 17 18:11:18 2010
    Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
    connected to target database: NEW10 (DBID=2860680927)
    RMAN> run
    2> {
    3> SQL 'ALTER TABLESPACE TEST OFFLINE';
    4> RECOVER TABLESPACE TEST UNTIL SCN 1791053 AUXILIARY DESTINATION '/opt/oracle/base/flash_recovery_area';
    5> SQL 'ALTER TABLESPACE TEST ONLINE';
    6> }
    7>
    using target database control file instead of recovery catalog
    sql statement: ALTER TABLESPACE TEST OFFLINE
    Starting recover at 17-AUG-10
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=404 device type=DISK
    RMAN-05026: WARNING: presuming following set of tablespaces applies to specified point-in-time
    List of tablespaces expected to have UNDO segments
    Tablespace SYSTEM
    Tablespace UNDOTBS1
    Creating automatic instance, with SID='BkAq'
    initialization parameters used for automatic instance:
    db_name=NEW10
    db_unique_name=BkAq_tspitr_NEW10
    compatible=11.2.0.0.0
    db_block_size=8192
    db_files=200
    sga_target=280M
    processes=50
    db_create_file_dest=/opt/oracle/base/flash_recovery_area
    log_archive_dest_1='location=/opt/oracle/base/flash_recovery_area'
    #No auxiliary parameter file used
    starting up automatic instance NEW10
    Oracle instance started
    Total System Global Area 292933632 bytes
    Fixed Size 1336092 bytes
    Variable Size 100666596 bytes
    Database Buffers 184549376 bytes
    Redo Buffers 6381568 bytes
    Automatic instance created
    Running TRANSPORT_SET_CHECK on recovery set tablespaces
    TRANSPORT_SET_CHECK completed successfully
    contents of Memory Script:
    # set requested point in time
    set until scn 1791053;
    # restore the controlfile
    restore clone controlfile;
    # mount the controlfile
    sql clone 'alter database mount clone database';
    # archive current online log
    sql 'alter system archive log current';
    # avoid unnecessary autobackups for structural changes during TSPITR
    sql 'begin dbms_backup_restore.AutoBackupFlag(FALSE); end;';
    executing Memory Script
    executing command: SET until clause
    Starting restore at 17-AUG-10
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: SID=59 device type=DISK
    channel ORA_AUX_DISK_1: starting datafile backup set restore
    channel ORA_AUX_DISK_1: restoring control file
    channel ORA_AUX_DISK_1: reading from backup piece /opt/oracle/base/flash_recovery_area/NEW10/autobackup/2010_08_17/o1_mf_s_727280767_66nmo8x7_.bkp
    channel ORA_AUX_DISK_1: piece handle=/opt/oracle/base/flash_recovery_area/NEW10/autobackup/2010_08_17/o1_mf_s_727280767_66nmo8x7_.bkp tag=TAG20100817T142607
    channel ORA_AUX_DISK_1: restored backup piece 1
    channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
    output file name=/opt/oracle/base/flash_recovery_area/NEW10/controlfile/o1_mf_66o0wsh8_.ctl
    Finished restore at 17-AUG-10
    sql statement: alter database mount clone database
    sql statement: alter system archive log current
    sql statement: begin dbms_backup_restore.AutoBackupFlag(FALSE); end;
    contents of Memory Script:
    # set requested point in time
    set until scn 1791053;
    # set destinations for recovery set and auxiliary set datafiles
    set newname for clone datafile 1 to new;
    set newname for clone datafile 8 to new;
    set newname for clone datafile 3 to new;
    set newname for clone datafile 2 to new;
    set newname for clone datafile 9 to new;
    set newname for clone tempfile 1 to new;
    set newname for datafile 7 to
    "/opt/oracle/base/oradata/NEW10/test01.dbf";
    # switch all tempfiles
    switch clone tempfile all;
    # restore the tablespaces in the recovery set and the auxiliary set
    restore clone datafile 1, 8, 3, 2, 9, 7;
    switch clone datafile all;
    executing Memory Script
    executing command: SET until clause
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    renamed tempfile 1 to /opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_temp_%u_.tmp in control file
    Starting restore at 17-AUG-10
    using channel ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: starting datafile backup set restore
    channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
    channel ORA_AUX_DISK_1: restoring datafile 00001 to /opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_system_%u_.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00008 to /opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_system_%u_.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00003 to /opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_undotbs1_%u_.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00002 to /opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_sysaux_%u_.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00009 to /opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_sysaux_%u_.dbf
    channel ORA_AUX_DISK_1: reading from backup piece /opt/oracle/base/flash_recovery_area/NEW10/backupset/2010_08_17/o1_mf_nnndf_TAG20100817T140128_66nl7174_.bkp
    channel ORA_AUX_DISK_1: piece handle=/opt/oracle/base/flash_recovery_area/NEW10/backupset/2010_08_17/o1_mf_nnndf_TAG20100817T140128_66nl7174_.bkp tag=TAG20100817T140128
    channel ORA_AUX_DISK_1: restored backup piece 1
    channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:02:45
    channel ORA_AUX_DISK_1: starting datafile backup set restore
    channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
    channel ORA_AUX_DISK_1: restoring datafile 00007 to /opt/oracle/base/oradata/NEW10/test01.dbf
    channel ORA_AUX_DISK_1: reading from backup piece /opt/oracle/base/flash_recovery_area/NEW10/backupset/2010_08_17/o1_mf_nnnd0_WEEKLY_66nl9m8k_.bkp
    channel ORA_AUX_DISK_1: piece handle=/opt/oracle/base/flash_recovery_area/NEW10/backupset/2010_08_17/o1_mf_nnnd0_WEEKLY_66nl9m8k_.bkp tag=WEEKLY
    channel ORA_AUX_DISK_1: restored backup piece 1
    channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:06:55
    Finished restore at 17-AUG-10
    datafile 1 switched to datafile copy
    input datafile copy RECID=6 STAMP=727294911 file name=/opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_system_66o0x1sf_.dbf
    datafile 8 switched to datafile copy
    input datafile copy RECID=7 STAMP=727294911 file name=/opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_system_66o0x1r9_.dbf
    datafile 3 switched to datafile copy
    input datafile copy RECID=8 STAMP=727294911 file name=/opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_undotbs1_66o0x1vr_.dbf
    datafile 2 switched to datafile copy
    input datafile copy RECID=9 STAMP=727294911 file name=/opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_sysaux_66o0x1vj_.dbf
    datafile 9 switched to datafile copy
    input datafile copy RECID=10 STAMP=727294911 file name=/opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_sysaux_66o0x1rs_.dbf
    contents of Memory Script:
    # set requested point in time
    set until scn 1791053;
    # online the datafiles restored or switched
    sql clone "alter database datafile 1 online";
    sql clone "alter database datafile 8 online";
    sql clone "alter database datafile 3 online";
    sql clone "alter database datafile 2 online";
    sql clone "alter database datafile 9 online";
    sql clone "alter database datafile 7 online";
    # recover and open resetlogs
    recover clone database tablespace "TEST", "SYSTEM", "UNDOTBS1", "SYSAUX" delete archivelog;
    alter clone database open resetlogs;
    executing Memory Script
    executing command: SET until clause
    sql statement: alter database datafile 1 online
    sql statement: alter database datafile 8 online
    sql statement: alter database datafile 3 online
    sql statement: alter database datafile 2 online
    sql statement: alter database datafile 9 online
    sql statement: alter database datafile 7 online
    Starting recover at 17-AUG-10
    using channel ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: starting incremental datafile backup set restore
    channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
    destination for restore of datafile 00007: /opt/oracle/base/oradata/NEW10/test01.dbf
    channel ORA_AUX_DISK_1: reading from backup piece /opt/oracle/base/flash_recovery_area/NEW10/backupset/2010_08_17/o1_mf_nnnd1_DAILY_66nmf6qs_.bkp
    channel ORA_AUX_DISK_1: piece handle=/opt/oracle/base/flash_recovery_area/NEW10/backupset/2010_08_17/o1_mf_nnnd1_DAILY_66nmf6qs_.bkp tag=DAILY
    channel ORA_AUX_DISK_1: restored backup piece 1
    channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
    starting media recovery
    archived log for thread 1 with sequence 39 is already on disk as file /opt/oracle/base/flash_recovery_area/NEW10/archivelog/2010_08_17/o1_mf_1_39_66nmc1dg_.arc
    archived log for thread 1 with sequence 40 is already on disk as file /opt/oracle/base/flash_recovery_area/NEW10/archivelog/2010_08_17/o1_mf_1_40_66nmcfw4_.arc
    archived log for thread 1 with sequence 41 is already on disk as file /opt/oracle/base/flash_recovery_area/NEW10/archivelog/2010_08_17/o1_mf_1_41_66nmcwcf_.arc
    archived log for thread 1 with sequence 42 is already on disk as file /opt/oracle/base/flash_recovery_area/NEW10/archivelog/2010_08_17/o1_mf_1_42_66nmddbw_.arc
    archived log for thread 1 with sequence 43 is already on disk as file /opt/oracle/base/flash_recovery_area/NEW10/archivelog/2010_08_17/o1_mf_1_43_66o0wyys_.arc
    archived log file name=/opt/oracle/base/flash_recovery_area/NEW10/archivelog/2010_08_17/o1_mf_1_39_66nmc1dg_.arc thread=1 sequence=39
    archived log file name=/opt/oracle/base/flash_recovery_area/NEW10/archivelog/2010_08_17/o1_mf_1_40_66nmcfw4_.arc thread=1 sequence=40
    archived log file name=/opt/oracle/base/flash_recovery_area/NEW10/archivelog/2010_08_17/o1_mf_1_41_66nmcwcf_.arc thread=1 sequence=41
    archived log file name=/opt/oracle/base/flash_recovery_area/NEW10/archivelog/2010_08_17/o1_mf_1_42_66nmddbw_.arc thread=1 sequence=42
    archived log file name=/opt/oracle/base/flash_recovery_area/NEW10/archivelog/2010_08_17/o1_mf_1_43_66o0wyys_.arc thread=1 sequence=43
    media recovery complete, elapsed time: 00:00:50
    Finished recover at 17-AUG-10
    database opened
    contents of Memory Script:
    # make read only the tablespace that will be exported
    sql clone 'alter tablespace TEST read only';
    # create directory for datapump import
    sql "create or replace directory TSPITR_DIROBJ_DPDIR as ''
    /opt/oracle/base/flash_recovery_area''";
    # create directory for datapump export
    sql clone "create or replace directory TSPITR_DIROBJ_DPDIR as ''
    /opt/oracle/base/flash_recovery_area''";
    executing Memory Script
    sql statement: alter tablespace TEST read only
    sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/opt/oracle/base/flash_recovery_area''
    sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/opt/oracle/base/flash_recovery_area''
    Performing export of metadata...
    EXPDP> Starting "SYS"."TSPITR_EXP_BkAq":
    EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
    EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
    EXPDP> Processing object type TRANSPORTABLE_EXPORT/GRANT/OWNER_GRANT/OBJECT_GRANT
    EXPDP> Processing object type TRANSPORTABLE_EXPORT/INDEX
    EXPDP> Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
    EXPDP> Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS
    EXPDP> Processing object type TRANSPORTABLE_EXPORT/TRIGGER
    EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
    EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
    EXPDP> Master table "SYS"."TSPITR_EXP_BkAq" successfully loaded/unloaded
    EXPDP> ******************************************************************************
    EXPDP> Dump file set for SYS.TSPITR_EXP_BkAq is:
    EXPDP> /opt/oracle/base/flash_recovery_area/tspitr_BkAq_82690.dmp
    EXPDP> ******************************************************************************
    EXPDP> Datafiles required for transportable tablespace TEST:
    EXPDP> /opt/oracle/base/oradata/NEW10/test01.dbf
    EXPDP> Job "SYS"."TSPITR_EXP_BkAq" successfully completed at 18:25:02
    Export completed
    contents of Memory Script:
    # shutdown clone before import
    shutdown clone immediate
    # drop target tablespaces before importing them back
    sql 'drop tablespace TEST including contents keep datafiles';
    executing Memory Script
    database closed
    database dismounted
    Oracle instance shut down
    sql statement: drop tablespace TEST including contents keep datafiles
    Removing automatic instance
    shutting down automatic instance
    target database instance not started
    Automatic instance removed
    auxiliary instance file /opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_temp_66o1k480_.tmp deleted
    auxiliary instance file /opt/oracle/base/flash_recovery_area/NEW10/onlinelog/o1_mf_3_66o1k0mg_.log deleted
    auxiliary instance file /opt/oracle/base/flash_recovery_area/NEW10/onlinelog/o1_mf_2_66o1jyt4_.log deleted
    auxiliary instance file /opt/oracle/base/flash_recovery_area/NEW10/onlinelog/o1_mf_1_66o1jx3w_.log deleted
    auxiliary instance file /opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_sysaux_66o0x1rs_.dbf deleted
    auxiliary instance file /opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_sysaux_66o0x1vj_.dbf deleted
    auxiliary instance file /opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_undotbs1_66o0x1vr_.dbf deleted
    auxiliary instance file /opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_system_66o0x1r9_.dbf deleted
    auxiliary instance file /opt/oracle/base/flash_recovery_area/NEW10/datafile/o1_mf_system_66o0x1sf_.dbf deleted
    auxiliary instance file /opt/oracle/base/flash_recovery_area/NEW10/controlfile/o1_mf_66o0wsh8_.ctl deleted
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of recover command at 08/17/2010 18:25:36
    RMAN-03015: error occurred in stored script Memory Script
    RMAN-03009: failure of sql command on default channel at 08/17/2010 18:25:25
    RMAN-11003: failure during parse/execution of SQL statement: drop tablespace TEST including contents keep datafiles
    ORA-00604: error occurred at recursive SQL level 1
    ORA-00060: deadlock detected while waiting for resource
    Recovery Manager complete.
    please give your valuable suggestion .It should be more helpful for us.
    Edited by: user10750009 on Aug 20, 2010 1:07 AM
    Edited by: user10750009 on Aug 20, 2010 1:15 AM

    I want TSPITR ,during this operation i faced this deadlock error.
    Before that we faced roll backsegment error for that we applied follwing workaround .
    If i applied follwing workaround before every backup and restore .i didn't get any error .all things went successful.
    spool /tmp/Createtest.log
    connect / as sysdba
    REM Perform startup in case we are still down
    ALTER SYSTEM SET PROCESSES=500 SCOPE=SPFILE;
    SHUT IMMEDIATE;
    STARTUP MOUNT EXCLUSIVE;
    ALTER DATABASE ARCHIVELOG;
    ARCHIVE LOG START;
    ALTER DATABASE OPEN;
    connECT / as sysdba;
    alter system set undo_management = MANUAL scope=spfile;
    shutdown immediate;
    startup;
    Connect / as sysdba;
    DROP TABLE TEST123;
    create table test123 (t1 number, t2 varchar2(10));
    begin
    for i in 1.. 300000 loop
    insert into test values (i,'AAAAAAAAAA');
    end loop;
    end;
    delete test123;
    commit;
    alter system set undo_management = auto scope=spfile;
    shutdown immediate ;
    startup ;
    The above workaround we applied before creating tablespace and datafile ,after that we face some dead lock error while restore TSPITR .Did you need any more information
    Edited by: user10750009 on Aug 20, 2010 1:12 AM

Maybe you are looking for