Oracle支持三种类型的输出:
- 表方式(T方式),将指定表的数据导出。
- 用户方式(U方式),将指定用户的所有对象及数据导出。
- 全库方式(Full方式),将数据库中的所有对象导出
必须在cmd窗口下执行语句,否则报错
1.备份scott的两个表(结构和数据),exp 用户名/密码@数据库连接名 file=盘符:\文件名.dmp,文件夹back记得先建好
exp userid=scott/tiger@orcl tables=(emp,dept) file=C:\back\emp_dept.dmp
2.system用户帮scott用户备份jobs表(结构和数据)
exp userid=system/Oracle11gR2@orcl tables=(scott.jobs) file=C:\back\jobs.dmp
3.如果只导出结构,末尾加rows=n
exp userid=system/Oracle11gR2@orcl tables=(scott.jobs) file=C:\back\jobs.dmp rows=n
4.11g版本不要使用direct=y直接导出,虽然快但是有bug
参考链接:
https://blog.csdn.net/L905128009/article/details/76026552
http://www.xifenfei.com/2018/08/exp-direct-y-imp-ora-01400.html
5.导出scott用户的方案(所有对象),加owner后面跟用户
exp userid=scott/tiger@orcl owner=scott file=C:\back\full.dmp
6.dba权限用户导出其他用户方案,userid改成拥有dba权限的用户即可
exp userid=system/Oracle11gR2@orcl owner=scott file=C:\back\system_exp_scott.dmp
7.数据库全部导出,只能以dba用户运行
exp userid=system/Oracle11gR2@orcl full=y file=C:\back\full.dmp
8.导入表,跟导出一样,exp换成imp
imp userid=scott/tiger@orcl tables=bonus file=C:\back\bonus.dmp