一、資料庫中的表TRPW_SAMPLE100HZ匯出和匯入方式
1)、匯出
C:\Windows\system32>exp sa/liuxuezong@rtsos file=d:\test.dmp tables=(TRPW_SAMPLE100HZ
)
Export: Release 10.2.0.1.0 - Production on 星期五 2月 17 08:59:49 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
串連到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
已匯出 ZHS16GBK 字元集和 AL16UTF16 NCHAR 字元集
即將匯出指定的表通過常規路徑...
. . 正在匯出表 TRPW_SAMPLE100HZ匯出了 2 行
成功終止匯出, 沒有出現警告。
C:\Windows\system32>
2)、匯入
C:\Windows\system32>imp sa/liuxuezong@rtsos file=d:\test.dmp tables=(TRPW_SAMPLE100HZ
) ignore=y
ignore=y功能主要防止資料中已經存在該表,匯入資料時會提示報錯。
Import: Release 10.2.0.1.0 - Production on 星期五 2月 17 08:57:18 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
串連到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
經由常規路徑由 EXPORT:V10.02.01 建立的匯出檔案
已經完成 ZHS16GBK 字元集和 AL16UTF16 NCHAR 字元集中的匯入
. 正在將 SA 的對象匯入到 SA
. 正在將 SA 的對象匯入到 SA
. . 正在匯入表 "TRPW_SAMPLE100HZ"匯入了 2 行
成功終止匯入, 沒有出現警告。
C:\Windows\system32>
二、資料庫中sa使用者的表匯出和匯入方式
1)、匯出
C:\Windows\system32>exp sa/liuxuezong@rtsos file=d:\rtsos.dmp owner=(sa)
Export: Release 10.2.0.1.0 - Production on 星期五 2月 17 09:22:09 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
串連到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
已匯出 ZHS16GBK 字元集和 AL16UTF16 NCHAR 字元集
即將匯出指定的使用者...
. 正在匯出 pre-schema 過程對象和操作
. 正在匯出使用者 SA 的外部函數庫名
. 匯出 PUBLIC 類型同義字
. 正在匯出專用類型同義字
. 正在匯出使用者 SA 的物件類型定義
即將匯出 SA 的對象...
. 正在匯出資料庫連結
. 正在匯出序號
. 正在匯出簇定義
. 即將匯出 SA 的表通過常規路徑...
. . 正在匯出表 TRPW_SAMPLE100HZ匯出了 2 行
. 正在匯出同義字
. 正在匯出視圖
. 正在匯出預存程序
. 正在匯出運算子
. 正在匯出參考完整性約束條件
. 正在匯出觸發器
. 正在匯出索引類型
. 正在匯出位元影像, 功能性索引和可擴充索引
. 正在匯出後期表活動
. 正在匯出實體化視圖
. 正在匯出快照日誌
. 正在匯出作業隊列
. 正在匯出重新整理組和子組
. 正在匯出維
. 正在匯出 post-schema 過程對象和操作
. 正在匯出統計資訊
成功終止匯出, 沒有出現警告。
C:\Windows\system32>
2)、匯入
C:\Windows\system32>imp sa/liuxuezong@rtsos file=d:\rtsos.dmp full=y ignore=y
Import: Release 10.2.0.1.0 - Production on 星期五 2月 17 09:49:12 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
串連到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
經由常規路徑由 EXPORT:V10.02.01 建立的匯出檔案
已經完成 ZHS16GBK 字元集和 AL16UTF16 NCHAR 字元集中的匯入
. 正在將 SA 的對象匯入到 SA
. 正在將 SA 的對象匯入到 SA
. . 正在匯入表 "TRPW_SAMPLE100HZ"匯入了 2 行
成功終止匯入, 沒有出現警告。
C:\Windows\system32>
三、說明
如果您只是想匯出個別表,可以使用第一個方法;如果您想匯出整個使用者表,可以使用第二個方法。在使用imp命令匯入資料時,可能出現拒絕錯誤:ORA-00001: 違反唯一約束條件,您可以忽略該項,要保持匯入表的資料一致性,最簡單的方法是刪除該表全資料,不少情況要先是將該表徹底刪除,然後再匯入備份的資料表檔案。