GotoDBA Did You Know,Features Did You Know #20 – Exporting Views

Did You Know #20 – Exporting Views

Starting with Oracle 12.1 we can export views as tables. This means that the export will contains a “create table” command and its data, while the original object was actually a view.

If we use this command:

expdp liron/liron directory=exp dumpfile=exp_view.dmp include=view query=\"where name='V_EMP'\"

It will export the view as a view (import will perform CREATE VIEW)
Now we can use the VIEWS_AS_TABLES clause:

expdp liron/liron directory=exp dumpfile=exp_table.dmp views_as_tables=v_emp

This command will execute the query and generate a “create table” command, so an import will actually create a table called v_emp and insert all the data the view contains.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post