Generate DDL for Tables using PLSQL Package.

Generate DDL  for Tables.

In this article , we will see Generating DDL for tables in various methods.

Generating DDL is  much easier using Plsql Package

Plsql Package :

DBMS_METADATA.GET_DDL 

Method 1 :

The below script  will help you to take DDL only for a single table

Check Logfile at os level

 

Method 2 :

This below example will help you to take DDL for all the tables in schema.

Check logfile it will show all the tables under schema

 

Method 3 :

The below script  will help you to take DDL for a table along with INDEXES.

Here is the output in logfile

 

Method 4 :

The below script will help you get  DDL for multiple users.

 

Method 5 :

The below script is used to generate DDL for a schema using DATAPUMP utility

Now import Metadata into another user using remap_schema

Here the dump file was imported into U2 user using remap_schema option.

 

Method 6:

The  below script will help you to take SCHEMA DDL.

Here is the output

Method 7 :

The below script will help you to take Tablespace DDL.

Here is the output

Method 8 :

The below script will hep to take  which  Roles Granted to a schema .

Here is the output

Method 9 :

The below script will help you to take all users creation DDL

Here is the few lines of  output

Method 10 :

The below script will help you to take System Grants  of a Schema

 

 

 

 

Thanks for browsing KTExperts.com…….

 

Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

Add Comment