Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖
1#
发表于 2014-11-18 16:20:30
Replication Fails with "Error ORA-01843: not a valid month" (Doc ID 1299383.1)

OCI Error ORA-01843: not a valid month (status = 1843), SQL <INSERT INTO "MAC"."AMX_SETTLE_FILE_NOTIFICATION" ("PROC_BATCH","BRIC","NUMBER_OF_RECORDS","NUMBER_OF_CREDITS","NUMBER_OF_DEBITS","NUMBER_OF_REJECTS","FILE_REF_NUMBER","FILE_CREATION_DATE","FILE_RECEIP>
Operation failed at seqno 114 rba 68317228
Discarding record on action DISCARD on error 1843
Problem replicating MAC.AMX_SETTLE_FILE_NOTIFICATION to MAC.AMX_SETTLE_FILE_NOTIFICATION
Mapping problem with insert record (target format)...
*
PROC_BATCH = 564096
BRIC = NULL
NUMBER_OF_RECORDS = 43
NUMBER_OF_CREDITS = 0
NUMBER_OF_DEBITS = 18
NUMBER_OF_REJECTS = 0
FILE_REF_NUMBER = 1138AE73
FILE_CREATION_DATE = 0000-00-00 00:00:00
FILE_RECEIPT_DATE = 0000-00-00 00:00:00
HASH_TOTAL_AMOUNT = 88001
HASH_DEBIT_AMOUNT = 88001
HASH_CREDIT_AMOUNT = 0
ID = 47278
FILE_STATUS = Accepted with Errors


For the two Date fields "FILE_CREATION_DATE" and "FILE_RECEIPT_DATE",  the value is invalid as "0000-00-00 00:00:00"

Cause

This is because Oracle does NOT check the content of DATE values when data are directly loaded from a client to the server in some cases. So on the source instances there are invalid values. When GG tries to insert them on the target instances through a normal "Insert" command, Oracle checks these values and returns the error.

Detailed explanations can be found in "Date Field Contains All Zeros (Doc ID 312973.1)"

Solution

OGG has a function to convert the invalid value to something acceptable to Oracle Database.


1.Add a convert function in the colmap for the Date column. Here is an example for the replicat param file.


REPLICAT rep02
sourcedefs dirdef/eora02.def
USERID gg11, PASSWORD gg11
map gg11.test_date, target sh.test_date,
colmap (usedefaults,
FILE_CREATION_DATE = @IF ( @STRCMP ( FILE_CREATION_DATE, "0000-00-00:00:00:00") = 0, "", FILE_CREATION_DATE)
FILE_RECEIPT_DATE = @IF ( @STRCMP ( FILE_RECEIPT_DATE, "0000-00-00:00:00:00") = 0, "", FILE_RECEIPT_DATE)
);

-- Sometimes the string compare does not work because of other characters in the column.
-- Use this alternate colmap test instead
colmap (usedefaults,
FILE_CREATION_DATE = @IF (( @STRFIND( FILE_CREATION_DATE, "0000-00-00",1) = 1, "", FILE_CREATION_DATE)
FILE_RECEIPT_DATE  = @IF (( @STRFIND( FILE_RECEIPT_DATE,  "0000-00-00",1) = 1, "", FILE_RECEIPT_DATE)
);

2.Save the changes and restart replicat.


References
NOTE:312973.1 - Date Field Contains All Zeros


This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process, and therefore has not been subject to an independent technical review.

回复 显示全部楼层 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-5-13 16:07 , Processed in 0.049596 second(s), 21 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569