What is a .PAR File?

A .par file (short for parameter file) is a simple text file used to define parameters for Oracle utilities like Data Pump Export (EXPDP) and Data Pump Import (IMPDP). Instead of inputting parameters on the command line, you can specify them in a .par file for simplicity and reusability.

Why Use a .PAR File?

  • Simplifies Commands: It eliminates long, error-prone command lines.
  • Reusability: You can reuse .par files for recurring tasks.
  • Improves Organization: Keeps commands and parameters structured and easy to read.

Running EXPDP and IMPDP with .PAR Files in Nohup

Example 1: Data Pump Export (EXPDP)

Parameter File (export.par):

DIRECTORY=dpump_dir
DUMPFILE=export%U.dmp
LOGFILE=export.log
SCHEMAS=HR
PARALLEL=4

Command to Run in Nohup:

nohup expdp system/password@db parfile=export.par > expdp_output.log 2>&1 &

Example 2: Data Pump Import (IMPDP)

Parameter File (import.par):

DIRECTORY=dpump_dir
DUMPFILE=export%U.dmp
LOGFILE=import.log
SCHEMAS=HR
REMAP_SCHEMA=HR:HR_NEW

Command to Run in Nohup:

nohup impdp system/password@db parfile=import.par > impdp_output.log 2>&1 &

Steps to Use Nohup

  1. Prepare the .par File: Create a .par file containing all required parameters.
  2. Run the Command: Use nohup followed by the command, and redirect output to a log file for monitoring.
  3. Verify Execution: Check the output log (expdp_output.log or impdp_output.log) to ensure the process is running correctly.

Best Practices for .PAR Files

  1. Meaningful File Names: Use descriptive names like schema_export.par for clarity.
  2. Add Comments: Use # to include notes about the file’s purpose.
  3. Secure Credentials: Avoid storing passwords in .par files; supply them via command line or environment variables.

Conclusion

The .par file is an efficient way to manage Oracle database export and import operations. Combining it with nohup ensures long-running processes continue uninterrupted. By mastering this approach, you can optimize your Oracle workflows.

Have you tried using .par files with nohup? Share your experiences or tips in the comments below!

Also read:

  1. https://w3buddy.com/oracle-data-pump-export-expdp-a-complete-guide/
  2. https://w3buddy.com/oracle-data-pump-import-impdp-a-complete-guide/
  3. https://w3buddy.com/how-to-create-a-directory-for-oracle-export-import-a-step-by-step-guide/

You might like

Leave a Reply

Your email address will not be published. Required fields are marked *