将数据从一个工作区导入到另一个工作区
Importing data from one workspace to another workspace
在 oracle apex 中,从 table 导出的数据是以 .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
谁能帮我解决这个错误
你搞错了。工作区是 Apex 应用程序的容器,它不包含 用户数据 。这就是您的问题所暗示的 ("export data in a CSV format")。数据存储在table(驻留在table空间中)并属于某个用户。
截至无效月份:检查源和目标的 NLS 设置是否相同。例如,如果日期格式设置为 YYYY-MM-DD,则 20.03.2018 无效。或者,如果您的日期存储在 VARCHAR2 列中,现在应该插入到 DATE 数据类型列中,您应该提防无效日期(例如 Feb 30th 或 30.42.2018 等)。
尝试通过 XML 执行此操作会产生一个与前一个错误无关的错误 - 它表示您正在尝试加载 child一些 table 中的值,但它的 parent 尚不存在,这违反了外键约束。
如果我是你,我不会使用 CSV 或 XML 文件迁移数据,而是使用专为此类事情设计的 Oracle(数据泵)导出和导入实用程序。我鼓励您调查数据泵,或者 - 至少 - 原始的 EXP 和 IMP 实用程序。
[编辑:简单的 EXP/IMP 实用程序用法示例]
用户 SCOTT table 名为 DEPT。我想导出它,然后将它导入 MIKE 的模式(目前没有 table):
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 table 以及里面有什么:
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 都有许多可以使用的参数;再次 - 检查文档。
在 oracle apex 中,从 table 导出的数据是以 .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
谁能帮我解决这个错误
你搞错了。工作区是 Apex 应用程序的容器,它不包含 用户数据 。这就是您的问题所暗示的 ("export data in a CSV format")。数据存储在table(驻留在table空间中)并属于某个用户。
截至无效月份:检查源和目标的 NLS 设置是否相同。例如,如果日期格式设置为 YYYY-MM-DD,则 20.03.2018 无效。或者,如果您的日期存储在 VARCHAR2 列中,现在应该插入到 DATE 数据类型列中,您应该提防无效日期(例如 Feb 30th 或 30.42.2018 等)。
尝试通过 XML 执行此操作会产生一个与前一个错误无关的错误 - 它表示您正在尝试加载 child一些 table 中的值,但它的 parent 尚不存在,这违反了外键约束。
如果我是你,我不会使用 CSV 或 XML 文件迁移数据,而是使用专为此类事情设计的 Oracle(数据泵)导出和导入实用程序。我鼓励您调查数据泵,或者 - 至少 - 原始的 EXP 和 IMP 实用程序。
[编辑:简单的 EXP/IMP 实用程序用法示例]
用户 SCOTT table 名为 DEPT。我想导出它,然后将它导入 MIKE 的模式(目前没有 table):
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 table 以及里面有什么:
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 都有许多可以使用的参数;再次 - 检查文档。