How to backup view and some tables in oracle?

做~自己de王妃 提交于 2019-12-12 17:05: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?


回答1:


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




回答2:


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.




回答3:


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


来源:https://stackoverflow.com/questions/42358681/how-to-backup-view-and-some-tables-in-oracle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!