Solved

exact ddl

Posted on 2014-04-15
7
295 Views
Last Modified: 2014-06-10
Could you please tell me the exact ddl for a particular schema in a database....
0
Comment
Question by:tonydba
7 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 250 total points
ID: 40002218
Take a look at SCHEMA_EXPORT of DBMS_METADATA:
http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_metada.htm

It isn't as simple as the get_ddl functions.  It will require a little more code and effort.

There are script examples for it out there if you look around.

The first one I came across:
http://www.remote-dba.net/t_advanced_extract_schema.htm
0
 
LVL 16

Assisted Solution

by:Wasim Akram Shaik
Wasim Akram Shaik earned 250 total points
ID: 40002289
Another option would be to do a expdp of the schema you want

later do a impdp only with sqlfile to get the total ddl of the schema with option content=metadata_only

refer to this question in stack over flow where in the scenario has been described in other way around by taking the export with metadata option and doing an import with sql file(import/export --data pump)

http://serverfault.com/questions/382691/create-a-definition-file-from-oracle
0
 
LVL 23

Expert Comment

by:David
ID: 40002637
Hi, this works for me:

set long 90000
set feedback off
set echo off
set heading on
set lines 100
set arraysize 100
UNDEFINE SCHEMA
SPOOL /tmp/delete.me

select
   dbms_metadata.GET_DDL(u.object_type,u.object_name,'&&SCHEMA') ||';'
from
   dba_objects u
where
   owner = '&&SCHEMA'
/  
SPOOL OFF
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 16

Expert Comment

by:Wasim Akram Shaik
ID: 40002691
Won't completely agree with dvz ..
Coz you won't get constraints info this way :)
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40002704
>>Hi, this works for me:

I don't think this will get the grants which is part of the asker's previous question.
0
 
LVL 22

Expert Comment

by:Steve Wales
ID: 40124056
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Bash Script to Analyze Oracle Schemas 11 104
Oracle SQL 6 57
Web Service from a stored procdure oracle 10 55
constraint check 2 40
This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to take different types of Oracle backups using RMAN.

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question