1.在要导入的oracle数据库上创建相应的用户,只有拥有IMP_FULL_DATABASE和DBA权限的用户才能做整个数据库导入。
create user username identified by password
grant dba to username
2.导入前Linux服务器切换到oracle用户
su - oracle
3.imp导入工具
导入工具imp也分交互式和非交互式
(1)交互式命令行方式
$ imp
Username: username
Password: password
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Import data only (yes/no): no >
是否只导入数据
Import file: expdat.dmp > /t/t.dmp
导入数据库文件的路径
Enter insert buffer size (minimum is 8192) 30720>
输入插入缓冲区大小(最小为 8192 )
Export file created by EXPORT:V10.02.01 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
export client uses US7ASCII character set (possible charset conversion)
export server uses UTF8 NCHAR character set (possible ncharset conversion)
List contents of import file only (yes/no): no >
只列出导入文件的内容
Ignore create error due to object existence (yes/no): no > yes
由于对象已存在, 忽略创建错误
Import grants (yes/no): yes >
导入权限
Import table data (yes/no): yes >
导入表数据
Import entire export file (yes/no): no > yes
导入整个导出文件
. importing XXXXXXobjects into XXXXXX
. . importing table "t" 2775 rows imported
Import terminated successfully with warnings.
(2)交互式命令行方式
$ imp usrname/password file = t.dmp full=y