--1.备份单表带过滤条件 [oracle@oratest expbk]$ exp userid=scott/tiger tables=t02 file=/home/oracle/expbk/t02.query.dmp query=\'where y=\'\'中国\'\'\' buffer=10000 log=/home/oracle/t02.query.exp.log
Export: Release 11.2.0.4.0 - Production on Sat Nov 9 22:23:35 2019
Copyright (c) 1982, 2011, 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, OLAP, Data Mining and Real Application Testing options Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ... . . exporting table T02 1 rows exported EXP-00091: Exporting questionable statistics. Export terminated successfully with warnings.
--2.查看备份文件和日志 [oracle@oratest expbk]$ ll total 32 -rw-r--r-- 1 oracle oinstall 16384 Nov 9 22:17 t02.dmp -rw-r--r-- 1 oracle oinstall 16384 Nov 9 22:23 t02.query.dmp [oracle@oratest expbk]$ cd .. [oracle@oratest ~]$ ll total 48 drwxr-xr-x. 7 oracle oinstall 4096 Aug 26 2013 database drwxr-xr-x 2 oracle oinstall 4096 Jun 9 14:27 Desktop drwxr-xr-x 2 oracle oinstall 4096 Jun 9 14:27 Documents drwxr-xr-x 2 oracle oinstall 4096 Jun 9 14:27 Downloads drwxr-xr-x 2 oracle oinstall 4096 Nov 9 22:23 expbk drwxr-xr-x 2 oracle oinstall 4096 Jun 9 14:27 Music drwxr-xr-x 2 oracle oinstall 4096 Jun 9 14:27 Pictures drwxr-xr-x 2 oracle oinstall 4096 Jun 9 14:27 Public -rw-r--r-- 1 oracle oinstall 508 Nov 9 22:19 t02.exp.log -rw-r--r-- 1 oracle oinstall 470 Nov 9 22:23 t02.query.exp.log drwxr-xr-x 2 oracle oinstall 4096 Jun 9 14:27 Templates drwxr-xr-x 2 oracle oinstall 4096 Jun 9 14:27 Videos [oracle@oratest ~]$ cd expbk/ [oracle@oratest expbk]$ ll total 32 -rw-r--r-- 1 oracle oinstall 16384 Nov 9 22:17 t02.dmp -rw-r--r-- 1 oracle oinstall 16384 Nov 9 22:23 t02.query.dmp
--3.将二进制的备份文件转换为文本文件查看 [oracle@oratest expbk]$ strings t02.query.dmp TEXPORT:V11.02.00 USCOTT RTABLES 8192 Sat Nov 9 22:23:35 2019/home/oracle/expbk/t02.query.dmp
-08:00 BYTE UNUSED INTERPRETED DISABLE:ALL METRICST TABLE "T02" CREATE TABLE "T02" ("X" NUMBER(*,0), "Y" VARCHAR2(20)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS INSERT INTO "T02" ("X", "Y") VALUES (:1, :2) ALTER TABLE "T02" ADD PRIMARY KEY ("X") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING ENABLE METRICSTreferential integrity constraints METRICET 1 METRICSTtriggers METRICET 1 METRICSTbitmap, functional and extensible indexes TABLE "T02" ANALSTATS CR "T02" ("X" ) BEGIN DBMS_STATS.SET_INDEX_STATS(NULL,'"SYS_C "',NULL,NULL,NULL,1,1,1,1,1,1,0,6); END; ENDTABLE METRICET 2 METRICSTposttables actions METRICET 2 METRICSTPost-inst procedural actions METRICET 2 METRICSTDeferred analyze commands TABLE "T02" ANALCOMPUTE INDEXR "T02" ANALYZI 13763 "T02" 2 ("X" ) ENDTABLE METRICET 3 METRICETG0 EXIT EXIT
--4.登陆数据库删除t02表 [oracle@oratest expbk]$ sqlplus scott/tiger SQL> drop table t02 purge;
Table dropped.
--5.开始导入数据,以追加的模式 ignore=y [oracle@oratest expbk]$ imp userid=scott/tiger tables=t02 file=/home/oracle/expbk/t02.query.dmp ignore=y buffer=10000 log=/home/oracle/t02.query.imp.log
Import: Release 11.2.0.4.0 - Production on Sat Nov 9 22:29:12 2019
Copyright (c) 1982, 2011, 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, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path import done in ZHS16GBK character set and AL16UTF16 NCHAR character set . importing SCOTT's objects into SCOTT . importing SCOTT's objects into SCOTT . . importing table "T02" 1 rows imported Import terminated successfully without warnings.
--5.检查数据 [oracle@oratest expbk]$ sqlplus scott/tiger SQL> select * from t02;
X Y ---------- -------------------- 1 中国
|