数据库的导入导出

一、导出:
打开CMD,输入命令: exp
Username: test@orcl
Password:
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters and Data Mining options
Enter array fetch buffer size: 4096 > //设置缓存大小,默认4096,无需修改
Export file: expdat.dmp > D:myproject_20120927.dmp //存放导出的文件名
(2)U(sers), or (3)T(ables): (2)U > 2 //选择导出的范围,
                                     //2是导出该用户下所有数据,包括表、存储过程、sequence等;
         //3是只导出某个表;通常备份选择2。
Export table data (yes ): yes > //是否导出表中的数据

二、导入:
打开CMD,输入命令: imp fromuser=test touser=test ignore=y file=D:myproject_20120927.dmp
fromuser是指你导出的库的用户ID;
touser是指你导入的库的用户ID;
ignore是指是否忽略已经存在的表;
file是指等待导入的文件。
比如你从test@orcl导出了一个文件放在D:myproject_20120927.dmp,现在你要导入本机other_test@other_orcl,那你的脚本就是imp fromuser=test touser=other_test file=D:myproject_20120927.dmp
然后会提示你输入用户名密码,然后就开始导数据了。注意命令里面的等号前后不要有空格。

原文地址:https://www.cnblogs.com/linjiqin/p/3148734.html