匯入表的部分資料到測試環境

kewin發表於2009-02-26

匯入表的部分資料到測試環境

   開發人員發現在生產庫有些資料有問題,需要測試是否功能有問題,但由於生產環境不能直接進行測試,只好把資料匯入到測試環境來測試。
下面描述通過exp 的query引數來完成這個任務。
在生產環境上編輯如下的exp.par 引數檔案:
tables=sum50a.zbindb
file=pdm.dmp
log=pdm.log
query=" where bid ='tbpcCAkh3cpdmsum50a--g5q'"
buffer=32680000
注意query的寫法。
生成dmp檔案
exp \'/ as sysdba\' parfile=exp.par

下面是執行的過程:
Export: Release 9.2.0.8.0 - Production on Fri Jan 16 09:28:16 2009

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to: Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16CGB231280 character set (possible charset conversion)

About to export specified tables via Conventional Path ...
Current user changed to SUM50A
. . exporting table                         ZBINDB          1 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.

ftp到測試環境,匯入到測試環境。
編輯imp.par 引數檔案:
fromuser=sum50a
touser=sum50a
file=/orabak/pdm.dmp
ignore=y
注意:一定要加上ignore 引數,否則imp會報錯:表已經存在,不能再次匯入。
加入ignore 引數可以跳過該錯誤。
不加ignore 引數時的錯誤:
Export file created by EXPORT:V09.02.00 via conventional path
import done in UTF8 character set and AL16UTF16 NCHAR character set
import server uses ZHS16CGB231280 character set (possible charset conversion)
export client uses US7ASCII character set (possible charset conversion)
. importing SUM50A's objects into SUM50A
IMP-00015: following statement failed because the object already exists:
 "CREATE TABLE "ZBINDB" ("OBID" VARCHAR2(24), "ZBINDATA" LONG, "ZLEN" NUMBER("
 "*,0))  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 "
 "FREELISTS 1 FREELIST GROUPS 1)                          LOGGING NOCOMPRESS"

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/40239/viewspace-557985/,如需轉載,請註明出處,否則將追究法律責任。

相關文章