oracle-databasekshexpdp

LRM-00116: syntax error at 'DIRECTORY' following '='


Hi I'm creating a script to refresh oracle schema. While trying to backup the schema I kept getting the error below.

I have searched everywhere and no one seems to be having this same exact error. Any advise?

#!/bin/ksh
systemPwd=pwd
srcSID=src
tarSID=tar
srcSCHEMA=A
tarSCHEMA=A

export_source_schema(){
echo
echo -------------------------
echo "EXPORTING SOURCE SCHEMA"
echo -------------------------
expdp system/${systemPwd}@${srcSID} SCHEMAS=${srcSCHEMA} DIRECTORY=EXP_IMP_DIR DUMPFILE=${taskNo}_${srcSID}_${srcSCHEMA}_export.dmp  LOGFILE=${taskNo}_${srcSID}_${srcSCHEMA}_export.log
}

    ./export_schema.ksh 


    -------------------------
    EXPORTING SOURCE SCHEMA
    -------------------------
    LRM-00116: syntax error at 'DIRECTORY' following '='

    ./export_schema.ksh[502]: break: cannot break

Solution

  • Ok finally I find out what was my mistake, I was setting the variable by prompting user to input it - which obviously is not wrong but the mistake was I made a separate function to ask user for input. So this means when the user input a value that becomes a variable, and the scope of that variable stayed local to that function therefore not available for other functions. Once I remove the user prompts out of a function this resolves the issue.