一、导出数据库
1.已管理员身份运行cmd
![](https://img.haomeiwen.com/i16111492/c10e715c990f6d25.png)
2.输入命令:
cmd> exp test/123456@orcl file=D:\oracle_bf\xzmis02.dmp owner=tablename
注意:此处账号需要有dba权限
![](https://img.haomeiwen.com/i16111492/6a19524acf176175.png)
3.导出中
![](https://img.haomeiwen.com/i16111492/2d30253479980ec0.png)
4.导出成功
![](https://img.haomeiwen.com/i16111492/cd8e2682be71ae17.png)
二、导入数据
1.导入数据:imp 用户名/密码@服务名 file=导入的dmp文件路径 full=y
cmd> imp test/123456@orcl file=D:\oracle_bf\xzmis02.dmp full=y
注意:要将数据导入到哪个库下就使用那个库对应的账号,比如需要将数据导入到 test2 中,就需要输入 test2 的账号密码
三、exp/imp 不导出空表的解决方案
1.查询空表生成sql语句
sql> select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows IS NULL;
2.复制结果执行即可
网友评论