ORA-02291 - ORA-02063 on merge with dml error logging through DB link
Hello all,
I have 2 DB's and I would like to merge records from A into B with dml error logging through a db link.
Exemple:
merge into B@dblink
using (select ... from A where...)
when matched then
when not matched then
log errors into err$_A reject limit unlimited;
When I use this, and exception is thrown:
ORA-02291: integrity constraint (B.constraint_name) violated - parent key not found
ORA-02063: preceding line from dblink
I've got no idea of what causes this.
Could anyone please help me ?
Thanks !
Regards,
TDE.
Hello damorgan,
Thanks for your answer.
I've well understood that its was a foreign key violation, and I guess that's an error in the source: wee make only logical deletes, and I'm quite sure the problem is there.
Anyway, I really would understand why dml error logging doesn't work in this case.
I'll investigate and keep you informed.
Regards.
Similar Messages
-
DML Error Logging with multiple tables = OALL8
I have a mapping that, via a splitter, loads 3 tables. This mapping works perfectly.
Recently we upgraded to OWB 10.2.0.3 so we decided to make use of the new feature of DML error logging. So three error-tables where created and the "error table name" property of each table was entered. When re-creating this mapping in the database the following errors occur: "State of OALL8 is inconsistent", "No more data to read from Socket" (translated from dutch). When removing the value from the "error table name" property again, the mapping can be recreated again.
What am I doing wrong? Have I run into a bug?Which database version are you using?
Also not sure when exactly the error occurs, when you deploy the map...or when you execute the map? Can you describe as simple a scenario for it to fail that you can?
I did find a bug 5942415 which was to do with this area..worth checking anyway.
Cheers
David -
DML Error logging with delete restrict
Hi,
I am trying to log all DML errors while performing ETL process. We encountered a problem in the process when one of the on delete cascade is missing in child tables but I was curious to know why we got that exception to the calling environment because we are logging all DML errors in err$_ tables. Our expectation is when we get child record found violation then that error will be logged into ERR$_ tables and process will carry on without any interruption but it interrupted in the middle and terminated. I can illustrate with below example
T1 -> T2 -> T3
T1 is parent and it is s root
Create table t1 (id number primary key, id2 number);
Create table t2(id number references t1(id) on delete cascade, id2 number);
create table t3 (id number references t2(id)); -- Missing on delete cascade
insert into t1 as select level, level from dual connect by level < 20;
insert into t2 as select level, level from dual connect by level < 20;
insert into t3 as select level from dual connect by level < 20;
exec dbms_errlog(t1);
exec dbms_errlog(t2);
exec dbms_errlog(t3);
delete from t1 where id = 1 log errors into err$_t1 reject limit unlimited; -- Child record found violation due to t3 raised but I am expecting this error will be trapped in log tables.
delete from t2 where id =1 log errors into err$_t2 reject limit unlimited; -- Got the same error child record violation. My expectation error will be logged into log tables.
I am using Oracle 11gR2.
Also, Please let me know if there is any restrictions to use DML error logging in DBMS_PARALLEL_EXECUTE.
Please advise
Thanks,
UmakanthWhat is the error you want me to fix? Missing on delete cascade?
The Code you posted has multiple syntax errors and can't possibly run. You should post code that actually works.
My expectation is all the DML errors will be logged into error logging tables even if it is child record found violation.
delete from t1 where id = 1 log errors into err$_t1 reject limit unlimited; -- Child record found violation due to t3 raised but I am expecting this error will be trapped in log tables.
delete from t2 where id =1 log errors into err$_t2 reject limit unlimited; -- Got the same error child record violation. My expectation error will be logged into log tables.
DML error logging logs DATA. When you delete from T1 there is an error because the T2 child record can NOT be deleted. So the T1 row that was being deleted is logged into the T1 error log table. The request was to delete a T1 row so that is the only request that failed; the child rows in T2 and T3 will not be put into log tables.
Same when you try to delete from T2. The T3 child record can NOT be deleted so the T2 row that was being deleted is logged into the T2 error log table.
The exceptions that occur are NOT logged, only the data that the DML could not be performed on.
After I fixed your code your example worked fine for me and logged into the DML error tables as expected. But I wasn't doing it from a client. -
Alternative to DML Error Logging
I am supposed to catch invalid records in error table with the ORA exception. I am using 10g. Using DML Error logging i cannot catch primary key violations. Using for loop it will be very slow because there are lots of records. How to catch invalid records with the ORA exception
Thanksuser637544 wrote:
Using DML Error logging i cannot catch primary key violations.You can't use DML Error Logging future, because:
The DML error logging functionality is not invoked when:
Deferred constraints are violated.
Direct-path INSERT or MERGE operations raise unique constraint or index violations.
UPDATE or MERGE operations raise a unique constraint or index violation.
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com -
Use global temp table for DML error logging
our database is 11.2.0.4 enterprise edition on solaris 10
we are wondering if anyone has an opinion of or has done this before, to use a global temp table for DML error logging. We have a fairly busy transactional database with 2 hot tables for inserts. The regular error table created with dbms_errlog has caused many deadlocks which we don't quite understand yet. we have thought using global temp table for the purpose, and that seemed to work, but we can't read error from the GTT, the table is empty even reading from the same session as inserts. Does anyone have an idea why?
ThanksThe insert into the error logging table is done with a recursive transaction therefore it's private from your session which is doing the actual insert.
Adapted from http://oracle-base.com/articles/10g/dml-error-logging-10gr2.php
INSERT INTO dest
SELECT *
FROM source
LOG ERRORS INTO err$_dest ('INSERT') REJECT LIMIT UNLIMITED;
99,998 rows inserted.
select count(*) from dest;
COUNT(*)
99998
SELECT *
FROM err$_dest
WHERE ora_err_tag$ = 'INSERT';
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 1000 Description for 1000
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 10000 Description for 10000
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 1000 Description for 1000
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 10000 Description for 10000
rollback;
select count(*) from dest;
COUNT(*)
0
SELECT *
FROM err$_dest
WHERE ora_err_tag$ = 'INSERT';
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 1000 Description for 1000
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 10000 Description for 10000
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 1000 Description for 1000
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 10000 Description for 10000 -
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Solaris: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - ProductionProblem: Trying to insert into mytable and implement DML error logging. But error logging never kicks in instead process fails
with
ORA-01843: not a valid monthWhy is that happening? I thought may be direct path insert is the reason behind it. But, Tom Kite himself uses DPI.
http://tkyte.blogspot.com/2005/07/how-cool-is-this.html
Any advice?
INSERT /*+ APPEND */ INTO mytable
SELECT A,
TO_DATE(TRIM(SUBSTR(str,1, INSTR(str, ' to ') - 1)), 'Mon DD YYYY') csd,
TO_DATE(TRIM(SUBSTR(str, INSTR(str, ' to ') + 4, INSTR(str, '-') - (INSTR(str, ' to ') + 5))), 'Mon DD YYYY') ced,
B,
C,
D
FROM (SELECT DISTINCT
p1,
p2,
p3
FROM P
) pc1
INNER JOIN tbl1 ON (...)
INNER JOIN tbl2 ON (...)
INNER JOIN tbl3 ON (...)
ORDER BY A, B, C
LOG ERRORS ('my errors') REJECT LIMIT UNLIMITED;Thanks! I created a view and put the TO_DATE in the SELECT statement as shown below and DML Logging kicked in where TO_DATE was failing!
INSERT /*+ APPEND */ INTO mytable
SELECT A,
TO_DATE(csd, 'Mon DD YYYY') csd,
TO_DATE(ced, 'Mon DD YYYY') ced,
B,
C,
D
FROM (SELECT A,
TRIM(SUBSTR(str,1, INSTR(str, ' to ') - 1)) csd,
TRIM(SUBSTR(str, INSTR(str, ' to ') + 4, INSTR(str, '-') - (INSTR(str, ' to ') + 5))) ced,
B,
C,
D
FROM (SELECT DISTINCT
p1,
p2,
p3
FROM P
) pc1
INNER JOIN tbl1 ON (...)
INNER JOIN tbl2 ON (...)
INNER JOIN tbl3 ON (...)
ORDER BY A, B, C
LOG ERRORS ('my errors') REJECT LIMIT UNLIMITED; -
DML Error logging for Update statement
Hello,
I am facing a problem with regard to DML Error logging with Update statement .
oracle : 10.2
I am executing following DML update:
BEGIN
UPDATE
table_1 a
SET a.Exp_DATE =a.EFF_DATE
WHERE a.col_a1 != (SELECT b.colb1
FROM table_2 b
WHERE a.msisdn =b.msisdn )
LOG ERRORS INTO table_1_ERR REJECT LIMIT UNLIMITED;
END ; I was expecting that "ORA-01427: single-row subquery returns more than one row" would be captured in LOG error table "table_1_err"
but instead I got run time error and whole dml was rolled back.
Please let me know whether this exception is not captured by DML error logging.
Thanks,
Abhishek*Oracle logs the following errors during DML operations:** Column values that are too large.
* Constraint violations (NOT NULL, unique, referential, and check constraints).
* Errors raised during trigger execution.
* Errors resulting from type conversion between a column in a subquery and the corresponding column of the table.
* Partition mapping errors.
>
http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/transform.htm#sthref777 -
Dml error logging for tables in 10.2.0.5
Hi experts,
I have problems loading error records into the shadow table specified in the configuration window for tables. Upon executing the mapping, the execution results show warnings with the error records but these records were not moved to the shadow/error table.
The actual scenario is: I specified a non-null data rule on the supplier_code column in the supplier table. Inside the mapping where I used this supplier table, I choose the option "Move to error" for this non-null data rule. Upon executing, it seems that owb treats these as warnings and not errors and thus did not propagate them to the error table. Anyone has any suggestion as to how to make use of the error tables in owb?DML error logging is generated for set-based PL/SQL mappings if the following conditions are satisfied:
1. the Error table name property is set for the operator (table/view/mv)
2. the PL/SQL Generated Mode of the module that contains the mapping is set to 10gR2 and above or Default.
If the value is set to Default, ensure that location associated with the module has the Version set to 10.2 or above.
When you use a data object in a mapping, the Error Table Name property for this data object is derived from the shadow table name property of the data object . If you modify the error table name of a data object (using the shadow table name property), you must synchronize all the operators bound to this data object.
If you are still facing the issue then provide your email and I can send a simple example of data rule mapping in OWB 10.2.0.5
Sutirtha -
Hi,
i am getting small problems with OWB regarding DML error logging. i was followed this link
http://blogs.oracle.com/warehousebuilder/newsItems/viewFullItem$184
i was created error table using DBMS_ERRLOG.CREATE_ERROR_LOG and i was assigned that table name in error table name property.
* the Error table name property is set for the operator (table/view/mv)
* the PL/SQL Generated Mode of the module that contains the mapping is set to 10gR2
and above or Default.
i was followed according to the instruction but i am not able to get desired output. can any one suggest me where i am wrong.
i am using set based PL/SQL mapping.
warehouse builder repository 10.2.0.1.0
regards,
kumari am also facing same problem. is there any way to handle errors in 10.2.0.1.
same as above. capture all the failed records in to error table in 10.2.0.1
Regards,
Jyothy -
Dml error logging - are exceptions redundant?
Hi there
Heard alot about dml error logging and looks good in practice.
In a data warehouse environment and wish to make use of this in a pl/sql procedure - I'm thinking is the only exception I would neeed know something like
when others
then
insert into error_table values(sqlcodes,sqlerrm);commit;
raise;
Another question as purely a background routine with no user interaction do we really need the raise - I know many posts talk about having ir or raise_application_error to alert user something went wrong but in purely batch procedures is this really necessary?
Also what is the error_stack exactly and how can you query it?
Any advice/thoughts?
Many Thanksother question as purely a background routine with no
user interaction do we really need the raise - I know
many posts talk about having ir or
raise_application_error to alert user something went
wrong but in purely batch procedures is this really
necessary?RAISE:
there a discussion going on this issue:
WHAT is the purpose of RAISE in an EXCEPTION clause ?
RAISE_APPLICATION_ERROR
this will report an error and will break out. Usually used to report errors while debugging.
Regards -
DML Error Logging Tables?
How can I use DML Error Logging Tables with OWB10gR2 (in tab-definition and mappings)?
btw: what really is a shadow-table?Hi,
What you can do to solve this is to add a Pre-mapping to your mapping which calls a procedure that alters the constraint on the target table in which you use the "EXCEPTIONS INTO <error_table> " clause.
like:
PROCEDURE "ENABLE_CONSTR_WITH_EXCEPTIONS"("P_TABLE" IN VARCHAR2, "P_CONSTRAINT" IN VARCHAR2) IS
v_table varchar2(30) := p_table;
v_constraint varchar2(30) := p_constraint;
v_command varchar2(200);
e_CannotValidate exception;
PRAGMA EXCEPTION_INIT(e_CannotValidate, -2437);
-- main body
BEGIN
/* Enable Constraint and write error into exception table */
BEGIN
v_command := 'ALTER TABLE ' || v_table || ' ENABLE CONSTRAINT '|| v_constraint ||' EXCEPTIONS INTO exceptions';
execute immediate (v_command);
commit;
END;
EXCEPTION
WHEN e_CannotValidate THEN
-- In my case when Unique Constraints are violated I will delete the duplicates.
DELETE_DUPLICATES(v_table, v_constraint);
WHEN OTHERS THEN
NULL; -- enter any exception code here
END;
-- End of ENABLE_CONSTR_WITH_EXCEPTIONS;Greetz,
Ilona Tielke -
DML ERROR LOGGING STATEMENT FAILS FOR MULTITABLE INSERT
When I use a simple expression in my dml error logging statement for a multitable insert I get 'end of file on communication channel' on the compile(in all guis tested). It works fine without the simple expression for the multitable insert. The simple expression works ok with a single table insert.
example:
this works ok for single table insert and blows up on multitable inserts:
LOG ERRORS INTO ERR$_INVOICE (TO_CHAR(SYSDATE,'YYYYMMDD HH:MI:SS')) REJECT LIMIT UNLIMITED;
this works ok for both:
LOG ERRORS INTO ERR$_CINVOICE REJECT LIMIT UNLIMITED;
any ideas?No version number, no DDl, and no DML. No help is possible.
Complete version information and a demo that people can run to duplicate your situation will increase the chance of getting help.
I, for example, have no idea what you intend with the statement multitable insert. Is this a reference to INSERT ALL or INSERT FIRST or some other syntax? -
DML Error Logging for underlying tables autocreated for dimensions
Hi,
I have problems with logging errors during mapping for underlying tables that are automatically generated for creating dimensions. I know that DML Error Logging is supposed to work only on tables, views and materialized views, and I have tried it out using a pure table in a mapping without any reference to a dimension and specifying the error table name for it. This works perfectly. The error rows were captured correctly in the error table and the correct rows were also loaded successfully to the target table.
However when it comes to mapping to a dimension, I have some issues with that. I specified the shadowtable name for the underlying table(right clicking on the table in design center and then choosing configure), and after deploying I did check that the error table/shadow table and also the target table were indeed created in the database.
The problem lies now in the mapping because I am actually mapping to a dimension and not the underlying table the dimension references to. It seems that the mapping did not manage to capture details of the error table for the underlying table that the dimension was referencing to and thus were unable to capture the errors. Only the corrected rows get loaded and there were no error messages during the loading that suggests that the incorrect rows were detected.
Would appreciate some assistance here.
Thanks!
WYHi
The DML error logging feature in 10gR2 and 11gR1 was restricted purely to tables, so the dimension operator did not support it. This is now supported in OWB 11gR2 (plus there is the orphan management functionality).
Cheers
David -
Limitation on DML error logging
Can someone please advise what is not supported by DML error logging which was introduced in Oracle 10g?
one Oracle document says "You cannot track errors in the error logging table for LONG, LOB, or object type columns".
One says only non-scalar columns, like datatime is not support.
Another one says it doesn't support nested table.
Anyone has a more complete list of limitation?
Thanks!
Edited by: user611482 on Feb 9, 2010 3:32 PMPLease read the following,
http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/tables.htm#sthref2234
HTH
Aman.... -
OWB 10gR2 Does not support DML Error Logging
I've just had this confirmed by support.
So Oracle's key ETL tool does not support 10gR2s key ETL feature DML Logging.
So far set based loads on large volume databases you are going to find yourself being tripped over into row by row processing.
I find this staggering.
Has anyone else found this?Oracle has come back to us saying that
"DML error logging feature is not supported for distributed DML."
Maybe you are looking for
-
I have had my iphone replaced twice since i got it because of problems and now my iphone 4s has had the wifi slider greyed out for some months, but since the phone was 'technically'** over a year old when it did this i wan't in guarantee anymore so h
-
Black ink not printing but not empty
My HP ENVY 5530 all in one printer is not printing black. I have checked the in level and it is 2/3rd's full. When I print a page, the color comes out but not the black. I have cleaned the printhead multiple times and when it prints the test page, al
-
PLS-S-00201 error using Pro*C
In my search looking for why sqlcst is Seg Faulting on me I used the SQLCHECK=FULL when running proc. I get 3 of the same errors on 3 different SQL statements. SQL: EXEC SQL SELECT value INTO :value FROM existing_table WHERE name = 'var'; ERROR: Erro
-
Why are commands "grayed out" on edit tab on Elements 9?
Why are commands "grayed out" (not available) on the edit tab on Elements 9?
-
Simple REGEx Group Question...
Hi, Can someone please explain something with RegEx's to me concerning groups? In the following code: Pattern p = Pattern.compile("([A-Z][a-z]+) ([a-z]+) .*"); Matcher m = p.matcher("Aus bus L. 1771"); if (m.matches()) { System.out.println("Grou