在oracle apex中,表格中的数据导出是以.csv格式完成的,在将数据加载到另一个工作区时,它会显示错误ORA-01843: not a valid month
我尝试以.xml格式导入数据,但它也会产生错误:
ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00222: error received from SAX callback function ORA-02291: integrity constraint (RETAIL_CLOUD.RCM_CUSTOMER_FK2) violated - parent key not found
有人可以帮我解决这个错误
答案 0 :(得分:0)
你错了。工作区是Apex应用程序的容器,它不包含用户数据。这就是您的问题所暗示的内容("以CSV格式导出数据")。数据存储在表格中(位于表空间中)并且属于某个用户。
从无效月份开始:检查源和目标的NLS设置是否相同。例如,如果日期格式设置为YYYY-MM-DD,则20.03.2018无效。或者,如果您的日期存储在VARCHAR2列中,现在应该插入DATE数据类型列,您应该注意无效日期(例如2月30日或30.42.2018等)。
尝试通过XML执行此操作会产生一个错误,该错误与前一个错误无关 - 它表示您正在尝试将子值加载到某个表中,但是 parent 尚未存在,违反了外键约束。
如果我是你,我不会使用CSV或XML文件迁移数据,而是使用Oracle(数据泵)导出&导入专为此类设计的实用程序。我鼓励您研究数据泵,或者至少 - 原始的EXP和IMP实用程序。
[编辑:简单的EXP / IMP实用程序使用示例]
用户SCOTT具有名为DEPT的表。我想导出它,然后将其导入MIKE的架构(目前还没有该表):
SQL> connect mike/lion@orcl
Connected.
SQL> select * from tab where tname = 'DEPT';
no rows selected
SQL> $exp scott/tiger@orcl tables=dept file=my_export.dmp
Export: Release 11.2.0.2.0 - Production on Pet O×u 9 08:23:13 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Tes
Export done in EE8MSWIN1250 character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table DEPT 4 rows exported
Export terminated successfully without warnings.
已完成导出。现在,导入:
SQL> $imp mike/lion@orcl file=my_export.dmp full=y
Import: Release 11.2.0.2.0 - Production on Pet O×u 9 08:23:29 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Tes
Export file created by EXPORT:V11.02.00 via conventional path
Warning: the objects were exported by SCOTT, not by you
import done in EE8MSWIN1250 character set and AL16UTF16 NCHAR character set
. importing SCOTT's objects into MIKE
. importing SCOTT's objects into MIKE
. . importing table "DEPT" 4 rows imported
Import terminated successfully without warnings.
它也成功完成了。最后,让我们检查一下MIKE现在是否有DEPT表以及那里有什么:
SQL> show user
USER is "MIKE"
SQL> select * From dept;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL>
如您所见,这很简单。 EXP和IMP都有许多参数可以使用;再一次 - 检查文档。