数据库的逻辑备份和恢复:exp和imp
1.导库:导出和导入整个数据库
2.导表空间:导出和导入表空间
3.导表用户:导出和导入用户中所有对象
4.导表:导出和导入表或表分区
(1)commit=y 插入并提交,频繁提交会影响数据库效率。提交数据库过大时可以添加。
(2)ignore=y/n 该参数表示忽略创建错误,并继续执行。
(3)full=y 是否完全导入。
1.导出导入表
备份测试表:
create tables emp_test as select * from emp_test;
exp导出数据库表:
exp [email protected] file=/oracle/bak_oracle/emp_test.dmp tables="emp_test"
按条件进行选择性导出
exp [email protected]:1521/orcl file=/oracle/bak_oracle/emp_test.dmp tables="emp_test" query=\"where sal between ‘1000‘ and ‘2000‘\" log=/oracle/bak_oracle/emp_test.log
用有权限用户导出不同用户的不同表
exp \‘sys/syste as sysdba\‘ file=/oracle/bak_oracle/emp_test.dmp tables="scott.emp_test,test.tab_test"
注:oracle用户登录并且配置了TNSNAME可以直接scott/123456
[email protect