Setting Oracle environment variable using batch (.bat) file in windows

Hi,
Oracle 9i db
Windows OS
I am in process to create the database (Considered that Oracle9i software is already installed) by running one batch file which consist of all the scripts for the database creation.
But i also want to set the environment variables at MyComputer(right click)>properties>advance>environment, permenently by running the batch (.bat) file
ORACLE_HOME
ORACLE_BASE
ORACLE_SID
So, how can it be done ?
With Regards

Hi,
*@echo off*
set ORACLE_SID=iprsdb
set ORACLE_BASE=C:\oracle
set ORACLE_HOME=C:\oracle\ora92     
call C:\install_bkp\test_env_var.bat
echo Test Successfull.
Above mentioned is the code written in the batch (.bat) file
In that i have also called another .bat file which test the env. variable values which is as below:
c:\>test_env.bat
===================
Testing oracle sid
===================
iprsdb
=====================
Testing oracle base
===================
C:\oracle
=====================
Testing oracle home
=====================
C:\oracle\ora92
Test Successfull.
But when i checked at MyComputer(right click)>properties>advance>environment variables
there, I saw none of the entries from the above, why so ?
how to set env. variables permanently using the DOS commands. ?
With Regards

Similar Messages

  • Getting oracle environment variables using plsql code

    Hi Geeks,
    Can anyone tell me how to get an Oracle environment variable (eg db_cache_size) from inside a plsql block of code or through a sql query?
    Thanks,
    Prabhu

    Is it possible to update the values via SQL?That's indicated by:
    ISSES_MODIFIABLE VARCHAR2(5) Indicates whether the parameter can be changed with ALTER SESSION (TRUE) or not (FALSE)
    ISSYS_MODIFIABLE VARCHAR2(9) Indicates whether the parameter can be changed with ALTER SYSTEM and when the change takes effect:
    See the docs:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2012.htm#REFRN30176

  • Best practice for setting an environment variable used during NW AS startup

    We have installed some code which is running in both the ABAP and JAVA environment, and some functionality of this code is determined by the setting of operating system environment variables. We have therefore changed the .sapenv_<host>.csh and .sapenv_<host>.sh scripts found in the <sid>adm user home directory. This works, but we are wondering what happens when SAP is upgraded, and if these custom shell script changes to the .sh and .csh scripts will be overwritten during such an upgrade. Is there a better way to set environment variables so they can be used by the SAP server software when it has been started from <sid>adm user ?

    Hi,
    Thankyou. I was concerned that if I did that there might be a case where the .profile is not used, e.g. when a non-interactive process is started I was not sure if .profile is used.
    What do you mean with non-interactive?
    If you login to your machine as sidadm the profile is invoked using one of the files you meant. So when you start your Engine the Environment is property set. If another process is spawned or forked from a running process it inherits / uses the same Environment.
    Also, on one of my servers I have a .profile a .login and also a .cshrc file. Do I need to update all of these ?
    the .profile is used by bash and ksh
    The .cshrc is used by csh and it is included via source on every Shell Startup if not invoked with the -f Flag
    the .login is also used by csh and it is included via source from the .cshrc
    So if you want to support all shells you should update the .profile (bash and ksh) and one of .cshrc or .login for csh or tcsh
    In my /etc/passwd the <sid>adm user is configured with /bin/csh shell, so I think this means my .cshrc will be used and not the .profile ? Is this correct ?
    Yes correct, as described above!
    Hope this helps
    Cheers

  • Oracle environment variable setting for mulit instances

    Dear experts,
    I am doing CRM_ABAP, CRM_JAVA,ERP installation based on Oracle in a laptop for SAP Best Practise.
    The CRM_ABAP installation have done, and start to install CRM_JAVA named CRJ.
    In CRM_ABAP installation, I set Oracle environment variable as below:(/etc/profile.d/oracle.sh)
    ・CRACLE_SID=u201DCRMu201D
    ・CRACLE_HOME=u201Doracle/CRMu201D
    ・PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/bin/oPatch:$PATH:
    ・export CRACLE_SID CRACLE_HOME PATH
    My question is that how do I set environment variable for CRM_JAVA(CRJ) in oracle.sh,?
    I tried e.g. CRACLE_SID=u201DCRMu201D:u201DCRJu201D, CRACLE_HOME=u201Doracle/CRMu201D:u201Doracle/CRJ/102_64u201D
    or CRACLE_SID=u201DCRJu201D CRACLE_HOME=oracle/CRJ/102_64u201D export CRACLE_SID CRACLE_HOME
    in addition
    but got an error message in SAPinst (Task Progress: configure Oracle server network)
    said u201CAssertion failed:lsnrctl:Parameter dbHOME has to be a valid ORACLE_HOME).u201D
    kindly help me to reslove the issue.
    Thanks.
    regards.
    Li.etsuhin

    Setting a Linux environment variable like ORACLE_SID to multiple values will not work.
    Use another oracle.sh, and maybe also another Linux user.
    I am not familiar with the details, but what does your installation guide say?
    Or you may have to use the same values for Java. The installation guide will tell you.

  • How to read a non-oracle environment variable?

    I have been trying to read a non-oracle environment variable using TOOL_ENV.GETVAR, and have come to understand that it doesn't work. Is there another function that can do what I want? I don't want to hardcode the directory the forms and reports must reside in, but can't find anyway to make this value flexible.
    can anyone help ?
    thx
    adam

    I figured out a way. I put a String in the registry in the oracle home area, and can read it with TOOL_ENV.GETVAR now. It appears that it reads from the registry, not the environment variables. Except for unix apparently, where it reads environment variables.
    adam

  • How to set environment variables using java program

    Hi all
    I want to set environment variables on windows 98/200/xp system, such as path and classpath using a java program.
    How to do this using a java program.
    Any body plz helppppppppp.

    #1 05-02-2003, 07:38 AM
    Goodz13 Join Date: Jan 2002, Posts: 985
    Location: Halifax, NS, Canada
    Reputation:
    Java FAQ's and tutorials
    Java FAQ's
    Path and ClassPath:
    PATH
    In Windows 9x you would set it up in the autoexec.bat file
    ie.
    SET PATH=%PATH%;c:\jdk1.4.2\bin\;
    where c:\jdk1.4.2\ is the path where you installed Java.
    In Windows 2000 and XP
    Right click on My Computer->Properties->Advanced Tab->Environment Variables... Button.
    If you see a PATH in System Variables, click that and edit it. If you don't, you will need to create a new System variable.
    It should look something like this:
    %SystemRoot%\system32;%SystemRoot%;c:\jdk1.4.2\bin\;
    Any querry email me to [email protected]
    Answer by
    Rajasekhar Goli
    DS UNICS Infotech

  • Setting persitent system environment variables using java program

    hai,
    Iam tryng to write installation for an application,which require to set some persistent system environment variables using java program. I have tried using set command Runtime.getRuntime().exec("cmd /c set blah blah "),but this applies only to that particular DOS promt only,i presume.And this is not perisistent.please do help.
    Biju

    The solution I proposed worked only on Windows XP/2003.
    The following solution will work on Windows NT/2000/XP/2003 with JDK 1.2+.
    1- Download the [url http://www.gjt.org/download/time/java/jnireg/registry-3.1.3.zip]JNIRegistry zipped archive.
    2- Open the registry-3.1.3.zip file and extract in the folder of your choice ( Eg. c:\setenv ) only the 2 first files (when sorted by path): ICE_JNIRegistry.dll and registry.jar.
    You don't need to keep the folder tree in the extraction.
    3- Create the following SetEnv.java file in the same folder ( Eg. c:\setenv ).
    import com.ice.jni.registry.Registry;
    import com.ice.jni.registry.RegistryKey;
    import com.ice.jni.registry.RegStringValue;
    import com.ice.jni.registry.RegistryValue;
    public class SetEnv
        static final String REG_HKLM_SUBKEY_NAME = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
        public static void main(String[] args)
        throws Exception
            new SetEnv().exec(args);
        void exec(String[] args)
        throws Exception
            if (args.length != 2)
                throw new IllegalArgumentException("\n\nUsage: java SetEnv {varName} {varValue}\n\n");
            String varName = args[0];
            String varValue = args[1];
            RegistryKey key = null;
            RegStringValue value;
            try
                key = Registry.HKEY_LOCAL_MACHINE.openSubKey(REG_HKLM_SUBKEY_NAME, RegistryKey.ACCESS_ALL);
                value = new RegStringValue(key, varName, RegistryValue.REG_EXPAND_SZ);           
                value.setData(varValue);
                key.setValue(value);
                key.flushKey();
            finally
                try { key.closeKey(); }
                catch (Exception e) {}
    }4- Compile it.
    javac -classpath .;registry.jar SetEnv.java
    5- Run it. varName and varValue are strings of your choice.
    java -classpath .;registry.jar -Djava.library.path=. SetEnv varName varValue

  • Use environment variables in logging.properties file

    is there a way to use environment variables in logging.properties file?
    like this -
    java.util.logging.FileHandler.pattern = {$MY_BASE_LOG_FOLDER}/myapp1/log/123%g.logdo I have to write a custom logging.properties loader? if yes, then are there any examples on this?

    I'm sorry, but don't you think your answer is useless?
    Maybe I haven't made my question clear enough. I need to know if java.util.logging recognizes environment variables in logging.properties files.
    If it does not, then there should be a well-known class to use instead of standard loader for logging.properties (java api mention one briefly).

  • Can i use a environment variable inside a *.sql file?

    Hello,
    I want to create a external table.
    So i am using the command
    create or replace directory abc as 'C:\folder'.... inside a sql file.
    Now i want the path "C:\folder" to be dynamic as i am using this path in many other places also inside the sql file.So i thought to create a environment variable and put this value there.I tried using as %PATH% but it gives error..... where %PATH%=C:\folder.
    Can i use a environment variable inside a *.sql file?
    But how to do that or is there any other way.
    Thanks
    Swapna
    Edited by: user11018268 on Feb 19, 2010 1:03 AM

    user11018268 wrote:
    Actually what i want is the path "C:\folder" is not fixed it can be anything which i may not know the user may decide it later. Not supported. A directory object refers to a specific physical location (directory/folder) on a file system. Not a path.
    You can work around it by (creating and) using a function (running under a super user schema with authid definer privs). The caller (e.g. schema scott ) calls it with a physical path. E.g. GetDirectoryObject( 'C:\folder\2010\feb\week4' ).
    This function determines if there is an existing directory object for the path. If not, it uses a wildcard search to determine if there are any directory objects for parents in the path (e.g. for C:\folder\2010\feb or C:\folder\2010 or C:\folder ).
    If it finds a directory object, it interrogates the data dictionary to determine if the caller, schema scott for example, has read/write access on that directory object. If it has, it creates a new directory object and grants the caller read/write access to it. The function then returns the name of the directory object to the caller.
    The caller thus do not deal directly with directory objects. The function returns the object name given a physical path as input. Also, only a single base directory needs to be created (e.g. for C:\folder ) and access granted to the schema on it. Any sub-directory in that base directory can now be dynamically accessed by the schema.

  • Oracle Environment Variable Problem - OCIEnvNlsCreate() failed

    We are using PHP 5.2.3 with oci8 version 1.2.3 in CentOS 5.0.
    We have installed Oracle 10g in the same machine where Apache (2.2.3) is running.
    First we tried to set the Oracle environment variable in httpd.conf as
    SetEnv ORACLE_HOME u01/app/..../db_1
    SetEnv ORACLE_SID oratest.
    But we were unable to connect and got the message 'OCIEnvNlsCreate() failed'.
    Then we tried to set the environment variables in root's bash profile.
    Then it did work in PHP command line interface. But it didn't work in browser. Interestingly, getenv function shows the environment variables correctly (even in the browser).
    We also given the read and execute permissions for all users in all directories of oracle. But still it gives the same error.
    Please help.

    While trying to get new oci8 php extension to work I remember trying to set parameters using SetEnv inside apache httpd.conf or inside .htaccess file. However this is not recommended and I remember seeing some suggestions as not to use SetEnv for Oracle environment variables. I also had issues with that before. I went and added bash
    export ORACLE_HOME=... to the Apache startup script in /etc/init.d and this has resolved the problem for me.
    I hope this helps.
    Gena01

  • Set DISPLAY environment variable -- in DBCA not working at AIX OS

    Hi,
    I want to create new database in AIX OS and database is oracle 10g:-
    When i say DBCA it is giving below error, what should i do?
    $ dbca
    DISPLAY not set.
    Set DISPLAY environment variable, then re-run.
    Please help...

    Pravin wrote:
    How to set the DISPLAY environment variable in AIX?Usual format is:
    +<host>:<display-number>+
    E.g.
    export DISPLAY=192.168.0.235:1
    Where the host is the hostname or IP address of the client platform running a X-Server. If the X-Server is running locally, then this entry can be omitted.
    The display-number is the display number of the X-Server to use. A single X-Server can have multiple displays. E.g. Unix server running a X-Server can have 10 users connected via X-Terminals and will this have 10 displays.
    Judging from X-Windows questions asked on OTN, it seems to be a tad complex to grasp for some - especially those from a MS Windows background as X-Windows is very different and also reverses the client-server concept, requiring the X-Server component to be running on the client platform (where the server platform runs the program that is the X-client).
    So it is a lot easier to rather use something like VNC instead - supported on most Unix platforms, Linux, Windows and Apple's OS/X.
    Simply run the VNC server on the server platform to create a virtual container for running the X-server display. Connect from a client using a VNC client.
    As it uses the RFB (Remote Frame Buffer) protocol, it is a lot faster than running the slower and larger X11 protocol required for X-Windows connectivity over TCP/IP.

  • Why do we actuallya need the setting of environment variables?

    Hello guys,
    I read that, in order to connect to the database via SQL*Plus, we need to have the environment variables set. So, SQL*Plus is a command tool, which doesnt know over which path to connect to db, if the environment variables are not set?
    How about the needs of setting environment variables at point of view of MS-DOS? I know that over MS-DOS we can check if the environment variables are already set or not. Or we can actively set the environment variables.
    When should we actually set the environment variables? Before we run the GUI or after? I read, that if we set it before we run the GUI, then the setting will be taken over when it comes to that step by running GUI. I am curious, since this would be interesting to know, if we use other version than XE.
    Thanks..

    Oracle's flexibility ... many different versions working the same on many different versions of many different operating systems ... means that a single consistent installation and configuration methodology must work everywhere so as not to have the limitations of other competing products that work on only a single operating system or require that one learn a different syntax and methods for different versions.
    Be grateful Oracle is as it is. Your competence in one version and operating system translates into competence in others.

  • Setting new environment variable on Linux

    {noformat}I need to set new environment variable on my linux machine from inside my code. I am using csh and the command works fine from command line:
    setenv IFConfigLocation4 /home/username/myfile.xml
    But when i try the same thing from Java code it does not seem to have any effect. here is my code:
    import java.util.*;
    import java.io.*;
    public class CDE_parser_methods{
    public static String fileParse(String inFile, String parserName, String outFile, String CMConfig_locale)
    String parsed = "SUCCESSFUL";
    System.out.println("Parsing file..." + "\nParser name: " + parserName +"\nInput file name: " + inFile + "\nOutput file name: " + outFile + "\nCMConfig file is: " + CMConfig_locale);
    System.out.println("Current Java version: " + System.getProperty("java.version"));
    try
              String cmd[]={"/bin/csh", "-c", "setenv IFConfigLocation4 " + CMConfig_locale};
              Process proc = Runtime.getRuntime().exec(cmd);
              int exitVal= proc.waitFor();
              System.out.println("Value of setenv command is: " + exitVal);
              String cmd2[]={"/bin/csh", "-c", "env"};
              Process proc2 = Runtime.getRuntime().exec(cmd2);
              InputStream instr = proc2.getInputStream();
              InputStreamReader inread = new InputStreamReader(instr);
              BufferedReader buf = new BufferedReader(inread);
              String line=null;
              while((line=buf.readLine()) != null)
                   System.out.println(line);
              int exitVal2= proc2.waitFor();
              }catch(CMException cme){
                   System.out.println("Issue when trying to executing parse command, details: " + cme.getMessage());
                   System.out.println("Description of the issue is: " + cme.getDescription());
                   parsed = "FAILURE: " + cme.getDescription();
              }catch(Exception e){
                   System.out.println("Uncought exception, details: " + e.getMessage());
                   parsed = "FAILURE: " + e.getMessage();
         return parsed;
    public static void main(String[] args) {
         String results=CDE_parser_methods.fileParse("/opt/itemfield/ServiceDB/Project2/Mapping_for_Account_Number_Structure_ITS_Input_File.xls","MappingforAccountNumberStructure","/opt/itemfield/ServiceDB/Project2/test_ws_44.xml","/home/rvenishe/CMConfig.xml");
         System.out.println("Result of fileParse call is: " + results);
         }The out put of my env command does NOT contain system variable "IFConfigLocation4". Any ideas? {noformat}

    Environment variables and their values set from within a user process has their scope and lifetime limited to the process and its subprocesses. See java.lang.ProcessBuilder class and its API documentation for setting env for a subprocess that will be started by a ProcessBuilder instance. Even in the C programming we have the same limitation for the environment.
    Since they are not globally set, system command like env or Java method like System.getenv() can't see them.

  • I want to set Jdeveloper environment variables

    First,thanks for your answer.But I mean to set Jdevelop
    environment variables.If I can't set right Jdeveloper
    enironment,program can't pass the compile.Because "import
    oracle.html.*" can't be found by Jdeveloper.
    null

    Hi
    You would need to include jweb.jar file as a library in your
    project properties.
    jweb.jar comes with Oracle Application Server. Copy the jar file
    to lib directory in JDeveloper and add it as a library to the
    project.
    This would make import oracle.html.* work.
    regards
    raghu
    Micheal Chang (guest) wrote:
    : First,thanks for your answer.But I mean to set Jdevelop
    : environment variables.If I can't set right Jdeveloper
    : enironment,program can't pass the compile.Because "import
    : oracle.html.*" can't be found by Jdeveloper.
    null

  • Oracle Environment Variables on Linux

    Hi,
    First, I'll admit that I'm very, very new to Linux.  I'm running Oracle Database XE 11g R2 on a virtual machine (Virtualbox) that is running Oracle Enterprise Linux 6.  Whenever I open a terminal window and set ORACLE_HOME, PATH, and ORACLE_SID, I can easily access SQLPlus, simply by typing "SQLPlus".  However, if I close that window and then open another terminal window, I cannot access SQLPlus, simply by typing "SQLPlus".  I have to re-specify the environment variables first.
    I'm sure that this is something simple but my lack of Linux experience is keeping me from finding the issue.  Also, I've not found any documentation that helps but please point me to it if I've missed it.
    Thanks,
    Brian

    You can also set your environment by using a shell script that comes with the XE default installation:
    # source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
    There's also a backup script.
    # /u01/app/oracle/product/11.2.0/xe/config/scripts/backup.sh
    assuming that you've installed the XE instance in the default path /u01
    C.

Maybe you are looking for