Blocking session problem

Hi all

I have a stored procedure that is called in specific reports and this report running much different to the user in the application. When this report is by many users running it start blocking the session. Instant Oracle showing locked held by another session and all the beginning of session resource pending, but never published by session, what is the error in this stored procedure

For the analysis of the functioning and to block queries run the suite of scripts

1.       Query about sessions that are either blocked or blocking other sessions.

Select s1.username. '@' || S1.machine | ' (SID =' | s1.sid |) blocking ') ' | S2. UserName | '@' || S2.machine | ' (SID =' | s2.sid |) ') ' AS blocking_status

v $ lock l1, v$ lock l2, v$ session s1 and s2 from v$ session where s1.sid = l1.sid and s2.sid = l2.sid and l1. BLOCK = 1 and l2.request > 0

and l1.id1 = l2.id1 and l2.id2 = l2.id2;

BLOCKING_STATUS

[email protected] (SID = 158) blocks [email protected] (SID = 375)

[email protected] (SID = 416) blocks [email protected] (SID = 329)

[email protected] (SID = 416) blocks [email protected] (SID = 369)

[email protected] (SID = 416) blocks [email protected] (SID = 385)

[email protected] (SID = 416) blocks [email protected] (SID = 429)

[email protected] (SID = 416) blocks [email protected] (SID = 443)

[email protected] (SID = 416) blocks [email protected] (SID = 451)

2.       Can be found objects that are blocked by above sessions by running the following issue:

Select do.object_name, row_wait_obj #, row_wait_file #, row_wait_block #, row_wait_row #, dbms_rowid.rowid_create (1, ROW_WAIT_OBJ #, ROW_WAIT_FILE #, ROW_WAIT_BLOCK #, ROW_WAIT_ROW #)

v $ session s, dba_objects do where sid =: sid and s.ROW_WAIT_OBJ # = do. OBJECT_ID;

3.       The request for running SQL against SID

Select sql_text

de v$ sqlarea

  (address, hash_value) in

(select sql_address sql_hash_value )

de session $ v

        where sid like '&sid');

4.       Next statement is blocking other sessions:

UPDATE gl_je_lines l

   SET CONTEXT = NULL,

attribute1 = NULL,

attribut2 = NULL,

attribut3 = NULL,

attribute4 = NULL,

attribute5 = NULL,

Description = NULL

WHERE l. je_header_id = :b2 AND l. je_line_num = :b1


Here's the code for SPplz help me

CREATE OR REPLACE PROCEDURE APPS. () LESCO_IOTSSCHQ_UPDATE_DFF

P_AS_ON VARCHAR2)

IS

-TO UDPATE CHECK NUMBER OF DISTRIBUTIONS

CURSOR CUR_SSCHQ

IS

SELECT HELPED SEPARATE. INVOICE_DISTRIBUTION_ID DISTRIBUTION_ID,

AIDA. INVOICE_ID

OF AIDA AP_INVOICE_DISTRIBUTIONS_ALL,.

GL_CODE_COMBINATIONS_V CC

WHERE CC. CODE_COMBINATION_ID = AIDA. DIST_CODE_COMBINATION_ID

AND CC. SEGMENT4 = '530103'

AND AIDA. ACCOUNTING_DATE < = FND_DATE. CANONICAL_TO_DATE (P_AS_ON)

AND AIDA. ATTRIBUTE_CATEGORY = "Debitable.

AND AIDA. ATTRIBUT3 IS NULL.

-ITO FOR CASH

CURSOR CUR_IOTCASH

IS

SELECT HELPED SEPARATE. INVOICE_DISTRIBUTION_ID DISTRIBUTION_ID,

AIDA. INVOICE_ID

OF AIDA AP_INVOICE_DISTRIBUTIONS_ALL,.

GL_CODE_COMBINATIONS_V CC

WHERE CC. CODE_COMBINATION_ID = AIDA. DIST_CODE_COMBINATION_ID

AND CC. SEGMENT4 = '530102'

AND AIDA. ACCOUNTING_DATE < = FND_DATE. CANONICAL_TO_DATE (P_AS_ON)

AND AIDA. ATTRIBUTE_CATEGORY = 'transfer of the letter references '.

AND AIDA. ATTRIBUTE8 IS NULL.

CURSOR CUR_INV_DISTD

IS

SELECT THE RIF. JE_HEADER_ID,

GIR. JE_LINE_NUM,

AIDA. INVOICE_DISTRIBUTION_ID DISTRIBUTION_ID

OF GL_JE_HEADERS H,

GL_IMPORT_REFERENCES RIF,

AP_AE_LINES_ALL AAELA,

AIDA AP_INVOICE_DISTRIBUTIONS_ALL,.

GL_CODE_COMBINATIONS_V CC

GL_JE_LINES L

WHERE H.JE_HEADER_ID = RIF. JE_HEADER_ID

AND GIR.GL_SL_LINK_ID = AAELA.GL_SL_LINK_ID

AND AAELA. SOURCE_TABLE = "AP_INVOICE_DISTRIBUTIONS."

AND AAELA. SOURCE_ID = AIDA. INVOICE_DISTRIBUTION_ID

AND CC. CODE_COMBINATION_ID = AIDA. DIST_CODE_COMBINATION_ID

AND CC. CHART_OF_ACCOUNTS_ID = 50268

AND GIR. JE_HEADER_ID = L.JE_HEADER_ID

AND GIR. JE_LINE_NUM = L.JE_LINE_NUM

AND NVL(L.DESCRIPTION,'N/A') <>NVL (AIDA. ATTRIBUT3, "N/A")

AND (CC.) SEGMENT4 IN ('530101', '530102','530103 ','530104 ')

OR CC. SEGMENT4 IN

(SELECT A.SEGMENT4 FROM XX_GL_APAR_COMP_REC_CC_V HAS)

UNION ALL

SELECT A.SEGMENT4 FROM XX_GL_APAR_COMP_PAY_CC_V HAS

))

AND GIR.GL_SL_LINK_TABLE = 'APECL. '

AND H.DEFAULT_EFFECTIVE_DATE < = FND_DATE. CANONICAL_TO_DATE (P_AS_ON)

AND AIDA. ATTRIBUTE_CATEGORY = "Debitable.

AND AIDA. ATTRIBUT2 IS NOT NULL;

CURSOR CUR_INV_DISTT

IS

SELECT THE RIF. JE_HEADER_ID,

GIR. JE_LINE_NUM,

AIDA. INVOICE_DISTRIBUTION_ID DISTRIBUTION_ID

OF GL_JE_HEADERS H,

GL_IMPORT_REFERENCES RIF,

AP_AE_LINES_ALL AAELA,

AIDA AP_INVOICE_DISTRIBUTIONS_ALL,.

GL_CODE_COMBINATIONS_V CC

GL_JE_LINES L

WHERE H.JE_HEADER_ID = RIF. JE_HEADER_ID

AND GIR.GL_SL_LINK_ID = AAELA.GL_SL_LINK_ID

AND AAELA. SOURCE_TABLE = "AP_INVOICE_DISTRIBUTIONS."

AND AAELA. SOURCE_ID = AIDA. INVOICE_DISTRIBUTION_ID

AND CC. CODE_COMBINATION_ID = AIDA. DIST_CODE_COMBINATION_ID

AND CC. SEGMENT4 IN ('530101', '530102','530103 ','530104 ')

AND GIR.GL_SL_LINK_TABLE = 'APECL. '

AND CC. CHART_OF_ACCOUNTS_ID = 50268

AND GIR. JE_HEADER_ID = L.JE_HEADER_ID

AND GIR. JE_LINE_NUM = L.JE_LINE_NUM

AND ((L.DESCRIPTION, 'N/a') <>NVL NVL (AIDA. ATTRIBUTE9, "N/A")

(OR)

CASE

WHEN CC. SEGMENT4 = '530102'

THEN NVL(L.ATTRIBUTE1,'N/A')

END) <>NVL (AIDA. ATTRIBUTE7, N / 'A'))

AND H.DEFAULT_EFFECTIVE_DATE < = FND_DATE. CANONICAL_TO_DATE (P_AS_ON)

AND AIDA. ATTRIBUTE_CATEGORY = 'transfer of the letter references '.

AND AIDA. ATTRIBUTE8 IS NOT NULL;

CURSOR CUR_TRX_DIST

IS

SELECT THE RIF. JE_HEADER_ID,

GIR. JE_LINE_NUM,

D.CUST_TRX_LINE_GL_DIST_ID DISTRIBUTION_ID

OF GL_JE_HEADERS H,

GL_IMPORT_REFERENCES RIF,

AR_AEL_GL_INV_V T,.

RA_CUST_TRX_LINE_GL_DIST_ALL D,.

GL_CODE_COMBINATIONS_V CC

GL_JE_LINES L

WHERE H.JE_HEADER_ID = RIF. JE_HEADER_ID

AND GIR. JE_HEADER_ID = T.JE_HEADER_ID

AND GIR. JE_LINE_NUM = T.JE_LINE_NUM

AND CC. CHART_OF_ACCOUNTS_ID = 50268

AND D.CUST_TRX_LINE_GL_DIST_ID = T.SOURCE_ID

AND T.SOURCE_TABLE = 'CTLGD. '

AND CC. CODE_COMBINATION_ID = D.CODE_COMBINATION_ID

AND (CC.) SEGMENT4 IN ('530101', '530102','530103 ','530104 ')

OR CC. SEGMENT4 IN

(SELECT A.SEGMENT4 FROM XX_GL_APAR_COMP_REC_CC_V HAS)

UNION ALL

SELECT A.SEGMENT4 FROM XX_GL_APAR_COMP_PAY_CC_V HAS

))

AND GIR. JE_HEADER_ID = L.JE_HEADER_ID

AND GIR. JE_LINE_NUM = L.JE_LINE_NUM

AND NVL(L.DESCRIPTION,'N/A') <>NVL(D.ATTRIBUTE3,'N/A')

AND H.DEFAULT_EFFECTIVE_DATE < = FND_DATE. CANONICAL_TO_DATE (P_AS_ON)

AND D.ATTRIBUTE_CATEGORY = 'Debitable.

AND D.ATTRIBUTE2 IS NOT NULL;

CURSOR CUR_MISC_DIST

IS

SELECT THE RIF. JE_HEADER_ID,

GIR. JE_LINE_NUM,

AMCDA. MISC_CASH_DISTRIBUTION_ID DISTRIBUTION_ID

OF GL_JE_HEADERS H,

AR_DISTRIBUTIONS_ALL ADA,

AR_MISC_CASH_DISTRIBUTIONS_ALL AMCDA,

GL_IMPORT_REFERENCES RIF,

GL_CODE_COMBINATIONS_V CC

WHERE H.JE_HEADER_ID = RIF. JE_HEADER_ID

AND TO_CHAR (AMCDA. POSTING_CONTROL_ID) = (RIF. REFERENCE_1)

AND GIR. REFERENCE_10 = "AR_MISC_CASH_DISTRIBUTIONS".

AND ADA. SOURCE_TABLE = "MCD".

AND ADA. SOURCE_ID = AMCDA. MISC_CASH_DISTRIBUTION_ID

AND AMCDA. CODE_COMBINATION_ID = CC. CODE_COMBINATION_ID

AND TO_CHAR (ADA. LINE_ID) = (RIF. REFERENCE_3)

AND (CC.) SEGMENT4 IN ('530101', '530102','530103 ','530104 ')

OR CC. SEGMENT4 IN

(SELECT A.SEGMENT4 FROM XX_GL_APAR_COMP_REC_CC_V HAS)

UNION ALL

SELECT A.SEGMENT4 FROM XX_GL_APAR_COMP_PAY_CC_V HAS

))

AND H.DEFAULT_EFFECTIVE_DATE < = FND_DATE. CANONICAL_TO_DATE (P_AS_ON)

AND AMCDA. ATTRIBUTE_CATEGORY = "Debitable.

AND AMCDA. ATTRIBUT2 IS NOT NULL;

-PROJECTS

CURSOR CUR_PROJ

IS

SELECT L.JE_HEADER_ID,

L.JE_LINE_NUM,

H.PERIOD_NAME,

L.ENTERED_DR,

L.ENTERED_CR,

SUM (PCDLA. DIST_AMNT AMOUNT).

PCDLA.PA_DATE

OF GL_JE_HEADERS H,

GL_JE_LINES L,.

GL_CODE_COMBINATIONS_V CC

PA_COST_DISTRIBUTION_LINES_ALL PCDLA

WHERE H.JE_HEADER_ID = L.JE_HEADER_ID

AND PCDLA. BATCH_NAME = L.REFERENCE_1

AND L.CODE_COMBINATION_ID = CC. CODE_COMBINATION_ID

AND L.REFERENCE_3 ('COST', 'Responsibility')

AND H.PERIOD_NAME = PCDLA.GL_PERIOD_NAME

AND H.DEFAULT_EFFECTIVE_DATE < = FND_DATE. CANONICAL_TO_DATE (P_AS_ON)

AND CC. SEGMENT4 IN ('530103')

AND L.DESCRIPTION = "created log import'

L.JE_HEADER_ID GROUP,

L.JE_LINE_NUM,

H.PERIOD_NAME,

L.ENTERED_DR,

L.ENTERED_CR,

PCDLA.PA_DATE

SAW (NVL(L.ENTERED_CR,0) = SUM (PCDLA. AMOUNT)

OR NVL(L.ENTERED_CR,0) = SUM (PCDLA. AMOUNT));

NUMBER OF CHECK_NUM;

BEGIN

C IN CUR_SSCHQ

LOOP

BEGIN

SELECT ACA. CHECK_NUMBER

IN CHECK_NUM

OF ACA AP_CHECKS_ALL,.

AP_INVOICE_PAYMENTS_ALL LAIP

WHERE ACA. CHECK_ID = AIPA. CHECK_ID

AND ACA. STATUS_LOOKUP_CODE <>"CANCELLED."

AND AIPA. INVOICE_ID = C.INVOICE_ID;

UPDATE AP_INVOICE_DISTRIBUTIONS_ALL AIDA

SET ATTRIBUT2 =

CASE

WHAT AMOUNT > 0

THEN "SS received cheque".

ELSE "SS cheque".

END,

ATTRIBUT3 = CHECK_NUM

WHERE AIDA. INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID;

EXCEPTION

WHILE OTHERS THEN

NULL;

END;

END LOOP;

C IN CUR_IOTCASH

LOOP

-FOR THE DELIVERY OF INVOICES THAT ARE NOT CANCELED LINES

UPDATE AP_INVOICE_DISTRIBUTIONS_ALL AIDA

SET ATTRIBUTE9 =

(SELECT THE AIA. INVOICE_NUM

OF AP_INVOICES_ALL AIA

WHERE AIA. INVOICE_ID = AIDA. INVOICE_ID

),

attribute8 =

CASE

WHAT AMOUNT > 0

THEN "ITO issued cash."

ELSE "IOT receipts."

END

WHERE AIDA. INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID;

-FOR THE DELIVERY OF INVOICES THAT ARE CANCELLED LINES

UPDATE AP_INVOICE_DISTRIBUTIONS_ALL AIDA

SET ATTRIBUTE9 =

(SELECT THE AIA. INVOICE_NUM

OF AP_INVOICES_ALL AIA

WHERE AIA. INVOICE_ID = AIDA. INVOICE_ID

),

attribute8 =

CASE

WHEN AMOUNT < 0

THEN "ITO issued cash."

ELSE "IOT receipts."

END

WHERE AIDA. INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID

AND AIDA. CANCELLATION_FLAG = 'Y ';

END LOOP;

C IN CUR_INV_DISTD

LOOP

-The Sub statement is commented because of server performance low as indicated by the DBA as dated: 06-MAY-2014

/ * UPDATE GL_JE_LINES L

SET CONTEXT = NULL,

ATTRIBUT1 = NULL,

ATTRIBUT2 = NULL,

ATTRIBUT3 = NULL,

ATTRIBUTE4 = NULL,

ATTRIBUTE5 = NULL,

DESCRIPTION = NULL

WHERE L.JE_HEADER_ID = C.JE_HEADER_ID AND L.JE_LINE_NUM = C.JE_LINE_NUM;

UPDATE GL_JE_LINES L

GAME CONTEXT = "Debitable."

ATTRIBUT1 = (SELECT D.ATTRIBUTE1 FROM AP_INVOICE_DISTRIBUTIONS_ALL D WHERE D.INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID).

ATTRIBUT2 = (SELECT D.ATTRIBUTE2 FROM AP_INVOICE_DISTRIBUTIONS_ALL D WHERE D.INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID).

ATTRIBUT3 = (SELECT D.ATTRIBUTE3 FROM AP_INVOICE_DISTRIBUTIONS_ALL D WHERE D.INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID).

DESCRIPTION = (SELECT D.ATTRIBUTE3 FROM AP_INVOICE_DISTRIBUTIONS_ALL D WHERE D.INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID).

ATTRIBUTE4 = "pay."

ATTRIBUTE5 = (SELECT I.INVOICE_NUM AP_INVOICE_DISTRIBUTIONS_ALL D, AP_INVOICES_ALL I WHERE I.INVOICE_ID = D.INVOICE_ID AND D.INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID)

WHERE L.JE_HEADER_ID = C.JE_HEADER_ID AND L.JE_LINE_NUM = C.JE_LINE_NUM; * /.

UPDATE GL_JE_LINES L

SET

(

CONTEXT,

ATTRIBUTE1,

ATTRIBUT2,

ATTRIBUT3,

DESCRIPTION,

ATTRIBUTE4,

ATTRIBUTE5

)

=

(SELECT 'Debitable',

D.ATTRIBUTE1,

D.ATTRIBUTE2,

D.ATTRIBUTE3,

D.ATTRIBUTE3,

"Payable",.

I.INVOICE_NUM

AP_INVOICE_DISTRIBUTIONS_ALL D,.

AP_INVOICES_ALL I

WHERE I.INVOICE_ID = D.INVOICE_ID

AND D.INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID

)

WHERE L.JE_HEADER_ID = C.JE_HEADER_ID

AND L.JE_LINE_NUM = C.JE_LINE_NUM;

END LOOP;

C IN CUR_INV_DISTT

LOOP

-The Sub statement is commented because of server performance low as indicated by the DBA as dated: 06-MAY-2014

/ * UPDATE GL_JE_LINES L

SET CONTEXT = NULL,

ATTRIBUT1 = NULL,

ATTRIBUT2 = NULL,

ATTRIBUT3 = NULL,

ATTRIBUTE4 = NULL,

ATTRIBUTE5 = NULL,

DESCRIPTION = NULL

WHERE L.JE_HEADER_ID = C.JE_HEADER_ID AND L.JE_LINE_NUM = C.JE_LINE_NUM;

UPDATE GL_JE_LINES L

GAME CONTEXT = "Debitable."

ATTRIBUT1 = (SELECT D.ATTRIBUTE7 FROM AP_INVOICE_DISTRIBUTIONS_ALL D WHERE D.INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID).

ATTRIBUT2 = (SELECT D.ATTRIBUTE8 FROM AP_INVOICE_DISTRIBUTIONS_ALL D WHERE D.INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID).

ATTRIBUT3 = (SELECT D.ATTRIBUTE9 FROM AP_INVOICE_DISTRIBUTIONS_ALL D WHERE D.INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID).

DESCRIPTION = (SELECT D.ATTRIBUTE9 FROM AP_INVOICE_DISTRIBUTIONS_ALL D WHERE D.INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID).

ATTRIBUTE4 = "pay."

ATTRIBUTE5 = (SELECT I.INVOICE_NUM AP_INVOICE_DISTRIBUTIONS_ALL D, AP_INVOICES_ALL I WHERE I.INVOICE_ID = D.INVOICE_ID AND D.INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID)

WHERE L.JE_HEADER_ID = C.JE_HEADER_ID AND L.JE_LINE_NUM = C.JE_LINE_NUM; * /.

UPDATE GL_JE_LINES L

SET

(

CONTEXT,

ATTRIBUTE1,

ATTRIBUT2,

ATTRIBUT3,

DESCRIPTION,

ATTRIBUTE4,

ATTRIBUTE5

)

=

(SELECT 'Debitable',

D.ATTRIBUTE7,

D.ATTRIBUTE8,

D.ATTRIBUTE9,

D.ATTRIBUTE9,

"Payable",.

I.INVOICE_NUM

AP_INVOICE_DISTRIBUTIONS_ALL D,.

AP_INVOICES_ALL I

WHERE I.INVOICE_ID = D.INVOICE_ID

AND D.INVOICE_DISTRIBUTION_ID = C.DISTRIBUTION_ID

)

WHERE L.JE_HEADER_ID = C.JE_HEADER_ID

AND L.JE_LINE_NUM = C.JE_LINE_NUM;

END LOOP;

C IN CUR_TRX_DIST

LOOP

-The Sub statement is commented because of server performance low as indicated by the DBA as dated: 06-MAY-2014

/ * UPDATE GL_JE_LINES L

SET CONTEXT = NULL,

ATTRIBUT1 = NULL,

ATTRIBUT2 = NULL,

ATTRIBUT3 = NULL,

ATTRIBUTE4 = NULL,

ATTRIBUTE5 = NULL,

DESCRIPTION = NULL

WHERE L.JE_HEADER_ID = C.JE_HEADER_ID AND L.JE_LINE_NUM = C.JE_LINE_NUM;

UPDATE GL_JE_LINES L

GAME CONTEXT = "Debitable."

ATTRIBUT1 = (SELECT D.ATTRIBUTE1 FROM RA_CUST_TRX_LINE_GL_DIST_ALL D WHERE D.CUST_TRX_LINE_GL_DIST_ID = C.DISTRIBUTION_ID).

ATTRIBUT2 = (SELECT D.ATTRIBUTE2 FROM RA_CUST_TRX_LINE_GL_DIST_ALL D WHERE D.CUST_TRX_LINE_GL_DIST_ID = C.DISTRIBUTION_ID).

ATTRIBUT3 = (SELECT D.ATTRIBUTE3 FROM RA_CUST_TRX_LINE_GL_DIST_ALL D WHERE D.CUST_TRX_LINE_GL_DIST_ID = C.DISTRIBUTION_ID).

DESCRIPTION = (SELECT D.ATTRIBUTE3 FROM RA_CUST_TRX_LINE_GL_DIST_ALL D WHERE D.CUST_TRX_LINE_GL_DIST_ID = C.DISTRIBUTION_ID).

ATTRIBUTE4 = "receive."

ATTRIBUTE5 = (SELECT I.TRX_NUMBER RA_CUST_TRX_LINE_GL_DIST_ALL D, RA_CUSTOMER_TRX_ALL I WHERE I.CUSTOMER_TRX_ID = D.CUSTOMER_TRX_ID AND D.CUST_TRX_LINE_GL_DIST_ID = C.DISTRIBUTION_ID)

WHERE L.JE_HEADER_ID = C.JE_HEADER_ID AND L.JE_LINE_NUM = C.JE_LINE_NUM; * /.

UPDATE GL_JE_LINES L

SET

(

CONTEXT,

ATTRIBUTE1,

ATTRIBUT2,

ATTRIBUT3,

DESCRIPTION,

ATTRIBUTE4,

ATTRIBUTE5

)

=

(SELECT 'Debitable',

D.ATTRIBUTE1,

D.ATTRIBUTE2,

D.ATTRIBUTE3,

D.ATTRIBUTE3,

"Receive."

I.TRX_NUMBER

RA_CUST_TRX_LINE_GL_DIST_ALL D,.

RA_CUSTOMER_TRX_ALL I

WHERE I.CUSTOMER_TRX_ID = D.CUSTOMER_TRX_ID

AND D.CUST_TRX_LINE_GL_DIST_ID = C.DISTRIBUTION_ID

)

WHERE L.JE_HEADER_ID = C.JE_HEADER_ID

AND L.JE_LINE_NUM = C.JE_LINE_NUM;

END LOOP;

C IN CUR_MISC_DIST

LOOP

-The Sub statement is commented because of server performance low as indicated by the DBA as dated: 06-MAY-2014

/ * UPDATE GL_JE_LINES L

SET CONTEXT = NULL,

ATTRIBUT1 = NULL,

ATTRIBUT2 = NULL,

ATTRIBUT3 = NULL,

ATTRIBUTE4 = NULL,

ATTRIBUTE5 = NULL,

DESCRIPTION = NULL

WHERE L.JE_HEADER_ID = C.JE_HEADER_ID AND L.JE_LINE_NUM = C.JE_LINE_NUM;

UPDATE GL_JE_LINES L

GAME CONTEXT = "Debitable."

ATTRIBUT1 = (SELECT D.ATTRIBUTE1 FROM AR_MISC_CASH_DISTRIBUTIONS_ALL D WHERE D.MISC_CASH_DISTRIBUTION_ID = C.DISTRIBUTION_ID).

ATTRIBUT2 = (SELECT D.ATTRIBUTE2 FROM AR_MISC_CASH_DISTRIBUTIONS_ALL D WHERE D.MISC_CASH_DISTRIBUTION_ID = C.DISTRIBUTION_ID).

ATTRIBUT3 = (SELECT D.ATTRIBUTE3 FROM AR_MISC_CASH_DISTRIBUTIONS_ALL D WHERE D.MISC_CASH_DISTRIBUTION_ID = C.DISTRIBUTION_ID).

DESCRIPTION = (SELECT D.ATTRIBUTE3 FROM AR_MISC_CASH_DISTRIBUTIONS_ALL D WHERE D.MISC_CASH_DISTRIBUTION_ID = C.DISTRIBUTION_ID).

ATTRIBUTE4 = "receive."

ATTRIBUTE5 = (SELECT I.RECEIPT_NUMBER AR_MISC_CASH_DISTRIBUTIONS_ALL D, AR_CASH_RECEIPTS_ALL I WHERE I.CASH_RECEIPT_ID = D.CASH_RECEIPT_ID AND D.MISC_CASH_DISTRIBUTION_ID = C.DISTRIBUTION_ID)

WHERE L.JE_HEADER_ID = C.JE_HEADER_ID AND L.JE_LINE_NUM = C.JE_LINE_NUM; * /.

UPDATE GL_JE_LINES L

SET

(

CONTEXT,

ATTRIBUTE1,

ATTRIBUT2,

ATTRIBUT3,

DESCRIPTION,

ATTRIBUTE4,

ATTRIBUTE5

)

=

(SELECT 'Debitable',

D.ATTRIBUTE1,

D.ATTRIBUTE2,

D.ATTRIBUTE3,

D.ATTRIBUTE3,

"Receive."

I.RECEIPT_NUMBER

AR_MISC_CASH_DISTRIBUTIONS_ALL D,.

AR_CASH_RECEIPTS_ALL I

WHERE I.CASH_RECEIPT_ID = D.CASH_RECEIPT_ID

AND D.MISC_CASH_DISTRIBUTION_ID = C.DISTRIBUTION_ID

)

WHERE L.JE_HEADER_ID = C.JE_HEADER_ID

AND L.JE_LINE_NUM = C.JE_LINE_NUM;

END LOOP;

C IN CUR_PROJ

LOOP

-The Sub statement is commented because of server performance low as indicated by the DBA as dated: 06-MAY-2014

/ * UPDATE GL_JE_LINES L

SET CONTEXT = NULL,

ATTRIBUT1 = NULL,

ATTRIBUT2 = NULL,

ATTRIBUT3 = NULL,

ATTRIBUTE4 = NULL,

ATTRIBUTE5 = NULL,

DESCRIPTION = NULL

WHERE L.JE_HEADER_ID = C.JE_HEADER_ID AND L.JE_LINE_NUM = C.JE_LINE_NUM; * /.

UPDATE GL_JE_LINES L

GAME CONTEXT = "Debitable."

ATTRIBUT1 = "STORE MATTER."

Attribut2 = "SS cheque."

ATTRIBUT3 =

CASE

WHEN TO_CHAR (C.PA_DATE, 'DD') BETWEEN 1 AND 15

THEN C.PERIOD_NAME

|' / F.N. IST'

WHEN TO_CHAR (C.PA_DATE, 'DD') BETWEEN 16 AND 31

THEN C.PERIOD_NAME

|' / F.N. 2 '

ELSE "Import Journal created"

END,

DESCRIPTION =

CASE

WHEN TO_CHAR (C.PA_DATE, 'DD') BETWEEN 1 AND 15

THEN C.PERIOD_NAME

|' / F.N. IST'

WHEN TO_CHAR (C.PA_DATE, 'DD') BETWEEN 16 AND 31

THEN C.PERIOD_NAME

|' / F.N. 2 '

ELSE "Import Journal created"

END,

ATTRIBUTE4 = 'projects ', he said.

ATTRIBUTE5 = L.REFERENCE_1

WHERE L.JE_HEADER_ID = C.JE_HEADER_ID

AND L.JE_LINE_NUM = C.JE_LINE_NUM;

END LOOP;

COMMIT;

END;

/


The error in the stored procedure, it is that it is badly written - by using the line by line (= slow-by-slow) cursor loops, in the middle of which he

are updated.

This causes the locking will be held longer than necessary.

If rewrite you it with focus on game updates, that will be faster, it will alleviate your problem.

To completely remove it, you will need to discover why a report made updates and why she strives to update the same rows.

BTW: also remove this bad Ngen.exe.

Tags: Database

Similar Questions

  • Why do I own this blocking session / blocked

    Oracle 11.2.0.4 SE a 64-bit

    Oracle Linux 5

    We have a task that runs every 5 minutes to detect blocking sessions / blocked.  When it detects an email with the details is sent.  Conduct of query is the following:

    select NVL(s1.username,''null'') username1,
                    s1.machine machine1,
                    s1.sid sid1,
                    s1.osuser osuser1,
                    s1.program program1,
                    lo.object_id locked_object,
                    NVL(s2.username,''null'') username2,
                    s2.machine machine2,
                    s2.sid sid2,
                    s2.osuser osuser2,
                    s2.program program2,
                    sqlt.sql_text sql_text2
             from   v$lock l1,
                    v$session s1,
                    v$lock l2,
                    v$session s2,
                    v$locked_object lo,
                    v$sqltext sqlt
             where s1.sid=l1.sid
               and s2.sid=l2.sid
               and l1.BLOCK=1 and l2.request > 0
               and l1.id1 = l2.id1
               and l2.id2 = l2.id2
               and s1.sid = lo.session_id
               and s2.sql_address = sqlt.address
               and s2.sql_hash_value = sqlt.hash_value
               and sqlt.piece = 0
    

    Normally things are fairly quiet except on the occasion one of my power forgot to engage users.  But last week I started to have notification that a session belonging to me (ESTEVENS) was blocking one or more sessions held by me.  Still, he arrives at 21:00 and fades within 5 minutes before the next review.  The sql code associated with the blocked session is always the same.  Here is a representative sample, with company data obscured.

    Block user - ESTEVENS

    Machine - myserver.mycompany.org

    SID - 433

    OSUSER - oracle

    -PROGRAM [email protected] (J001)

    OBJID - 12451

    Blocked user - ESTEVENS

    Machine - myserver.mycompany.org

    SID - 200

    OSUSER - oracle

    -Program [email protected] (J002)

    SQL: UPDATE HS_FDS_CLASS_DATE SET FDS_CLASS_DATE = SYSDATE WHERE FDS_

    By comparing the time of the block and SIDS reported with DBA_SCHEDULER_JOB_RUN_DETAILS content, I was able to follow some scheduled tasks 'load '.  These jobs do a SELECT... IN... OF < db_link >.  Because the table is locked is HS_FDS_CLASS_DATE, I found notes 1536085.1 describing a bug with the use frequent or simultaneous to a db_link, supposed to be fixed in 11.2.0.4 but my experience says otherwise.  However, I can deal with all that.

    But my real question is how to get my username attached to these sessions?

    Understand your question, I hope...

    It happened to me, that if I use my "DBA1' to create one job to another user"USER1", my user name is indicated as the USER name in the session, but 'The ANALYSIS of the USER' are the owner of the task.

    I think it's normal, but I still don't know why.

    Edit: Duh! It seems that it is documented Overview of job creation

    Because no destination_name attribute is specified, the task runs on the (local) database of origin. The job runs as the user who created the work.

    Kind regards

    Juan M

  • contracting of Oracle tm + idenitifying blocking sessions/proceseses + sql

    Hello

    Using oracle 11.2.0.3 and sometimes our etl load lock because of the argument - while having a gui tool which can identify sessions blocking, would be a good thing to have a script that allows to identify these blocking sessions, user of the os and pc who initiated the session blocking and sql blocking.

    For example, the summary tables sometimes have patches ran against them and we are not aware of this so happens when not around.

    Is this possible?

    It is also possible to identify any tabels who the fk constraints, but Marvin Dollin have associated indexes?

    Thank you

    Blocking find sessions:

    SELECT

    blocking_session,

    SID,

    Serial No.,

    wait_class,

    seconds_in_wait

    Of

    session v$

    WHERE

    blocking_session IS NOT NULL

    ORDER BY

    blocking_session;


    Find the query to execute blocking the session

    SELECT q.sql_fulltext

    V $ session s, v$ sql q

    WHERE SID = 'blocking_session_id' AND s.sql_id = q.sql_id

  • How to find block sessions on a 2 DB of RAC node?

    Hi DBAs,

    I know that the query that will give me the session that is blocking on a standalone DB as below:

    Select l1.sid, 'BLOCKS', l2.sid from v$ lock l1, l2 of v$ lock

    where l1.block = 1 and l2.request > 0 and l1.id1 = l2.id1 and l1.id2 = l2.id2;

    But now I have a small question that my other DB is a node 2 CARS DB (2 instances that are on 2 different location breaks). And there seems to be some memory problems and I need to find sessions that are open for a long time and I need to kill them. Can anyone help me find the blocking in RAC environment session and also how to kill in RAC environment.

    DB environment:

    version: Oracle 10.2.0.5

    Production

    2 node RAC

    Regads,

    Ritu

    SELECT DECODE (ask, 0,' owner: ',' server: '). ID1, id2, lmode, ask, sid sess, type OF gv$ LOCK (id1, id2, type) WHERE IN(SELECT id1,id2, type FROM gv$LOCK WHERE request>0) ORDER BY id1, ask;

  • blocking session

    I'm working on Oracle 10 g on Linux enviornment

    V $ second how to find the course of which two caused the deadlock? Or Simple Q. I want to know session what blocking causing?
    Thank you

    Published by: susdba on January 10, 2011 11:52

    The error in the alert.log file contains a reference to a trace file that contains detailed information about the impasse.

    Thank you.

  • Script to kill the blocking sessions

    We use Oracle 10. We have a database of test used only for training and I need to give to the teacher the ability to kill all sessions blocking when a block continues
    the entire class.
    My idea was to create a simple form on our Oracle containing just a single menu-button when you press on would trigger the script. Press the key
    to kill each session blocking. I have no idea on how to write a script of this nature. Would appreciate any advice.
    Kind regards
    Sandy

    You can use something like this

    SQL> DECLARE
      2  CURSOR c IS
      3  SELECT c.owner,
      4        c.object_name,
      5        c.object_type,
      6        b.SID,
      7        b.serial#,
      8        b.status,
      9        b.osuser,
     10        b.machine
     11   FROM v$locked_object a, v$session b, dba_objects c
     12   WHERE b.SID = a.session_id AND a.object_id = c.object_id
     13   and c.object_name in ('JSW_CRM_C_HR_COIL_INFO','T_SPCL_BARCODE_CRS2');
     14  c_row c%ROWTYPE;
     15  l_sql VARCHAR2(100);
     16  BEGIN
     17  OPEN c;
     18  LOOP
     19  FETCH c INTO c_row;
     20  EXIT WHEN c%NOTFOUND;
     21  l_sql := 'alter system kill session '''||c_row.SID||','||c_row.serial#||'''';
     22  EXECUTE IMMEDIATE l_sql;
     23  END LOOP;
     24  CLOSE c;
     25  END;
     26  / 
    

    Be sure to use your own SQL statement in the CURSOR!

  • Session problems

    I seem to have a little problem with session variables, and I managed to reduce the cause until the CFLOCATION tag. I have currently a page have been the user enters information, which is then sent to a page of type the information in a database, as well as creating two session variables and possibly redirect a new action page. As I said earlier, I have reduced the problem to this area of my code:

    < cfset session.loggedIn = "yes" >
    < cfset session.userID = "#Form.username #" >
    < cflocation url = "" profile.cfml? #Form.username # ' addToken = "No" > "

    When the user is redirected to the new page, it calls session.userID. However, instead it creates just an error saying "user name is not defined in the session. I put comment the CFLOCATION tag and replaced by a CFOUTPUT to see if session variables were actually at work. It turns out that they are. It is obvious that the CFLOCATION tag seems to be the origin of the problem, but I see no reason why.

    Anyone got any ideas?

    You should name the rename to: Application.cfm. It should contain only


    applicationTimeout = "#createTimespan (1,0,0,0) #
    sessionManagement = "yes".
    sessionTimeout = "#createTimeSpan (0,0,20,0) #
    setClientCookies = "true" >

    Omit the code between the tags from cfscript. It is an equivalent to this alternative. You will only use if you use Application.cfc instead of Application.cfm.

  • Oracle Forms - master and detail block (join problem).

    Hi all

    I have a form (Oracle forms 6i) with 2 data block (master and a block of retail). I have 4 fields in the main block and of the rating is a Nullable.

    The problem here is when I query the records - if the Nullable filed of the master is empty, then all records matching the first 3 fields are displayed. (Regardless of the fields fouth is NULL or Not NULL).

    Ex: Master

    Area 1 area 2 area 3 area 4
    21 Siva MNN PEUT
    John TGB USD



    Now, the block of this detail, all records that may have deposited 1 has NULL also 21 etc.


    I want to display zone 1 is the NULL records in detail block, if the master has the NULL value in it.

    Can someone help me?

    Thank you in advance!

    Nice day!

    In your post is not clear what the relationship between the tables please post the table structure and their relationship information

  • code blocks fstream problem

    Hello, so I installed code blocks the 10.05 (until I got 12.11) and I tried to use the fstream library and this is what happened:can u help me?

    I deleted who ">" and he said the same thing.

  • Blocked BIOS problem!

    I recently did a Windows Update on my 4540 s Probook HP, which I believe included an update of the BIOS, and since then, the only way I can get into my computer when you turn it on it is press F9 as soon as I press the start button to start the machine. This gives the ability to select the right drive to start with. If I do not press F9, the screen goes all black with a lot of white letters on it and in the end, he has a cursor flashing as if I neede to enter something. The message begins with something to do with the Caldera.

    I took it instead, I've had it since and they tried to get into the BIOS settings, as they said that what has happened is that is not automatically selecting the right drive to boot from. However, the BIOS seems to be stuck and they don't know how to unlock the BIOS. Can someone help me on how to unlock the BIOS to get this problem?

    Or better yet, is the problem that I have explained above anything to do with the BIOS settings?

    Would be glad of some help for this!

    Windows Update does not include an update of the BIOS. The only place to download an update of the BIOS of HP is. "Caldera" is / was a former BACK operating system and may have been transferred in a Linux version. Do you have a CD or DVD in the optical drive, or a USB Flash drive inserted into the computer? If so, remove them at this time.

    If please enter the BIOS by turning on the computer and typing the "F10" or "ESC" (then select "F10") the keys, reset it to the default values and save the settings. Make sure the primary hard drive is selected as the first boot device. Please check to make sure that all CD, DVD, Flash drives are removed and try to restart your computer. What was the result?

    You can create a "repair disk" Windows and run to see if it can resolve your problem. Finally, you may need to perform a recovery of the HP system to correct your problem.

    If you have any other questions, feel free to ask.

    Please click the White Star of KUDOS to show your appreciation

  • I can't use my USB because of administration system or blocking USB problem.

    Because of my ignorance in the use of some security as USB security guard software and changes in my control panel, now I can't access my USB drive or any external memory device. When I put any external memory via USB device, it is noticed that my USB guard is locked and that the system cannot perform it.so contact your system administrator. But I uninstalled all my software security completely and checked my boot settings and the bios and the problem is still there. so I can't use my USB or external memory device via USB port in my laptop. I use the Windows 7 operating system. so please help me through your friendly consultation.

    Two thoughts. Take a look at this program and see if it finds the remains of security software http://www.revouninstaller.com/ and also to see what runs in your startup using this program.
    Autoruns from Sysinternals

    http://TechNet.Microsoft.com/en-us/sysinternals/bb963902.aspx

    I hope this helps.

  • Session problem

    I create and populate the table below in the HR schema:
    create or replace
    function get_user
    return varchar2
    is
      name varchar2(50);
    begin
      select user into name from dual;
      return name;
    end;
    
    set serveroutput on;
    begin
      dbms_output.put_line(get_user);
    end;
    
    create user my_user identified by my_user;
    create user my_user2 identified by my_user2;
    
    grant execute on get_user to my_user;
    grant execute on get_user to my_user2;
    
    connect my_user/my_user;
    
    set serveroutput on;
    begin
      dbms_output.put_line(hr.get_user);
    end;
    
    
    connect my_user2/my_user2;
    
    set serveroutput on;
    begin
      dbms_output.put_line(hr.get_user);
    end;
    And the output is
    HR
    
    MY_USER
    
    MY_USER2
    My question is the get_user function is in the HR schema right? So this function runs in human resources. Because it is not declared authid current_user, however she runs as in the schema of the invoker (session) why?

    Although he has not been declared authid current_user, but he behaves like this?

    The important thing is when I call this function as a password, then, where it will run? in my session or session define?

    Thanks for your help.

    Published by: 944258 on 11.Tem.2012 13:14

    Published by: 944258 on 11.Tem.2012 13:27

    944258 wrote:
    My question is the get_user function is in the HR schema right?

    Fix.

    So this function runs in human resources.

    What does it mean for you, for a function to execute in a schema? The function is defined in the HR schema. It runs with the privileges of the current user.

    Because it is not declared authid current_user, however she runs as in the schema of the invoker (session) why?

    But it is defined as authid current_user

    Although he has not been declared authid current_user, but he behaves like this?

    The function is a DEFINER rights or rights a stored procedure to an applicant, the USER-defined function returns the currently logged in user. It has nothing to do with the schema that belongs to the function or the privileges of the service runs as.

    The important thing is when I call this function as a password, then, where it will run? in my session or session define?

    Whether a stored procedure DEFINER rights or the rights of a plaintiff stored procedure, it will run in your session. It runs with the privileges of the user to define either with your privileges.

    Justin

  • Wrapped connections, and proxy sessions problem

    Hello!

    We went to Weblogic 10.3.5, and my impression is that the behavior of the wrappers of connection changed handling about proxy sessions.

    We use the SecurityServicesJDBC to get a connection, which is a wrapper of the OracleConnection.
    We then use the connection wrapper to log proxy with username and password to check if the given credentials are valid.

    Very probably since the upgrade to 10.3.5 the password is ignored. Effect is that all users are connected successfully, regardless of passwords.

    Workaround is to get the connection from the supplier of the package, and then open the proxy on this session.

    I wonder why the wrapper removes the password and it does not pass. If there is a wrapper, shouldn't the method works like the same method on the connection to the seller?
    It worked like a charm in 10.3.4 as far as I can tell. If something has changed in the wrappers?

    Kind regards

    Sascha

    I think you mean wls 10.3.3 worked before. SO Yes, you want a patch for a bug recently found that WLS will swallow the exception.

  • Trainer named blocks compilation problem

    Hello

    I noticed that setting the following preference in formatter...

    Tools-> Preferences-> trainer sql-> oracle formatting-> whitespace-> spaces around operators (= <>+ - * /)-> a space: where a = b + c

    cause named blocks will be defined as...

    < < name-for-block > >
    declare
    variable declarations
    Start
    SQL statements
    name block end;

    to become...

    < < name-for-block > >
    declare
    variable declarations
    Start
    SQL statements
    name block end;

    and therefore to compile failure due to space inserted between the < < and > > are characters like < < and > >

    Can we change the trainer do to prevent this?

    Thank you

    Alan

    Hi Alan,

    Existing bug:
    Bug 10217694 -< should="" not="" have="" space="" and="" should="" not="" align="" with="">

    -Turloch
    Team SQLDeveloper

  • Equium A110-338: application blocking the problem - cannot close

    Hello

    my machine is running windows xp pro and when I stop I get a box saying sample end program.

    can anyone help please.

    Thank you

    This is nothing unusual.
    Same thing happened on my two laptops.
    In my case Adobe acrobat reader software running in the background not able to close properly and so this message appeared.

    I just reinstalled this program and cleaned the registry by using the freeware like CCleaner program.
    Since this procedure, everything works fine.

    I recommend doing the same ;)

    Good luck and congratulations ;)

Maybe you are looking for

  • That means "missing product Configuration"?

    I downloaded firefox. I did the 'RUN' of the set-up file. It will not be implemented. I get "Missing product Configuration". I am running Windows 7.1.

  • The weather Web site maintains loading an old map

    When I load the Web site it loads a weather map from a week agoon another level, it's a few days old. I can't get an updated map. deleted the cash and deleted the cookies and still the same This is the website http://www.weather.com/maps/maptype/sate

  • where is my Mozilla start page?

    Monday, I had my Mozilla start page, but Tuesday he was there for half the day and then went away. I continue to use the start of most visited page. so when I close my browser it disappears. When I open it again my browser... this very annoying... If

  • Network adapter is not found.

    Reinstalled Windows XP installation CD. Network adapter is not found. How to install network card and the driver on the CD?

  • Computer crashes randomly in any program. ___ __

    Just installed Win7 on new PC. After running sfc/scannow, it finds corrupted files, but could not solve some of them. Journal CBS read:... mcbuilder.exe is not actual file [l:26 {13}] 'mcbuilder.exe'...  [{Could reproject not corrupt the file}] "mcbu