Solved

Oracle Schema dump from batch file

Posted on 2013-12-02
4
988 Views
Last Modified: 2013-12-03
Is there any way to export the schema script with and without data from a batch file.
The reason I want the batch file is so that I can schedule it.
0
Comment
Question by:GNOVAK
  • 2
4 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39689818
You should be able to do a datapump export for the schema with and without data.

The online docs have the syntax and all the options.
0
 

Author Comment

by:GNOVAK
ID: 39690287
What's the best way to do this in a batch file if I'm using tnsnames....?
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39690292
expdp and impdp are command line programs.
0
 
LVL 36

Accepted Solution

by:
Geert Gruwez earned 500 total points
ID: 39692280
if you do it with data, you can later extract the metadata without the data

here is the reference to the expdp
http://docs.oracle.com/cd/E11882_01/server.112/e22490/dp_export.htm#SUTIL200

export script for windows (you didn't state what os)
commandline expdp from the host
set oracle_sid=TheOracleSid
expdp TheSchema/passw schema=TheSchema dumpfile=TheDumpfile.dmp content=all

Open in new window


if you want to extract the script to script.sql

set oracle_sid=TheOracleSid
impdp TheSchema/passw schema=TheSchema dumpfile=TheDumpfile.dmp sqlfile=script.sql

Open in new window


the files will be stored in path data_pump_dir
> select data_path from dba_directories where name = 'DATA_PUMP_DIR';
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.

Join & Write a Comment

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now