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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s