Obtain DDL for objects/users in oracle

I recently came across situation where I needed to recreate a public database link in a non-prod database environment and application team didn't know the password required for this particular user being used for the db link.

I did the following to obtain the DDL out of production:


set long 999999
select dbms_metadata.get_ddl('DB_LINK', 'LINKNAME', 'PUBLIC') from dual;

I had to do the same for a user that didn't get created that I wanted to quickly create myself without using exp/imp.

select dbms_metadata.get_ddl('USER','&USERNAME') from dual;

Comments

Popular posts from this blog

RMAN-10038: database session for channel prm3 terminated unexpectedly

ORA-17630: Mismatch in the remote file protocol version client 2 server 3

ORA-00338: log {n} of thread {n} is more recent than control file