用exp导出表,切割了多个文件存储(dmp01.dmp/dmp02.dmp/dmp03.dmp)。
那么imp导入的时候:
1.假如我的表只存储在dmp02.dmp中,那么我需要把所有的dmp文件都考过去恢复吗?
2.imp语句,file=怎么写?能不能给一个例子,多谢
Just be try. env oracle 19.3 PDB.
创建测试表 2张
SQL> create table anbob.test_exp as select * from all_objects;
Table created.
SQL> insert into anbob.test_exp select * from anbob.test_exp;
71615 rows created.
SQL> commit;
Commit complete.
SQL> create table anbob.test_exp2 as select * from all_objects;
Table created.
SQL> @seg anbob.test_exp
SEG_MB OWNER SEGMENT_NAME SEG_PART_NAME SEGMENT_TYPE SEG_TABLESPACE_NAME BLOCKS HDRFIL HDRBLK
---------- -------------------- ------------------------------ ------------------------------ -------------------- ------------------------------ ---------- ---------- ----------
23 ANBOB TEST_EXP TABLE USERS 2944 12 6929
12 ANBOB TEST_EXP2 TABLE USERS 1536 12 4890
导出2张表 到多个dmp文件
[oracle@oel7db1 ~]$ exp anbob/anbob@cdb1pdb1 tables=test_exp,test_exp2 filesize=5m file=testexp1.dmp,testexp2.dmp,testexp3.dmp,testexp4.dmp,testexp5.dmp,testexp6.dmp,testexp7.dmp,testexp8.dmp
Export: Release 19.0.0.0.0 - Production on Tue Jul 6 05:32:32 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table TEST_EXP
continuing export into file testexp2.dmp
continuing export into file testexp3.dmp
continuing export into file testexp4.dmp
continuing export into file testexp5.dmp
143230 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TEST_EXP2
continuing export into file testexp6.dmp
continuing export into file testexp7.dmp
71623 rows exported
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.
删除表1
[oracle@oel7db1 ~]$
[oracle@oel7db1 ~]$ sqlplus anbob/anbob@cdb1pdb1
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jul 6 05:33:13 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Last Successful login time: Tue Jul 06 2021 05:32:32 -04:00
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
USERNAME INST_NAME HOST_NAME I# SID SERIAL# VERSION STARTED SPID OPID CPID SADDR PADDR
-------------------- -------------------- ------------------------- --- ----- -------- ---------- -------- ---------- ----- --------------- ---------------- ----------------
ANBOB PDB1-anbob19c oel7db1 1 127 42096 19.0.0.0.0 20210706 2971 76 2969 00000000781BB458 0000000078D31668
SQL> drop table test_exp purge;
Table dropped.
导入 表1 只列出部分dmp file
[oracle@oel7db1 ~]$ imp anbob/anbob@cdb1pdb1 tables=test_exp filesize=5m file=testexp1.dmp,testexp2.dmp,testexp3.dmp,testexp4.dmp,testexp5.dmp
Import: Release 19.0.0.0.0 - Production on Tue Jul 6 05:33:35 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
Export file created by EXPORT:V19.00.00 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
IMP-00403:
Warning: This import generated a separate SQL file "import_sys" which contains DDL that failed due to a privilege issue.
. importing ANBOB's objects into ANBOB
. importing ANBOB's objects into ANBOB
. . importing table "TEST_EXP" 143230 rows imported
Enter name of the next file in the export file set.
Import file: expdat.dmp >
IMP-00047: unexpected file sequence number; expected 6 but found 5 <<<<<<
IMP-00132: first file in the multi-file export is testexp1.dmp
IMP-00008: unrecognized statement in the export file:
URCE
IMP-00008: unrecognized statement in the export file:
IMP-00008: unrecognized statement in the export file:
IMP-00008: unrecognized statement in the export file:
IMP-00008: unrecognized statement in the export file:
...
Note:
表记录已导入,但是会判断文件完整性,提示dmp文件未列全
验证数据
SQL> @cc pdb1
ALTER SESSION SET container = pdb1;
Session altered.
USERNAME INST_NAME HOST_NAME I# SID SERIAL# VERSION STARTED SPID OPID CPID SADDR PADDR
-------------------- -------------------- ------------------------- --- ----- -------- ---------- -------- ---------- ----- --------------- ---------------- ----------------
SYS PDB1-anbob19c oel7db1 1 127 56272 19.0.0.0.0 20210706 3019 48 3018 00000000781BB458 0000000078D0BFE8
SQL> select count(*) from anbob.test_exp;
COUNT(*)
----------
143230
评论
有用 0
比如我导出时,dumpfile参数设置如下:dumpfile=dmp_%U.dmp,
并行导出多个dmp文件;
那么导入时,需要将所有的dmp文件都拷贝过去,导入时dumpfile参数的设置如下:dumpfile=dmp_%U.dmp(和导出一样)即可。
如果只需要导入某张表,可以在参数控制:
impdp directory=dump_dir
dumpfile=dmp_%U.dmp
logfile=dmp.log
parallel=4
remap_schema=old_schema:new_schema
transform=segment_attributes:n
table_exists_action=replace
tables=tablename1
评论
有用 0我这个是imp,不是impdp。
当时exp导出时是file=dmp01.dmp,dmp02.dmp,dmp03.dmp
评论
有用 0按照官方文档的说明,导入时也需要指明导出时指定的多个文件,说明如下:
FILE
The FILE Import utility parameter specifies the names of the export files to import.
Default: expdat.dmp
Description
Specifies the names of the export files to import. The default extension is .dmp.
Because Export supports multiple export files, it can be necessary to specify multiple
file names that you want to be imported.
Chapter 25
Import Parameters
25-19You do not need to be the user that exported the export files. However, you must have
read access to the files. If you did not export the files under your user ID, then you
must also have the IMP_FULL_DATABASE role granted to you.
Example
imp scott IGNORE=y FILE = dat1.dmp, dat2.dmp, dat3.dmp FILESIZE=2048
仅供参考
评论
有用 0
墨值悬赏

