[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1174
  • Last Modified:

Oracle Schema dump from batch file

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
GNOVAK
Asked:
GNOVAK
  • 2
1 Solution
 
slightwv (䄆 Netminder) Commented:
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
 
GNOVAKAuthor Commented:
What's the best way to do this in a batch file if I'm using tnsnames....?
0
 
slightwv (䄆 Netminder) Commented:
expdp and impdp are command line programs.
0
 
Geert GruwezOracle dbaCommented:
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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now