数据的导出和导入
做逻辑备份将数据以.dmp的文件导出导入
cmd模式下
C:\Documents and Settings\Administrator>exp
Export: Release 10.1.0.2.0 - Production on Thu Aug 25 17:52:13 2011
Copyright (c) 1982, 2004, Oracle. All rights reserved.
--一般以sys用户做导出的操作
Username: sys as sysdba
Password:
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
Enter array fetch buffer size: 4096 >
--输入导出文件存放路径,但必须以.dmp文件保存
Export file: EXPDAT.DMP > e:\dbf\myexp.dmp
--导出的类别
(1)E(ntire database), (2)U(sers), or (3)T(ables): (2)U > t
Export table data (yes/no): yes > y
Compress extents (yes/no): yes >
Export done in WE8ISO8859P15 character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
About to export specified tables via Conventional Path ...
--导出的文件
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > hr.mydepartments
Current user changed to HR
. . exporting table MYDEPARTMENTS 27 rows exported
Table(T) or Partition(T:P) to be exported: (RETURN to quit) >
Export terminated successfully without warnings.
导入数据
C:\Documents and Settings\Administrator>imp
Import: Release 10.1.0.2.0 - Production on Thu Aug 25 18:02:38 2011
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Username: sys as sysdba
Password:
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
--导入的文件
Import file: EXPDAT.DMP > e:\dbf\myexp.dmp
Enter insert buffer size (minimum is 8192) 30720>
Export file created by EXPORT:V10.01.00 via conventional path
import done in WE8ISO8859P15 character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
List contents of import file only (yes/no): no >
Ignore create error due to object existence (yes/no): no > y
Import grants (yes/no): yes >
Import table data (yes/no): yes >
Import entire export file (yes/no): no >
Username: hr
--导入到hr
Enter table(T) or partition(T:P) names. Null list means all tables for user
Enter table(T) or partition(T:P) name or . if done: t
Enter table(T) or partition(T:P) name or . if done: mydepartments
Enter table(T) or partition(T:P) name or . if done: .
. importing SYS's objects into SYS
. importing HR's objects into HR
. . importing table "MYDEPARTMENTS" 27 rows imported
IMP-00033: Warning: Table "T" not found in export file
Import terminated successfully with warnings.
C:\Documents and Settings\Administrator>