linux下oracle数据dmp导入

  • 格式:doc
  • 大小:51.00 KB
  • 文档页数:5

下载文档原格式

  / 11
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

1.2用imp 工具进行数据库备份及恢复

导入模式可以分为full(全文件导入),owner(用户导入),table(表导入).

full(全文件导入):指导入文件中的所有数据,并不是指全库导入,如果文件中只存在一个表的数据全文件,导入就只能导入一个表的数据.

fromuser,touser( 用户导入):指导入文件中该用户的所有数据,如果文件中只存在一个表的数据,用户导入就只能导入一个表的数据.

tables( 表导入):指导入文件中该表的数据.

能够导入何数据很大程度上依赖于导出文件,譬如需要导入某用户的所有数据.导出文件中必须存在该用户的所有数据,即导出时必须为全库导出或用户导出.在CAMS 系统中,如果为了备份整个cams 用户的数据应该在导出时选择全库或者用户导出.

说明:

导入时需要注意需要事先创建需要导入的用户以及该用户的所有权限,所以在执行以下导入的用例之前,都需要先创建cams用户.创建CAMS用户的脚本见附录

1.2.1 典型用法

1. 交互式-用户导入

[oracle@localhost script]$ imp

Import: Release 8.1.7.4.0 - Production on Mon Feb 9 13:59:02 2004

(c) Copyright 2000 Oracle Corporation. All rights reserved.

Username: cams --此处输入启动导入的用户

Password: --此处输入相应的密码

Connected to: Oracle8i Enterprise Edition Release 8.1.7.4.0 -Production

JServer Release 8.1.7.4.0 - Production

Import file: expdat.dmp > /tmp/2004020601.dmp

--此处输入需要导入的文件名,如果导出数据时导出到了多个文件,

则imp 会提示用户需要输入下一个需要导入的文件名.交互式导入时大多数参数都有缺省值.如果选用缺省值,直接回车即可.

Enter insert buffer size (minimum is 8192) 30720>

--此处需要输入buffer值,此处通常选择缺省值,直接回车.

Export file created by EXPORT:V08.01.07 via conventional path

import done in ZHS16CGB231280 character set and ZHS16CGB231280 NCHAR

character set

IMP-00046: using FILESIZE value from export file of 1073741824

List contents of import file only (yes/no): no >

--如果选择yes则imp 会显示出导入文件的数据,并且这些数据这不会被导入数据库中.如果事先不知道导入文件中有哪些数据,可以利用此参数查看文件内容.此处直接回车.

Ignore create error due to object existence (yes/no): no > --是否忽略对象已经存在的错误,如果选择yes 则出现对象已经存在的错误时,不显示错误信息.

Import grants (yes/no): yes > --是否导入授权通常选择yes

Import table data (yes/no): yes > --是否导入表中数据如果选择no,则只导入表的结构通常选择yes

Import entire export file (yes/no): no > --是否导入整个文件如果选择yes,则imp 导入整个文件的数据.如果选择no,则下面会提示需要导入的用户名以及表名

Username: camsii --需要导入的用户名

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: . ?需要导入的表名或表的分区名如果输入表名则只导入该用户模式下的表的数据如果输入回车或

.

则表示要导出该用户的所有数据此处输入

.

. . importing table "TBL_BILLDETAIL_SWITCH" 0 rows imported

. . importing table "TBL_BLACKLIST" 0 rows imported

. . importing table "TBL_CHARGE_CARD" 0 rows imported

. . importing table "TBL_DISCOUNT_BY_TIME" 0 rows imported

. . importing table "TBL_ERROR_CODE" 377 rows imported

About to enable constraints..

.

Import terminated successfully with warnings.

该命令从文件中导入cams 用户的所有数据如果有多个文件imp 会提示用户输入文件名

2. 交互式-表导入

可以利用全库导出用户导出和表导出的文件进行表导入.此例可以使用exp典型用法的例1,例2,例3,例4,例5,例8导出的文件进行导入

[oracle@localhost script]$ imp

Import: Release 8.1.7.4.0 - Production on Mon Feb 9 15:49:36 2004

(c) Copyright 2000 Oracle Corporation. All rights reserved.

Username: cams

Password:

Connected to: Oracle8i Enterprise Edition Release 8.1.7.4.0 -Production

JServer Release 8.1.7.4.0 - Production

Import file: expdat.dmp > /tmp/2004020601.dmp

Enter insert buffer size (minimum is 8192) 30720>

Export file created by EXPORT:V08.01.07 via conventional path

import done in ZHS16CGB231280 character set and ZHS16CGB231280 NCHAR

character set

IMP-00046: using FILESIZE value from export file of 2147483648

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 >

Username: cams

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: tbl_log

Enter table(T) or partition(T:P) name or . if done: tbl_user_log

Enter table(T) or partition(T:P) name or . if done:

--每输入一个表名后回车,imp 会提示用户输入下一个要导入的表名,如果想结束输入表名,需要输入回车或"."

. importing CAMS's objects into CAMS

. . importing table "TBL_LOG" 10 rows imported

. . importing table "T BL_USER_LOG" 0 rows imported

Import terminated successfully with warnings.

该命令从文件中导入cams 用户的两个表的数据如果有多个文件imp 会提示用户输入文件名

3. 命令行-查看文件内容