原文转载于:http://blog.chinaunix.net/u/7121/showart_321915.html
将数据从一个用户导入到另一个用户所遇到的问题。
第一步:导入数据
[oracle@olivenan oracle]$ imp MASAMK/MASAMK file=/opt/data/TB_GPIDF_GPPERSON_TREND_ANALY.dmp ignore=y rows=n;
Import: Release 9.2.0.4.0 - Production on Fri Jun 15 14:36:22 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.00.01 via conventional path
IMP-00013: only a DBA can import a file exported by another DBA
IMP-00000: Import terminated unsuccessfully
导入出错,原因是导出的用户不是MASAMK,而是其它用户。我们的解决方法是试图找到导出该数据的用户。
第二步:接下来使用fromuser,touser进行操作。
接下来使用fromuser,touser进行操作,由于不知fromuser应取何值,随便给个就行。
[oracle@olivenan oracle]$ imp system/oracle fromuser=test touser=masamk file=/opt/data/TB_GPIDF_GPPERSON_TREND_ANALY.dmp ignore=y rows=n;
Import: Release 9.2.0.4.0 - Production on Fri Jun 15 14:19:19 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.00.01 via conventional path
Warning: the objects were exported by GPIDF, not by you
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
IMP-00034: Warning: FromUser "TEST" not found in export file
Import terminated successfully with warnings.
注意上面的红色字体,标识数据是从GPIDF用户导出。
第三步:接下来,可以将数据导入到system用户下,不建议这样做。
[oracle@olivenan oracle]$ imp system/oracle file=/opt/data/TB_GPIDF_GPPERSON_TREND_ANALY.dmp ignore=y rows=n full=y;
Import: Release 9.2.0.4.0 - Production on Fri Jun 15 14:20:54 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.00.01 via conventional path
Warning: the objects were exported by GPIDF, not by you
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
. importing GPIDF's objects into SYSTEM
Import terminated successfully without warnings.
第四步:导入表结构
[oracle@olivenan oracle]$ imp system/oracle fromuser=gpidf touser=masamk file=/opt/data/TB_GPIDF_GPPERSON_TREND_ANALY.dmp ignore=y rows=n;
Import: Release 9.2.0.4.0 - Production on Fri Jun 15 14:22:35 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.00.01 via conventional path
Warning: the objects were exported by GPIDF, not by you
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
. importing GPIDF's objects into MASAMK
Import terminated successfully without warnings.
第五步:导入数据
[oracle@olivenan oracle]$ imp system/oracle fromuser=gpidf touser=masamk file=/opt
/data/TB_GPIDF_GPPERSON_TREND_ANALY.dmp ignore=y rows=y;
Import: Release 9.2.0.4.0 - Production on Fri Jun 15 14:22:44 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.00.01 via conventional path
Warning: the objects were exported by GPIDF, not by you
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
. importing GPIDF's objects into MASAMK
. . importing table "TB_GPIDF_GPPERSON_TREND_ANALY" 2362 rows imported
Import terminated successfully without warnings.
[oracle@olivenan oracle]$
将数据从一个用户导入到另一个用户所遇到的问题。
第一步:导入数据
[oracle@olivenan oracle]$ imp MASAMK/MASAMK file=/opt/data/TB_GPIDF_GPPERSON_TREND_ANALY.dmp ignore=y rows=n;
Import: Release 9.2.0.4.0 - Production on Fri Jun 15 14:36:22 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.00.01 via conventional path
IMP-00013: only a DBA can import a file exported by another DBA
IMP-00000: Import terminated unsuccessfully
导入出错,原因是导出的用户不是MASAMK,而是其它用户。我们的解决方法是试图找到导出该数据的用户。
第二步:接下来使用fromuser,touser进行操作。
接下来使用fromuser,touser进行操作,由于不知fromuser应取何值,随便给个就行。
[oracle@olivenan oracle]$ imp system/oracle fromuser=test touser=masamk file=/opt/data/TB_GPIDF_GPPERSON_TREND_ANALY.dmp ignore=y rows=n;
Import: Release 9.2.0.4.0 - Production on Fri Jun 15 14:19:19 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.00.01 via conventional path
Warning: the objects were exported by GPIDF, not by you
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
IMP-00034: Warning: FromUser "TEST" not found in export file
Import terminated successfully with warnings.
注意上面的红色字体,标识数据是从GPIDF用户导出。
第三步:接下来,可以将数据导入到system用户下,不建议这样做。
[oracle@olivenan oracle]$ imp system/oracle file=/opt/data/TB_GPIDF_GPPERSON_TREND_ANALY.dmp ignore=y rows=n full=y;
Import: Release 9.2.0.4.0 - Production on Fri Jun 15 14:20:54 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.00.01 via conventional path
Warning: the objects were exported by GPIDF, not by you
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
. importing GPIDF's objects into SYSTEM
Import terminated successfully without warnings.
第四步:导入表结构
[oracle@olivenan oracle]$ imp system/oracle fromuser=gpidf touser=masamk file=/opt/data/TB_GPIDF_GPPERSON_TREND_ANALY.dmp ignore=y rows=n;
Import: Release 9.2.0.4.0 - Production on Fri Jun 15 14:22:35 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.00.01 via conventional path
Warning: the objects were exported by GPIDF, not by you
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
. importing GPIDF's objects into MASAMK
Import terminated successfully without warnings.
第五步:导入数据
[oracle@olivenan oracle]$ imp system/oracle fromuser=gpidf touser=masamk file=/opt
/data/TB_GPIDF_GPPERSON_TREND_ANALY.dmp ignore=y rows=y;
Import: Release 9.2.0.4.0 - Production on Fri Jun 15 14:22:44 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.00.01 via conventional path
Warning: the objects were exported by GPIDF, not by you
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
. importing GPIDF's objects into MASAMK
. . importing table "TB_GPIDF_GPPERSON_TREND_ANALY" 2362 rows imported
Import terminated successfully without warnings.
[oracle@olivenan oracle]$