Solved

Oracle Schema dump from batch file

Posted on 2013-12-02
4
1,066 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 77

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 77

Expert Comment

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

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

726 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