Oracle 12cR2 - How To Create DDL Script Of A View With All Dependencies and Permissions I have a view in my production database and I want to create same view in my test database.
I tried this commmand:
‌‌select dbms_metadata.get_ddl('VIEW','VIEW_NAME','VIEW_OWNER') from dual;

It generated a create script and I run it. But it didn't copy all of the dependencies, data types, etc.
How can I do this?
Regards,
That would require selecting from dba_dependencies. Since your dependencies may have their own dependencies that query would probably need to be recursive.
Also, if any of the dependencies are in a different schema then you'll also need the grants to go with them which you can get by selecting from dba_tab_privs and dba_col_privs.