使用Xshell進行Oracle數據庫數據的導出和導入

使用Xshell進行Oracle數據庫數據的導出和導入

一.導出

1.通過exp進行導出,exp有三種模式:
       a.  用戶模式: 導出用戶所有對象以及對象中的數據;
       b.  表模式: 導出用戶所有表或者指定的表;
       c.  整個數據庫: 導出數據庫中所有對象。

2.通過exp交互式命令行方式的使用的例子

$exp 用戶名/密碼@orcl
Enter array fetch buffer size: 4096 > 回車
Export file: expdat.dmp > txt.dmp  生成導出的文件名 
(1)E(ntire database), (2)U(sers), or (3)T(ables): (2)U > 3
Export table data (yes/no): yes > 回車
Compress extents (yes/no): yes > 回車
Export done in ZHS16GBK character set and ZHS16GBK NCHAR character set
About to export specified tables via Conventional Path ...
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > cmamenu  要導出的表名
. . exporting table                        CMAMENU       4336 rows exported
Table(T) or Partition(T:P) to be exported: (RETURN to quit) >要導出的表名n
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > 回車
Export terminated successfully without warnings.

二.導入

1.通過imp進行導入,imp導入工具將EXP形成的二進制系統文件導入到數據庫中,imp有三種模式:
       a.  用戶模式: 導出用戶所有對象以及對象中的數據;
       b.  表模式: 導出用戶所有表或者指定的表;
       c.  整個數據庫: 導出數據庫中所有對象。
   只有擁有IMP_FULL_DATABASE和DBA權限的用戶才能做整個數據庫導入
   
   imp步驟:
   (1) create table  (2) insert data  (3) create index (4) create triggers,constraints

2.通過imp交互式命令行方式的例子

[root@centos-oracle ~]# su - oracle

Last login: Thu Jun 27 13:07:19 CST 2019 on pts/4
[oracle@centos-oracle ~]$ imp 用戶名/密碼@orcl

Import: Release 11.2.0.1.0 - Production on Thu Jun 27 13:11:26 2019
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing option

Import data only (yes/no): no > 回車
Import file: expdat.dmp > 導入文件.dmp

Enter insert buffer size (minimum is 8192) 30720> 回車

Export file created by EXPORT:V11.02.00 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
export client uses US7ASCII character set (possible charset conversion)
List contents of import file only (yes/no): no > 回車
Ignore create error due to object existence (yes/no): no > 回車
Import grants (yes/no): yes > 回車
Import table data (yes/no): yes > 回車
Import entire export file (yes/no): no > 回車

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章