Question: How do I export a view in
Oracle? I tried using exp, but I could only export the base
tables for the view and I had to use
dbms_metadata.get_ddl for the view definition. Is
there a way to directly export a view?
Answer: You cannot export view
directly with the older exp utility. On releases that
support Data Pump (expdp) you can export views only as part
of a schema-level export, using with the following syntax:
expdp scott/tiger . . . schema=my_schema
include=views
You must then filter out the view upon import. See my
notes on how to import a view.
Another approach is to use SQL*Plus to export the view
columns in comma delimited format:
spool export_view.txt
select
col1||','||col2||'v'||col3
from
myview;
spool off
Yet another approach to export a view is to
create a table from the view using CTAS and then export the
table: