导出(exp): 将数据库中数据备份压缩成一个二进制系统文件.可以在不同OS间迁移,它有三种模式:
1、用户模式:导出用户所有对象和对象中的数据
exp username/password@servername owner=xxx file=d:\xxx\xxx.dmp
2、表模式:导出用户所有的表或指定表
exp username/password@servername owner=xxx file=d:\xxx\xxx.dmp tables=(tb1,tb2...tbn)
3、整个数据库:导出整个数据库的对象
exp username/password@servername file=d:\xxx\xxx.dmp full=y
如果有需要日志文件,可以在后面加上->log=d:\xxx\xxx.txt
导入(imp):将EXP形成的二进制系统文件导入到数据库中,同样也是三种模式:
1、 用户模式: 导入用户所有对象以及对象中的数据
imp username/password@servername fromuser=xxx touser=xxx file=d:\xxx\xxx.dmp;
2、 表模式: 导入用户所有表或者指定的表
imp username/password@servername fromuser=xxx file=d:\xxx\xxx.dmp TABLES=(tb1,tb2....tbn)
3、 整个数据库: 导入数据库中所有对象
imp username/password@servername file=d:\xxx\xxx.dmp FULL=Y;
注意:要注意的一点事exp和imp都不是sql的里面的语法,执行命令要配置exp和imp的环境才行,如果没有配置环境就需要cmd进入oracle安装路径的bin目录下执行命令。