How to solve ORA-04091

hi,
i made a trigger on a table fire on after insertion but i m having these error so plz try to solve it.
CREATE OR REPLACE TRIGGER TG1
AFTER INSERT
ON MASTER
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
COUNT NUMBER;
BEGIN
SELECT COUNT(*) INTO COUNT FROM MASTER
WHERE P_ID =:NEW.P_ID ;
BEGIN
IF COUNT=1 THEN
UPDATE MASTER SET PCODE =:COUNT;
END IF;
IF COUNT=2 THEN
UPDATE MASTER SET PCODE =:COUNT+1;
END IF;
END;
END;
ORA-04091: table master is mutating, trigger/function may
not see it
ORA-06512: at "TG1", line 5
ORA-04088: error during execution of trigger 'TG1'

You don't understand mutating tables and how to avoid them. Nor do you understand how multi-user systems work. Finally you appear not to understand how to use the documentation Given all that, your soubriquet is overambitious. You might want to consider a more modest handle.
As for the specifics, how to avoid the ORA-4091 error, the root cause is that we cannot select on the table in question in a FOR EACH ROW trigger. You seem to be after an incremental count, presumably as unique identifier. This is the wrong approach: use a sequence and stop worrying about gaps.
Cheers, APC
blog: http://radiofreetooting.blogspot.com

Similar Messages

  • How to solve ORA-01843: not a valid month error

    i am gettion ORA-01843: not a valid month error how to solve it. and how to find which record causing
    proble.
    Thanks in advance.

    EdStevens wrote:
    Ramin Hashimzadeh wrote:
    user1571313 wrote:
    i am gettion ORA-01843: not a valid month error how to solve it. and how to find which record causing
    proble.
    Thanks in advance.Bring for me something from somewhere... :)Bring me a shrubbery.
    When you have found the shrubbery, then you must cut down the mightiest tree in the forest ... with a herring.We are no longer the knights who say ni! We are now the knights who say "i am gettion ORA-01843"!

  • How to solve *ORA-28365: wallet is not open*

    hello frined
    please any one can tell me how to open wallent please tell solution of this error
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of backup plus archivelog command at 12/07/2009 09:11:15
    ORA-19914: unable to encrypt backup
    ORA-28365: wallet is not open
    i dont know the password of wallet :( how can i chenage or know password
    thanks
    kashif ahmed
    Edited by: user8285127 on Dec 6, 2009 9:41 PM

    Hi,
    I request to go through the below links, since it will give an idea, I think you have not yet created the wallet as per knowledge from you post.
    http://www.oracle-base.com/articles/10g/SecureExternalPasswordStore_10gR2.php
    http://www.packtpub.com/article/oracle-wallet-manager
    http://download.oracle.com/docs/cd/B13789_01/network.101/b10772/asowalet.htm
    It will hardly some time, but it will gain knowledge how to use it. Don't skip it.
    - Pavan Kumar N
    Oracle 9i/10g - OCP
    http://oracleinternals.blogspot.com/

  • How  to solve ora-00054 error while drop the constraint

    i am trying to drop the constraint for the table but it will give the below error.
    ora-00054 resource busy and acquire.
    can you please tell me solve this problem. but in my pc i am not using that table at any where in the system.
    ALTER TABLE EIIS_JBWSTOCK
    DROP CONSTRAINT CHK_TRAN_JOB_TYPE;
    this is my code for alter table constraint.
    thanks

    You may find <sid, serial#> and kill the session.
    SELECT c.owner,
           c.object_name,
           c.object_type,
           b.SID,
           b.serial#,
           b.status,
           b.osuser,
           b.machine
      FROM v$locked_object a, v$session b, dba_objects c
    WHERE b.SID = a.session_id AND a.object_id = c.object_id; --You may add extra condition for your table.
    ALTER SYSTEM KILL SESSION '<sid, serial#>'

  • How to solve ORA-31001?

    Hi,
    It seems as if I am the only one who runs into this problem
    because searching through this forum gave me no results.
    Trying the XML DB Basic Demo (downloaded from otn)
    and I get the a.m. error message
    ORA-31001: Resource-handle or pathname invalid /home/SCOTT/
    ORA-06512: "XDB.DBMS_XDB", line 168
    ORA-06512: line 4
    when I try to run the script 'create directories'.
    What's going wrong ?
    Using Oracle 9.2.0.1.0 on WinXP.
    Thans alot in advance,
    udo

    OK OK.. ;-))
    stupid question..
    already solved.
    thanks.
    udo

  • How to solve ORA-01555 for SELECT ? Thanks.

    I am running Oracle 9i on Solaris 9. I have a query that's supposed to processes massive records by joining several very big tables but dies with ORA-01555 error after hitting UNDO_RETENTION of 144000 (40 hours). The query plan looks pretty nice and robust.
    Instead of running the SELECT statement, what can be other approaches that can solve this problem?
    Thanks.

    The query plan can have flowers all over it, but saying it looks pretty nice doesn't really give us any information. We can't see your query, your table structures, your data or your execution plans or trace files, so we can't provide much help really.
    >
    ORA-01555: snapshot too old: rollback segment number string with name "string" too small
    Cause: rollback records needed by a reader for consistent read are overwritten by other writers
    Action: If in Automatic Undo Management mode, increase undo_retention setting. Otherwise, use larger rollback segments

  • How to solve "ORA-27101: shared memory realm does not exist"?

    I met a prpblem as follows:
    I'm getting the error whenever I try to start SQL*Plus:
    ORA-27101: shared memory realm does not exist? so I can run SQLPLUS hrs before, but now cannot. why?
    I attached my Listener.ora below, please find any error?:
    # LISTENER.ORA Network Configuration File: C:\Oracle\817\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC2))
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = con02)(PORT = 1521))
    (DESCRIPTION =
    (PROTOCOL_STACK =
    (PRESENTATION = GIOP)
    (SESSION = RAW)
    (ADDRESS = (PROTOCOL = TCP)(HOST = con02)(PORT = 2481))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = C:\Oracle\817)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = tibco)
    (ORACLE_HOME = C:\Oracle\817)
    (SID_NAME = tibco)
    I type following in command console,
    c:\>echo $ORACLE_SID
    $ORACLE_SID
    c:\>echo $ORACLE_HOME
    $ORACLE_HOME
    c:\>
    Please advise how to.
    Thanks

    your shareable memory area is not set for the oracle server. I think you install the server by using the command
    # echo 500m > /proc/sys/kernel/shmmax
    this command temporaryley increase the area not for permanent.
    so edit the file which is /etc/sysctl.conf and change this parameter "kernel.shmmax=536870912" and then reboot your system and start the oracle.
    If reboot is not an option the use this command to increase the required area.
    #echo 536870912 > /proc/sys/kernel/shmmax
    and then run the oracle.

  • How to solve ORA-12560:TNS:protocol adapter error?

    I'm trying to use sqlplus on Windows 2008 R2 which is installed on VirtualBox to access an Oracle 11gR2 database on Red Hat Linux.
    I'm sure that the database on Red Hat Linux is up and tnsnames.ora is a copy from another machine which is used by another application to connect to the same Oracle database.
    When I run sqlplus, I got the ORA-12560: TNS:protocol adapter error.
    sqlnet.ora
    SQLNET.AUTHENTICATION_SERVICES = (NTS)
    Both sqlnet.ora and tnsnames.ora are located in c:\app\administrator\product\11.2.0\client64\network\admin folder.
    The registry ORACL_HOME has c:\app\administrator\product\11.2.0\client64.
    echo %ORACLE_HOME% incommand window returns %ORACLE_HOME%
    echo %ORACL_SID% in command window returns %ORACLE_SID%
    If I set ORACLE_HOME to another folder, I will get the following error:
    Error 6 initializing SQL*Plus
    SP2-0667: Message file sp1<lang>.msb not found
    SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
    So, I believe the ORACLE_HOME in registry has the correct value.
    I have also tried set ORACLE_SID to the service name listed in tnsnames.ora but sqlplus still returns the ORA-12560:TNS:protocol adapter error.
    For unknown reason, the value of ORACLE_HOME and ORACLE_SID I set by using set command will not persist after I close the command window that I set the values.

    881656 wrote:
    I'm trying to use sqlplus on Windows 2008 R2 which is installed on VirtualBox to access an Oracle 11gR2 database on Red Hat Linux.
    I'm sure that the database on Red Hat Linux is up and tnsnames.ora is a copy from another machine which is used by another application to connect to the same Oracle database.
    When I run sqlplus, I got the ORA-12560: TNS:protocol adapter error.
    sqlnet.ora
    SQLNET.AUTHENTICATION_SERVICES = (NTS)
    It make NO sense do to as above when attempting to connect to Oracle DB on *NIX
    which knows NOTHING about NTS Authentication.
    SQLNET.AUTHENTICATION_SERVICES = (NONE)
    or just remove the line or whole file.
    Also need to be sure that ipchains is disabled on *NIX system                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How solve  ORA-04030: out of process memory when trying to allocate

    i am facing problems in oracle 10g and after establishing 250 sessions
    an error ocure
    how solve ORA-04030: out of process memory when trying to allocate
    how i can solve it.

    The Oracle version and if Oracle and the OS are 32 or 64 bit versions affect whether or not the /3GB or /PAE flags come into play.
    Also if pga_aggregate_target is not in use then the error generally means the userload is too large for available memory which could be because the previously mentioned switches are needed, because the user load is just to large for available resources, or that memory is being wasted by an excessive number of "dead" sessions. Again depending on the versions of the OS, Oracle, and the application space leaks could be an issue.
    Bouncing will reclaim space lost to space leaks and clean up dead sessions but it is best to know why the problem exists before bouncing cause once you reboot you lose most of the information that will tell you what the cause of the problem is unless you make it a point to capture debugging information first.
    HTH -- Mark D Powell --

  • ORA-24335 - cannot support more than 1000 columns - How to solve this?

    Hi,
    I got error message 'ORA-24335 - cannot support more than 1000 columns ' when i try to insert x no of rows for a table with following code:
    INSERT ALL
    INTO tableA Values ('A', 'B', 'C', 1, 2, 3)
    INTO tableA Values ('D', 'E', 'F', 4, 5, 6)
    INTO tableA Values ('G', 'H', 'I', 7, 8, 9)
    SELECT *
    FROM DUAL
    How to solve above?
    What does it really mean? It's not as easy as if my table has 10 columns than I can't insert more than 100 rows (1000 columns divided with 10 columns = maximun 100 rows to insert), or?
    Is there a better/more appropriate way to do insert many rows?
    Should I do my inserts with an OracleTransaction (My application is developed with C# and asp.net), as ~follows
    BEGIN
    INSERT INTO tableA Values ('A', 'B', 'C', 1, 2, 3)
    INSERT INTO tableA Values ('D', 'E', 'F', 4, 5, 6)
    INSERT INTO tableA Values ('G', 'H', 'I', 7, 8, 9)
    COMMIT
    END
    Thx in advance!
    Edited by: user8819407 on 2010-mar-07 15:40

    Hi,
    So how did you solve the problem? Can you please give an example?
    I have the same problem inserting over 1000 values into my Oracle DB. The table only has 51 columns but to speed up the insert command, I use bulk inserts via insert all command. I need to insert 100 rows at a time for a total of 5100 values.
    Example:
    SQLCmd = INSERT ALL INTO MYTABLE (VAL_ID,VAL_NAME,VAL_NUM,VAL_TIME,VAL_CMM,VAL_TIME1,VAL_TRIP,VAL_REMAINING,VAL_AGE,VAL_COUNT,VAL_RSTS,VAL_VOLT,VAL_RF,VAL_DC,VAL_HOPS,VAL_STATUS,VAL_ELAPSED,MODIFY_TIME) VALUES (?,?,?,TO_DATE(?,?),?,TO_DATE(?,?),?,?,?,?,?,?,?,?,?,?,?,SYSTIMESTAMP)
    INTO MYTABLE (VAL_ID,VAL_NAME,VAL_NUM,VAL_TIME,VAL_CMM,VAL_TIME1,VAL_TRIP,VAL_REMAINING,VAL_AGE,VAL_COUNT,VAL_RSTS,VAL_VOLT,VAL_RF,VAL_DC,VAL_HOPS,VAL_STATUS,VAL_ELAPSED,MODIFY_TIME) VALUES (?,?,?,TO_DATE(?,?),?,TO_DATE(?,?),?,?,?,?,?,?,?,?,?,?,?,SYSTIMESTAMP)
    INTO MYTABLE (VAL_ID,VAL_NAME,VAL_NUM,VAL_TIME,VAL_CMM,VAL_TIME1,VAL_TRIP,VAL_REMAINING,VAL_AGE,VAL_COUNT,VAL_RSTS,VAL_VOLT,VAL_RF,VAL_DC,VAL_HOPS,VAL_STATUS,VAL_ELAPSED,MODIFY_TIME) VALUES (?,?,?,TO_DATE(?,?),?,TO_DATE(?,?),?,?,?,?,?,?,?,?,?,?,?,SYSTIMESTAMP)
    INTO MYTABLE (VAL_ID,VAL_NAME,VAL_NUM,VAL_TIME,VAL_CMM,VAL_TIME1,VAL_TRIP,VAL_REMAINING,VAL_AGE,VAL_COUNT,VAL_RSTS,VAL_VOLT,VAL_RF,VAL_DC,VAL_HOPS,VAL_STATUS,VAL_ELAPSED,MODIFY_TIME) VALUES (?,?,?,TO_DATE(?,?),?,TO_DATE(?,?),?,?,?,?,?,?,?,?,?,?,?,SYSTIMESTAMP)
    SELECT 1 FROM DUAL
    SQLVals = 1 22C38299 80700334 04-19-2012 13:55:33 mm-dd-yyyy hh24:mi:ss MCC93000 04/19/2012 13:55:42 mm-dd-yyyy hh24:mi:ss 12 4 0.792191 23 1 0.00 -113.50 13.48 9 1 9
    1 36PR7038 8070EDC2 04-19-2012 12:24:35 mm-dd-yyyy hh24:mi:ss MCC60360 04/19/2012 12:24:41 mm-dd-yyyy hh24:mi:ss 7 4 0.757501 3 2 13.88 -114.80 14.06 5 1 6
    1 42C63512 8050166F 04-19-2012 16:02:50 mm-dd-yyyy hh24:mi:ss MCC52420 04/19/2012 16:02:57 mm-dd-yyyy hh24:mi:ss 10 4 0.778471 8 1 0.00 -122.30 13.05 8 1 7
    1 33MR3076 80803E75 04-19-2012 13:13:16 mm-dd-yyyy hh24:mi:ss MCC60330 04/19/2012 13:13:22 mm-dd-yyyy hh24:mi:ss 13 5 0.636721 28 3 0.00 -122.19 0.70 8 1 6
    Then I call: &DBInsert($sqlCmd, @sqlVals);
    This is the error I get: ORA-24335: cannot support more than 1000 columns.
    I need to insert about 879,500 rows (51 cols per row). The values I read from a text file in sets of about 48,000 and put them into a hash. I tried inserting one row at a time, but it takes too long, about 28 hrs! Then, I tried the bulk update with only 6 rows and the total time was about 25 minutes. Which is acceptable to us.
    Thanks!

  • How to solve this Data Configuration issue with error message ORA: 01017

    Bad public user name or password. ORA-01017: invalid username/password; logon denied
    How to solve this?

    I'm using JCreator jdk1.5.0_7.But i don't know how
    to use command prompt. When i execute my program, the
    command prompt showed
    Exception in thread "main"
    java.lang.NoClassDefFoundError: StringManipulation
    Press any key to continue...So you managed to compile your code since now you are running it. This error means that the class StringManipulation was not found. Usually an indicator that your classpath is incorrect.
    What did you do to generate this error? That is, how did you execute your program?
    [edit] if you did not compile your code then there is no class file StringManipulation.class and this error will appear.

  • How to get around ora-ORA-04091: table SSBOSS.SSTRMAST is mutating, trigger

    hi,
    Does anyone know how one would get around this problem please ?
    Here is my dbase trig:
    CREATE OR REPLACE TRIGGER SSBOSS.new_not_greater_than_net
    BEFORE INSERT OR UPDATE OF newrent ON SSBOSS.SSTRMAST
    REFERENCING NEW AS new OLD AS old
    FOR each row
    DECLARE
    not_permitted EXCEPTION;
    vnum number := ssboss.nik_f;
    BEGIN
    IF :new.NEWRENT > vnum then
    --AND :old.DELETED = 'N' THEN
    RAISE not_permitted;
    END IF;
    EXCEPTION
    WHEN not_permitted THEN
    RAISE_APPLICATION_ERROR
    (-20001, 'NEWRENT:'||:new.newrent||' '||'OLDRENT:'||' '||:old.netrent||'Action not permitted. Contribution (sstrmast.newrent) value '
    ||:new.NEWRENT
    ||' exceeds GROSS rental value (sstrmast.netrent) ');
    END;
    Here is my problem:
    SQL> update sstrmast set newrent = 11;
    update sstrmast set newrent = 11
    ERROR at line 1:
    ORA-04091: table SSBOSS.SSTRMAST is mutating, trigger/function may not see it
    ORA-06512: at "SSBOSS.NIK_F", line 4
    ORA-06512: at "SSBOSS.NEW_NOT_GREATER_THAN_NET", line 4
    ORA-04088: error during execution of trigger 'SSBOSS.NEW_NOT_GREATER_THAN_NET'
    I understand why but not how to correct?
    Thanks,
    nikolia.

    Hello,
    This problem as you might be knowing occurs when you try to select the data from the same table on which the trigger is written. Also this problem is only with the row level trigger and not with the statement level trigger. However the limitation of the statement level trigger is it can not refer to :NEW or :OLD. So now the solution is to capture the value of :NEW or :OLD in the row level trigger (no select statement here) and store it in some global variable. And how do you get the global variable? Using package specification ! a variable declared in a package specification is global in nature. Then use the value so stored in the statement level trigger in the select statement. It will work. Other solution is to use pragma autonomous transaction. Try and let us know. All the best.
    Regards

  • Database file changed ora-01251   how to solve?

    hai all,
    database file changed ora-01251 how to solve?
    suddenly changed when i try to connect Oracle Management server(OMS)
    thanks
    rcs
    =======
    os:winxp
    db:Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production
    SQL> Recover database
    ORA-00283: recovery session canceled due to errors
    ORA-01110: data file 9: 'F:\ORACLE\ORADATA\BIMPEX\BIMPEX.ORA'
    ORA-01122: database file 9 failed verification check
    ORA-01110: data file 9: 'F:\ORACLE\ORADATA\BIMPEX\BIMPEX.ORA'
    ORA-01251: Unknown File Header Version read for file number 9
    WRONG FILE TYPE
    F:\ORACLE\ORADATA\BIMPEX\BIMPEX.ORA
    ========

    Hi..
    Would like to know if any changes were done before this error popped up..
    From metalink :--
    >
    Error:     ORA-1251
    Text:     Unknown File Header Version read for file number %s
    Cause:     Read of the file header returned a record but its version cannot be
         identified. Either the header has been corrupted, or the file is not a
         valid database file.
    Action:     Have the operating system make the correct file available to the
         database, or recover the file.
    >
    If the file is corrupted, then take the datafile offline and open the database.If it was renamed, then you can check metalink Doc ID:      230449.1
    if the database is in archive log mode, you can refer to metalink Doc ID: 333620.1
    HTH
    Anand

  • How to solve error  : ORA-6512 at APPS.EAM_WORKORDER_PKG

    In new EAM installation process, the next error occurs during the creations of new operations to WO and attachments of new activities, which have several operations.
    ERROR:ORA-06502: PL/SQL :numeric or value error: character string buffer too small
    ORA-06512: at ''APPS.EAM_WORKORDER_PKG'', line 1529
    ORA-06512: at ''APPS.EAM_WORKORDER_PKG'', line 1966
    The implementation is in 12.0.4 version.
    Some one know how to solve this issue en EAM EBS.
    Thanks.

    Thanks for your help,
    I have reviewed all information sent for you. The issue finally was solve with the action plan descibed in the next :
    WICDOL - Autocreate Final Assembly Orders Completing With Warning - "ORA-01400: cannot insert NULL into ("WIP"."WIP_OPERATIONS"."WSM_BONUS_QUANTITY") " [ID 734605.1]
    This particular issue afects the operations creation, assigment of activities with predefined operations and state change.

  • How to solve this problem "ORA-01466: Unable to read data -- Table definiti

    Hi,
    I had deleted the entry and i want back now and in between i done the following
    alter table pv_head enable constraint FK_PV_HED__CRF_HEDwhen i try in the following one
    SELECT * FROM PV_HEAD AS OF TIMESTAMP TO_DATE('28-FEB-2011 9:45:00','DD-MON-YYYY HH24:MI:SS')
    WHERE PV_NO IN (703705,703704) the error i am receiving           
    ORA-01466: Unable to read data -- Table definition has changed how to solve this issue.
    please guide me.
    Kanish

    You can not perform DDL and then perform a flashback query to before the DDL.
    One might wonder why you chose this particular time to perform an ALTER TABLE but you did. It is what it is.

Maybe you are looking for

  • HP Advanced Photo Paper not listed in my printer profile in Photoshop Elements 7

    I have an HP 6310 Officejet printer and have successfully printed photos on (8" X 10") HP Premier Plus photo paper.  However, (4" X 6") HP Advanced Photo Paper does not appear in my Photoshop Elements list of papers for selection. Can you help?

  • NB200 - Notifications in system tray area

    Every few seconds I get an annoying pop-up notification in the system tray area that informs me of 'Blocked Events' These are all IPv4 TCP or UDP events. I'd really like to turn off these notifications but despite extensive internet searching I can't

  • ISE - Guest Access (without portal)

    Hi Guys, I have a customer who current is using the cwa portal for guest access. Corporate use will be added in the future sometime next year. Kit involved: 5508 - Internal (Inside Net) 5508 - Anchor (DMZ Net) ISE - Inside Net 3600 APs Presently, gue

  • Wizard control trigger transition

    Hi, I encountered a problem with the Wizard Control of VC7.1 SP4 I have a wizard with several steps which are shown as numbers in the upper wizard bar in the correct order. If I trigger a transition from step 1 to step 3 the wizard bar now only shows

  • Images Still Visible in Background of Next Slide

    I am using Captivate 6.  I'm exporting SWF/HTML5.  I have an image on one slide which is set in the properties to display for "rest of slide", NOT "rest of project".  However, when the project forwards to the next slide, the images from the previous