Home > Ask the Oracle Database / Applications Experts > Oracle database backup and recovery Questions & Answers > Unix script to create database export via crontab
Ask The Oracle Expert: Questions & Answers
EMAIL THIS

Unix script to create database export via crontab

Brian Peasland1 EXPERT RESPONSE FROM: Brian Peasland1

Pose a Question
Other Oracle Categories
Meet all Oracle Experts
Become an Expert for this site


Oracle tips, scripts, and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 28 August 2006
Hi Brian. I need to find a Unix script that will run via crontab and create a full database export. The script I have attached runs OK via ./export.sh in a Unix shell (about two hours and is 22 GB in size), but when I run it via a crontab job, it takes 18 odd hours and is about three times the actual size. I would appreciate your help on this. The script is below:
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:. 
  ; export PATH
ORACLE_SID=ris ; export ORACLE_SID
ORACLE_BASE=/oracle/app/oracle   
  ; export ORACLE_BASE
ORACLE_HOME=/oracle/app/oracle/product/10.2.0/RIS 
  ; export ORACLE_HOME
ORACLE_OWNER=oracle     ; export ORACLE_OWNER
ORACLE_GROUP=dba  ; export ORACLE_GROUP 
PATH=$PATH:$ORACLE_HOME/bin   ; export PATH
CLASSPATH=$ORACLE_HOME/DBCreate/oradev/classes/orapts.jar:
  $ORACLE_HOME/jdbc/lib/classes12.zip:$CLASSPATH
  ; export CLASSPATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH 
  ; export LD_LIBRARY 
ORAENV_ASK=NO 
TNS_ADMIN=$ORACLE_HOME/network/admin
  ; export TNS_ADMIN
TERM=vt100 ; export TERM
NLS_LANG=AMERICAN_AMERICA.US7ASCII  
  ; export NLS_LANG exp USERID="username/password@SID" 
  FILE=/oracle/app/oracle/dump/test.DMP 
  LOG=/oracle/app/oracle/dump/test.LOG COMPRESS=Y DIRECT=Y 
ROWS=Y CONSISTENT=Y FULL=Y # END


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Oracle database backup and recovery
Can I perform an Oracle server backup through a client machine?
How to execute DML in an Oracle trigger with EXECUTE IMMEDIATE
How to restore a dump file with the Oracle SHOW=Y option
Why do I get an Oracle not available error with Oracle 8i on Windows?
How to perform Oracle database recovery with a corrupt online redo log
Can I create an Oracle Catalog Database with the Enterprise Console?
Do I need to recreate views after an Oracle table reorg?
Client-based apps vs. web-based apps in Developer 2000
How to perform an Oracle 8i to 10g migration
Can I move the tablespace online with missing datafiles in Oracle?

Oracle database backup and recovery
Can I perform an Oracle server backup through a client machine?
How to execute DML in an Oracle trigger with EXECUTE IMMEDIATE
How to restore a dump file with the Oracle SHOW=Y option
Why do I get an Oracle not available error with Oracle 8i on Windows?
Oracle tutorial library: SearchOracle.com's learning guides
How to perform Oracle database recovery with a corrupt online redo log
Can I create an Oracle Catalog Database with the Enterprise Console?
Do I need to recreate views after an Oracle table reorg?
Client-based apps vs. web-based apps in Developer 2000
How to perform an Oracle 8i to 10g migration
Oracle database backup and recovery Research

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


The only thing that I would change is to move $ORACLE_HOME/bin as the first directory in your PATH.

Next, I would run the above script in its own shell, mimicking what crontab does. To do so, use the following:

sh -x scriptname

This will execute the script in its own environment, not yours. You will often see things not obvious to you when you run the script yourself.




Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Oracle White Papers: Fusion Middleware
HomeNewsTopicsTipsAsk the ExpertsMultimediaWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2003 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts