vi par.txt userid=system/oracle tables=(user.table,...) query="where org_no like 32%" filesize=1000M file=1.dmp,2.dmp,3.dmp statistics=none indexes=N log=exp.log
vi exp.sh
exp parfile=par.txt
nohup ./exp.sh &
imp coast/coast@127.0.0.1:1521/sid file=. ewsmgnt.dmp tables=(T_NODES,T_SD_BGK4500_1,T_SD_BGK4500_2,T_SD_BGK6150_2C,T_SD_CABELL229,T_SD_POSITION,T_SD_RAINGAUGE) exp userid=zf/j@oracle9i tables=xsxkbn file=xsxkb20110825_2.dmp exp userid=zf/j@oracle9i tables=(table1,table2,table3) file=xsxkb20110825_2.dmp
例子:
exp sgcis/password@jjgk files=/home/oracle/jjgk-ogg0717-1.dmp logs=/home/oracle/jjgk-ogg0717-1.log tables=PM_PRJECT_INFO,PM_SIN_PROJECT_INFO,PM_PROPLAN_FCB,PM_PRJECT_APPROVAL,PM_SIN_PHASE_INFO exp sgcis/password@jjgk files=/home/oracle/jjgk-ogg0717-2.dmp logs=/home/oracle/jjgk-ogg0717-2.log tables=PM_NEXT_RISK_INFO,PM_SECU_RISK_INFO,PM_PRO_SAFE_MONTHREP,PM_PRO_SAFE_BASEINFO2,PM_PROGRESS_COLLECT_DEL exp sgcis/password@jjgk files=/home/oracle/jjgk-ogg0717-3.dmp logs=/home/oracle/jjgk-ogg0717-3.log tables=PM_PROGRESS_COLLECT,PM_BID_PROJECT_INFO,IM_PART_ARMY_BASIINFO,PM_PART_UNITS,PM_IMPL_PLAN exp sgcis/password@jjgk files=/home/oracle/jjgk-ogg0717-4.dmp logs=/home/oracle/jjgk-ogg0717-4.log tables=PM_PRJECT_STAGE,P_CODE,PM_PROGRESS_FILL_DET,PM_PLAN_ITEM_LIBRARY,ISC_SPECIALORG_UNIT,ISC_ORG_ATTRIBUTE
详情见:
http://blog.csdn.net/xyz846/article/details/6437963
各种问题:
1.EXP-00091: EXP-00091: Exporting questionable statistics
指定Linux系统的NLS_LANG环境变量为数据库的数据集
1)查询数据库的字符集(方法很多只用一种)
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.ZHS16GBK
2)设置Linux操作系统的NLS_LANG环境变量
[oracle]$export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
Window系统的环境变量的修改方法是:
C:>set NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
[oracle@node2 ~]$ exp -help Export: Release 11.2.0.1.0 - Production on Mon Mar 12 02:07:04 2018 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. You can let Export prompt you for parameters by entering the EXP command followed by your username/password: Example: EXP SCOTT/TIGER Or, you can control how Export runs by entering the EXP command followed by various arguments. To specify parameters, you use keywords: Format: EXP KEYWORD=value or KEYWORD=(value1,value2,...,valueN) Example: EXP SCOTT/TIGER GRANTS=Y TABLES=(EMP,DEPT,MGR) or TABLES=(T1:P1,T1:P2), if T1 is partitioned table USERID must be the first parameter on the command line. Keyword Description (Default) Keyword Description (Default) -------------------------------------------------------------------------- USERID username/password FULL export entire file (N) BUFFER size of data buffer OWNER list of owner usernames FILE output files (EXPDAT.DMP) TABLES list of table names COMPRESS import into one extent (Y) RECORDLENGTH length of IO record GRANTS export grants (Y) INCTYPE incremental export type INDEXES export indexes (Y) RECORD track incr. export (Y) DIRECT direct path (N) TRIGGERS export triggers (Y) LOG log file of screen output STATISTICS analyze objects (ESTIMATE) ROWS export data rows (Y) PARFILE parameter filename CONSISTENT cross-table consistency(N) CONSTRAINTS export constraints (Y) OBJECT_CONSISTENT transaction set to read only during object export (N) FEEDBACK display progress every x rows (0) FILESIZE maximum size of each dump file FLASHBACK_SCN SCN used to set session snapshot back to FLASHBACK_TIME time used to get the SCN closest to the specified time QUERY select clause used to export a subset of a table RESUMABLE suspend when a space related error is encountered(N) RESUMABLE_NAME text string used to identify resumable statement RESUMABLE_TIMEOUT wait time for RESUMABLE TTS_FULL_CHECK perform full or partial dependency check for TTS VOLSIZE number of bytes to write to each tape volume TABLESPACES list of tablespaces to export TRANSPORT_TABLESPACE export transportable tablespace metadata (N) TEMPLATE template name which invokes iAS mode export Export terminated successfully without warnings.
上回的情况是导数据、发现源端和目标端表结构不一致(目标端多了一个时间戳字段) 在源端建了一个临时表(和目标端的表结构一致) 然后使用
insert into PM_NEXT_RISK_INFO0719
(id, pk_id, updatetime)
select id, pk_id, '2017-07-20' from PM_NEXT_RISK_INFO
导出和导入某些表的表结构:
导出脚本:
exp 'userid="/ as sysdba"' file=ddl.dmp rows=n tables=BIDPRO.ECP_QC_MATERIAL_2_CLASS,BIDPRO.BID_KV_STRUCT
注意:EXP-00006: 出现内部不一致的错误 EXP-00000: 导出终止失败,原因是用户内含有分区表,删除分区表后再导出即可,如分区表需要,可以单独导出。
exp 'userid="/ as sysdba"' file=ddl.dmp indexes=n triggers=n constraints=n rows=n tables=BIDPRO.bid_task_filedetail
INDEXES=no --不导出索引
TRIGGERS=no --不导出触发器
CONSTRAINTS=no --不导出约束
导入脚本:
imp 'userid="/ as sysdba"' file=ddl.dmp fromuser=BIDPRO touser=BIDPRO
数据库迁移之pipe+imp/exp
https://blog.csdn.net/ruichaolin/article/details/6826019
相同表结构:
insert into PM_PROGRESS_FILL_DET select * from sgcis.PM_PROGRESS_FILL_DET0719;
字符集问题:
1.export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
解决办法:export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK