• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Shell Script to run DataPump Import Export

by admin

question: How to create a shell script to run export/import utilities?

Here is a sample script to run the import/export utilities of datapump. Modify the script to set environment variables like ORACLE_HOME, ORACLE_SID, DUMPDIR, etc according to your choice and environment.

The script:

# SCRIPT
# ---------
#
# Set environment variables for ORACLE_HOME, ORACLE_SID,
# and DUMPDIR -- in case of datapump --, as well as PATH if needed.
#
#

trap '' 1 # to use nohup in a shell script

# Set these to appropriate values if needed:
#
# ORACLE_HOME=
# ORACLE_SID=
# DUMPDIR=

# Customize PATH if needed
#
# PATH=/bin:/usr/bin:${ORACLE_HOME}/bin:/usr/local/bin:/usr/lbin

# export ORACLE_HOME ORACLE_SID PATH

echo "Exporting $ORACLE_SID database. start `date`"
#
expdp system/password dumpfile=scott.dmp directory=DUMPDIR schemas=scott logfile=scott.log
#
echo "Export of $ORACLE_SID database completed at `date`"

# End of Script

Running the script

If you save the script as exp_comp.sh, type the following command at the Unix prompt to run it:

# ./exp_comp.sh
Note: Edit the above script to use it for your specific exports or imports (like full, schema, table, TTS).

In case of traditional export/imp (exp/imp), the above command may be something like:

$ exp system/manager file=scott.dmp owner=scott log=scott.log

Filed Under: oracle

Some more articles you might also be interested in …

  1. Interview Questions : Oracle 12c Multitenant Database Architecture
  2. Oracle SQL script to Show current Users and SQL being Executed
  3. Starting, Stopping, and Checking the Status of the EM Cloud Control OMS
  4. How to drop and recreate TEMP Tablespace in Oracle
  5. ORA-00904: invalid identifier
  6. Queries to find out the SQL which is using these temporary tablespace
  7. Oracle sql script to report the list of files stored in ASM and CURRENTLY NOT OPENED
  8. How to find Cluster Name and Grid Version in Oracle RAC
  9. How to use Privilege Analysis in Oracle Database
  10. What is OCFS or OCFS2

You May Also Like

Primary Sidebar

Recent Posts

  • aws ec2: CLI for AWS EC2 (Command Examples)
  • aws cur – Create, query, and delete AWS usage report definitions (Command Examples)
  • aws configure – Manage configuration for the AWS CLI (Command Examples)
  • aws cognito-idp: Manage Amazon Cognito user pool and its users and groups using the CLI

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright