Purpose of ORAENV_ASK=NO / YES variable in Oracle


It is mandatory to set ORACLE_SID, ORACLE_HOME environments to connect to the oracle database. Oracle provides a script called oraenv to set or change these variables. ORAENV_ASK environment variable is used to make the oraenv (/usr/local/bin/oraenv) script to interactive or non-interactive.

If you set the parameter value as YES (default) it will ask for the values ORACLE_SID, ORACLE_HOME. If you set the value as NO it will take blank or the values which is set already for the ORACLE_ parameters.


See an example here.

  1. In below example I am trying to run a shell script with sql file as argument in silent mode (ORAENV_ASK=NO) in ORACLE RAC environment. The argument values taken from the command which I provided in the command prompt.

$export ORAENV_ASK=NO;export ORACLE_SID=DEVDB1;export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_DEVDB1;. oraenv;export ORACLE_SID=DEVDB12; ./sql.sh inse.sql

The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_DEVDB1 is /u01/app/oracle

  1. In second example I set the value for ORAENV_ASK=YES and it is asking the value for the ORACLE_SID during the script execution.

$ export ORAENV_ASK=YES;export ORACLE_SID=DEVDB1;export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_DEVDB1;. oraenv;export ORACLE_SID=DEVDB12; ./sql.sh inse.sql
ORACLE_SID = [DEVDB1] ?
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_DEVDB1 is /u01/app/oracle
DBA Tips Data Pump Reference

0 comments:

Post a Comment

 

dba topics. Copyright 2011-16 All Rights Reserved | Site Map | Contact | Disclaimer | Google