How to backup view and some tables in oracle?

2019-07-18 09:41发布

I have an Oracle database. On the database There are three tables (a,b,c tables) and a view (union of a and b tables).

I want to backup of a dan b tables and also the view. I used this syntax exp user/psw file=backup.dmp tables=(a,b) ,but it doesnt backup the view,only the table. How can i include the view to be backed up?

标签: oracle dump
3条回答
男人必须洒脱
2楼-- · 2019-07-18 10:25

Use imp commnad with this parameters

imp user/pass@service file=dumpfile.dmp log=logfile.log full=y rows=n  ignore=n grants=n indexes=n
查看更多
Ridiculous、
3楼-- · 2019-07-18 10:29

From Oracle 10g onward, expdp is standard export command and exp is deprecated.

expdp has include clause where in you can specify tables and views you want to export. Here is a sample command.

expdp scott/tiger@mydb schemas=MYSCHEMA
 include=TABLE:"IN ('A', 'B','C')",VIEW:"IN('my_view')"  
 directory=MY_DIR dumpfile=Exp_ABC_MyView.dmp logfile=expdpExp_ABC_MyView.log

Further you can export only object definitions or data or both as well. more examples in https://oracle-base.com/articles/10g/oracle-data-pump-10g

查看更多
乱世女痞
4楼-- · 2019-07-18 10:44

You can not include a view to be backed up while using the "exp" utility. Oracle's expdp utility provides option to include views while exporting.

查看更多
登录 后发表回答