oracle在dos导入导出dmp文件

本地数据库:

导入的命令:

imp 用户名/密码@ip地址:端口号/数据库实例 file='需要导入的dmp文件的路径' full = y(可能需要)ignore=y

假如导入的是本机的oracle数据库则可以用命令:

imp admin/sa@orcl file=d:\tianma.dmp full=y ignore=yimp 用户名/密码@数据库实例 file="需要导入的dmp文件的路径" full=y ignore=y

以上是导入全部的数据。如果不想导入全部的数据而是导入一个表或者是部分表的数据则用以下语句:

imp admin/sa@orcl file=d:\tianma.dmp tables(student)

imp admin/sa@orcl file=d:\tianma.dmp tables(student,class)

导出数据:

1. 将数据库test完全导出,导出到D:tianma.dmp 

exp system/manager@test file=d:\tianma.dmp full=y

2. 将数据库中的system用户与sys用户的表导出 

exp system/manager@orcl file=d:\tianma.dmp owner=(system,sys)

3. 将数据库中的表student,class导出 

exp system/manager@orcl file=d:\tianma.dmp tables(student,class)

4.将数据库中student表中filed字段以”00”打斗的数据导出 

exp system/manager@test file=d:\tianma.dmp tables(student) query=”where filed like ‘00%’”

远程数据库:

导出命令:

exp tom/[email protected]:1521/orcl file=C:\tab.dmp tables=(table1,table2,table3)

或者导出全部的表:

exp tom/[email protected]:1521/orcl file=C:\tab.dmp full=y

注意事项: 
1. 命令结尾千万不要写”;”,否则只能导出第一张表 
2. 多张表之间用英文逗号”,”隔开。 
3. 当前的用户,具有导出导出权限。

导入命令:

imp jack/[email protected]:1521/testorcl full=y file=C:tab.dmp

注意: 
1. 导入的用户需要有导入导出权限。可以通过DBA授权给这个用户。如:以sys登陆Oracle,GRANT all privileges to jack 
2. 由于是导入导出是由两个不同用户操作的完成的,所以要加上full=y 。

你可能感兴趣的:(DataBase)