Setting environment using custom script

In our environment we have multiple db's of different versions running on same server.
We are building a custom env script to set all env variables. We have created below script, it's not setting environment.
Script is :
#!/bin/sh
set -x
if [ $# != 1 ] ; then
echo "Wrong number of parameters.Expected Oracle sid as parameter..exiting!!"
exit 1
fi
PATH=/var/opt/oracle/bin:/usr/bin:/usr/xpg4/bin:/usr/ucb:/usr/openwin/bin:/usr/dt/bin:/usr/local/bin:/usr/ccs/bin:/opt/SUNWspro/
bin:/opt/EMCpower/bin:/etc:/var/opt/oracle/standard/bin:/sbin:/usr/5bin:/usr/sbin:/usr/openv/neer/bin:/usr/openv/netbackup/bin:/
usr/proc/bin:/usr/afsws/bin; export PATH
unset ORACLE_SID LD_LIBRARY_PATH LIBPATH ORA_NLS33 ORA_NLS10
ORACLE_SID=$1
export ORACLE_SID
ORAENV_ASK="NO";export ORAENV_ASK
. oraenv
if [ $? != 0 ] ; then
echo "Running oraenv again from standard location /usr/local/bin/oraenv"
. /usr/local/bin/oraenv
fi
echo "Oracle home is $ORACLE_HOME"
LD_LIBRARY_PATH=$ORACLE_HOME/lib; export LD_LIBRARY_PATH
LIBPATH=$ORACLE_HOME/lib; export LIBPATH
SHLIB_PATH=$ORACLE_HOME/lib; export SHLIB_PATH
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data; export ORA_NLS33
ORA_NLS10=$ORACLE_HOME/nls/data; export ORA_NLS10
If I do env | grep ora after script finishes. Changes in environment variable are not reflected. kindly help. Although I used set -x and saw that it's running fine.

Not sure what you mean, but if I understand your need, functions might be a solution.
The following is my oracle user's profile (it's Linux, but Solaris shouldn't be different) :
export EDITOR=vi
umask 022
export ORACLE_BASE=/home/oracle/base
o10()
{       export ORACLE_SID=db102
        export ORACLE_HOME=$ORACLE_BASE/OraHome10
        export LD_LIBRARY_PATH=$ORACLE_HOME/lib
        export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
        export TNS_ADMIN=$ORACLE_BASE/OraHome11/network/admin
        export PS1='[\u@\h_10 \W]\$ '
o92()
{       export ORACLE_SID=db92
        export ORACLE_HOME=/scsi/OraHome92
        export LD_LIBRARY_PATH=$ORACLE_HOME/lib
        export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
        export TNS_ADMIN=$ORACLE_BASE/OraHome11/network/admin
        export PS1='[\u@\h_92 \W]\$ '
o11()
{       export ORACLE_SID=db11
        export ORACLE_HOME=$ORACLE_BASE/OraHome11
        export LD_LIBRARY_PATH=$ORACLE_HOME/lib
        export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
        export PS1='[\u@\h_11 \W]\$ '
xe()
{       export ORACLE_SID=XE
        export ORACLE_BASE=/usr/lib/oracle/xe/app/oracle
        export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/server
        export LD_LIBRARY_PATH=$ORACLE_HOME/lib
        export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
        export TNS_ADMIN=/home/oracle/base/OraHome11/network/admin
        export PS1='[\u@\h_XE \W]\$ '
}If I want to set Oracle 10 environment I enter
$ o10
and similarly for others.

Similar Messages

  • Any easy to way to use custom scripts?

    Is there any plug-in or whatever that gives me a separate window where i can just click to use custom script? Any other easy ways are fine.

    You should be able to use the Actions palette for this. You can record the selection of a Script as an Insert Menu Item step in an Action. But this has been broken almost since the scripting functionality was added, in that the steps which invoke the scripts disappear from your stored Actions after Illustrator is quit and relaunched.
    It would be a hugely useful thing if Adobe ever bothered to fix this. You could automate things that are a combination of operations that can be performed by Actions but not by scripts, and vice-versa. But people have been after Adobe to fix this for something like seven versions now.
    You can organize the Scirpts menu into folders. And you can organize the Actions palette into Sets. It's just idiotic that Illustrator provides no mechanism for easy access to that organization, as does InDesign. Typical half-baked feature implementation.
    But it's a moot point now, anyway. I really no longer care whether Adobe gets around to fixing the many, many things that Illustrator has so long needed, because I'm not going to pay monthly rent for Illustrator, even if they do. ;-)
    JET

  • I don't seem to be able to activate the Never Remember History in Privacy. It is set to Use Custom Settings, I change it to Never Remember History but whenever I open up options, it has reverted to Never remember history. How can I change it? Thank you

    At the moment my privacy settings are Use Custom Settings in Private Browsing mode with no third party cookies. Recently however when I log out of hotmail the msn homepage comes up. So I decided to change to never remember history settings. However, whenever I change it, it always reverts back to Use Custom Settings. Why and how can I change it?
    Thank you

    Firefox shows the "Use custom settings for history" setting as an indication that at least one of the history and cookie settings is not the default to make you aware that changes were made.
    If all History settings are default then the custom settings are hidden and you see "Firefox will: (Never) Remember History".
    You enter Private Browsing mode if you select:
    * Tools > Options > Privacy > History: Firefox will: "Never Remember History"
    *Tools > Options > Privacy > Firefox will: "Use custom settings for history" > [X] "Always use private browsing mode"

  • How to set volume using Powershell script?

    I would like to know on how to set volume under Window 7 Home 64 bits system using Powershell script.
    Such as 8000 levels as default
    Does anyone have any suggestions?
    Thanks in advance for any suggestions
    Thanks in advance for any suggestions

    Try this.
    Function Set-SpeakerVolume{
    Param (
    [switch]$min,
    [switch]$max,
    [int]$Percent
    $wshShell = new-object -com wscript.shell
    If ($min){
    1..50 | % {$wshShell.SendKeys([char]174)}
    ElseIf ($max){
    1..50 | % {$wshShell.SendKeys([char]175)}
    elseif($Percent){
    1..50 | % {$wshShell.SendKeys([char]174)}
    1..($Percent/2) |% {$wshShell.SendKeys([char]175)}
    Else{
    $wshShell.SendKeys([char]173)
    This works in Windows 8.1.
    Stolen / Modified from
    http://blogs.technet.com/b/heyscriptingguy/archive/2013/07/28/weekend-scripter-cheesy-script-to-set-speaker-volume.aspx, which took me 20 seconds of (apparently) lucky searching.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • When I try to set my 'History Setting' to 'Use custom settings for history' it doesn't appply - it continually defults to 'Never Remember History' - how do I fix it?

    When I got into my 'History Setting' and click on 'Use custom settings for history' it doesn't apply. I click on the 'OK' tab and it appears to apply and then closes. When I go back into it, in order to see if it applied, it has reset back to the 'Never Remember History'. How do I fix it?

    If "Never Remember History" is displayed then that means that you are in Private Browsing mode and that all other history settings have the default value.
    *https://support.mozilla.com/kb/Private+Browsing
    If you intend to run Firefox in Private Browsing mode the that is OK.<br />
    Otherwise you need to leave mode.
    To see all History and Cookie settings, choose: Tools > Options > Privacy, choose the setting <b>Firefox will: Use custom settings for history</b>
    * Deselect: [ ] "Permanent Private Browsing mode"

  • [Solved] Trying to set environment variables in script

    I'm trying to create a script that will pass environment variables that will stay valid after the script exits.
    The problem with this is that (by design?) when executing a script it opens a child environment, and inherits the environmental variables from the parent.
    The issue is that the child cannot interact with the parent's environment so setting variables like:
    export http_proxy='http://server:port'
    wont stay valid once the script exits. I've verified this by trying to echo the variable once the script completes, and i receive an empty reply.
    The only work around I have for this is to include this within a bash profile, however I cant just keep adding scripts into my bash profile, because that seems counter-intuitive.
    Is there any way to do what I'm trying to do? Or am I just grabbing at straws here?
    below is my code for my script, perhaps I've done something wrong...
    proxy=x.x.x.x
    port=#
    username=domain\\username
    password=userpassword
    export http_proxy='http://$username\:$password@$proxy\:$port'
    export ftp_proxy='ftp://$username\:$password@$proxy\:$port'
    exit
    Last edited by isolatedvirus (2011-10-04 10:58:52)

    One thing to note is that you should specify the sourced file by its path so it includes a slash, quoting bash(1):
    source filename [arguments]
    Read and execute commands from filename in the current shell environment
    and return the exit status of the last command executed from filename.
    If filename does not contain a slash, file names in PATH are used to find
    the directory containing filename. The file searched for in PATH need
    not be executable. When bash is not in posix mode, the current directory
    is searched if no file is found in PATH. If the sourcepath option to the
    shopt builtin command is turned off, the PATH is not searched
    So if sourcepath is set (as by default), you can end up sourcing the wrong file, e.g.
    source file
    (DON'T do it!)
    will really source /usr/bin/file, even if you have 'file' in current directory.
    Instead, always specify the path,
    source ./file
    Keep this in mind or you're in for a big surprise.
    Last edited by lolilolicon (2011-10-04 11:33:48)

  • Set env using a script and run the command (dependency on the env)

    I need to set the env varaible by running a shell script with arguments as 'ksh setEnviron r6.1' and then run the command in the
    same process. the command has dependency on the previous script which sets the env variables.
    With Runtime.getRuntime().exec( cmd1); ,Runtime.getRuntime().exec( cmd2); I am not able to execute the Cmd2 as it is running in different process.
    How do solve this issue.
    Is there any other method to run the command to set env variables and run the second command.(dependent on the env) to get the output.
    Please help me out in this.

    ganesh_mak wrote:
    final String[] commands = {
                              ". setEnviron r6.1",
                                "/usr/add-on/test/Xbin/sql name from list where date.eq.05/22/08",
    Process penv = Runtime.getRuntime().exec("/bin/sh");
    BufferedReader br = new BufferedReader( new InputStreamReader( penv.getInputStream() ) );
    BufferedReader stdError = new BufferedReader(new InputStreamReader(penv.getErrorStream()));
    final OutputStream writer =  penv.getOutputStream();
    for (int i=0; i<commands.length;i++)
         writer.write(commands.getBytes("utf-8"));
         writer.write("\n".getBytes());
    String line;
    while((line = br.readLine())!=null){
    System.out.println(line);
    br.close();
    writer.close();
    I tried the above code but its not working...............
    please correct me.
    Do you think I used the '-i' argument just for fun? Did you do a 'man sh' and 'man bash' to see what the arguments do? If not then do it now.
    Do you think I used Theads to process stderr and stdout just for fun? I've shown you the basic approach. I have shown you how you need to create Threads to process stdout and stderr. If you have not understood and you have not studied http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html then do so now.
    Edited by: sabre150 on Jun 2, 2008 3:43 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Unable to move my database to a new environment using database script

    I have generated a database script from my dev machine by ; right click on DB >> tasks >> generate scripts. Then on my staging environment I open the script file inside sql server management studio , and I execute the script.
    But the script raised the following errors:-
    Msg 5133, Level 16, State 1, Line 2
    Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\TMS.mdf" failed with the operating system error 2 (failed to retrieve text for this error. Reason: 15105).
    Msg 1802, Level 16, State 1, Line 2
    CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
    Msg 5011, Level 14, State 5, Line 1
    User does not have permission to alter database 'TMS', the database does not exist, or the database is not in a state that allows access checks.
    Msg 5069, Level 16, State 1, Line 1
    ALTER DATABASE statement failed.
    Msg 911, Level 16, State 4, Line 3
    Database 'TMS' does not exist. Make sure that the name is entered correctly
    can anyone adivce what is the problem ?

    refer this article to find default data & log location.
    http://technet.microsoft.com/en-us/library/dd206993.aspx
    Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
    Praveen Dsa | MCITP - Database Administrator 2008 |
    My Blog | My Page

  • Custom Script using Classifications

    Hi.
    I am wondering if it is possible and how I would go about using custom scripts to use classifications to display particular things.
    This is the goal:
    To classify events (back end) and then based on the classification of an event, on the detail page (front end) it will trigger the display of a different web form that was created for that event classification.
    This is because I have 3 different types of events that I want to display on my calendar but each need thier own booking form.
    Any help would be awesome, I have no idea where to even start with this one.
    Thanks in advance.
    K

    Hi Kristen,
    The only way to do that would be to crate a content holder for each category. Then, place different forms inside those content holders and then insert those content holders into event details when you're creating an event. This means you need to remove the booking form from the detail layout.
    Cheers,
    -mario

  • How to write CLOB parameter in a file or XML using shell script?

    I executed a oracle stored procedure using shell script. How can i get the OUT parameter of the procedure(CLOB) and write it in a file or XML in UNIX environment using shell script?
    Edit/Delete Message

    SQL> var c clob
    SQL>
    SQL> begin
      2          select
      3                  DBMS_XMLGEN.getXML(
      4                          'select rownum, object_type, object_name from user_objects where rownum <= 5'
      5                  ) into :c
      6          from    dual;
      7  end;
      8  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> set long 999999
    SQL> set heading off
    SQL> set pages 0
    SQL> set feedback off
    SQL> set termout off
    SQL> set trimspool on
    // following in the script is not echo'ed to screen
    set echo off
    spool /tmp/x.xml
    select :c from dual;
    spool off
    SQL>
    SQL> --// file size
    SQL> !ls -l /tmp/x.xml
    -rw-rw-r-- 1 billy billy 583 2011-12-22 13:35 /tmp/x.xml
    SQL> --// file content
    SQL> !cat /tmp/x.xml
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
      <ROWNUM>1</ROWNUM>
      <OBJECT_TYPE>TABLE</OBJECT_TYPE>
      <OBJECT_NAME>BONUS</OBJECT_NAME>
    </ROW>
    <ROW>
      <ROWNUM>2</ROWNUM>
      <OBJECT_TYPE>PROCEDURE</OBJECT_TYPE>
      <OBJECT_NAME>CLOSEREFCURSOR</OBJECT_NAME>
    </ROW>
    <ROW>
      <ROWNUM>3</ROWNUM>
      <OBJECT_TYPE>TABLE</OBJECT_TYPE>
      <OBJECT_NAME>DEPT</OBJECT_NAME>
    </ROW>
    <ROW>
      <ROWNUM>4</ROWNUM>
      <OBJECT_TYPE>TABLE</OBJECT_TYPE>
      <OBJECT_NAME>EMP</OBJECT_NAME>
    </ROW>
    <ROW>
      <ROWNUM>5</ROWNUM>
      <OBJECT_TYPE>TABLE</OBJECT_TYPE>
      <OBJECT_NAME>EMPTAB</OBJECT_NAME>
    </ROW>
    </ROWSET>
    SQL>

  • [Services and Systems]Custom script .bat for testing Avaibility for Service

    Hi,
    I am trying to create a Service in grid control.
    For the step - Create Generic Service: Service Test, I use custom script test type.
    I've already done this kind of service with a custom script stored on Unix system (script sh -> OK). However, this time, I can only use a script stored on Windows server.
    I tested with a *.bat* file but I got this error :
    Error encountered while executing test.:Beacon-Test
    Here my configuration :
    Grid Control 10.2.0.5
    Windows Server 2005
    My script .bat :
    echo 1
    What type of file do I have to use under Windows so that the test of service works?
    Thanks
    Related links :
    http://www.oracle.com/technology/obe/obe10gEMR2/Quick_Start/system_services/system_services.htm
    http://download.oracle.com/docs/cd/B16240_01/doc/user.102/b28678/services.htm#CHDCAIJC
    Oliver

    Hi,
    here the results of my searchs :
    1 - All .BAT files must begin with : @ECHO OFF
    2 - All scripts have to send only numbers
    Oliver

  • Custom scripts inside a WBEM fetchlet

    Hi,
    Can I use scripts (that query CIMOM instances and get the result) inside a WBEM fetchlet just like we use scripts in a OS Fetchlet ? In the extensibility guide, there is no mention of using custom scripts inside a WBEM fetchlet. Please clarify.
    Thanks.

    Your best bet will be to use the OSLineToken fetchlet to invoke perl or some other executable which knows how to call a python script. The agent has no special handling for python.

  • Possible to set shortcut for file scripts custom script ?

    i have some custom scripts in file > scripts. i'd like to set a shortcut key for them, but you can't do that thru edit > keyboard shortcuts because the custom ones don't show up, only "other script F12" shows up.
    is there a way to set a shortcut to execute a custom script? i am using Ai CS3 version 13.0.2
    some work arounds i tried that didn't seem to work:
    - setting the script as an action - didn't work, the script does a bunch of stuff that can't be solved by actions
    - setting an action and inserting a menu item, then setting a shortcut to run the action - doesn't help because menu item (the script) gets disassocated from the action every time you shut down Ai. sometimes it disassociates itself. tried to save the actions and reload them, but the scripts were still disassociated
    thanks

    As it sounds like you have already discovered, you should be able to define an Action with but one InsertMenuCommand step in it. That menu command would be the selection of your script from the File Menu.
    However, that functionality has been broken for four full versions now. The Menu Command step goes vacant after quitting and re-launching Illustrator.
    I keep an Action in my Actions palette titled CurrentScript. I can at least, at the beginning of a work session in which I know I will need to call a particular script repeatedly, re-do the Insert Menu Item step and have it survive during the work session. (It will, of course, be gone if I quit & relauch.)
    If Actions could reliably call scripts from the File menu, one could do some very cool things. Many operations in the standard UI are not available via the scripting model, and of course vice-versa. Simply being able to reliably call scripts as individual steps of an Action would open the door for elaborate automations that perform both scripted functions and those available in the UI.
    But alas, users have been complaining about this bug for four versions now.
    I think it is conceivable that one could build a Javascript that employs the ScriptUI functionality, and have that script run automatically at launch. That script could simply be a "dashboard" palette from which to call other scripts. But one should not have to go to such ridiculous lengths to work around a bug that has gone unaddressed for so long.
    JET

  • Customized scripts within the Deployment Template environment

    Hello,
    In the endeca documentation I see that "The sample scripts provided with the Deployment Template control the Endeca operational tasks through the EAC. You can use these scripts, or create custom scripts based on them. The scripts typically run such processes as routine baseline and partial updates. You can also add specific scripts that run before the Dgraph is stopped or after it is started."
    I would like to call a .bat before the DGraph is stopped or after it is started, but I can't find where.
    I think it's in the AppConfig.xml file, right? Could you give me an example?
    Thanks,
    Stephane

    1st Declare your action. Here is a sample that manually calls the set data ready flag...
    <shell id="SetDataReadyFlag" host-id="ITL_Local" >
    <command>${ENDECA_PROJECT_DIR}\control\set_baseline_data_ready_flag.bat</command>
    </shell>
    then in your custom tasks (or even the tasks that are part of the deploy template), you can call it....
    <script id="BaselineBuildDataFiles">
         <bean-shell-script>
         <![CDATA[
             // Get data
                // Verify Data
                // Set endeca data ready flag
             SetDataReadyFlag.run();
         ]]>
         </bean-shell-script>
    </script>
    The only thing I don't think you can do is get a response from the external call that you make. In that case I usually have my .bat, .exe, etc Write out a result file and then I read and parse the results from that.
    Hope this helps

  • How to use a custom script in a batch process?

    I was recently told that I can Photomerge, crop and save 2 separate folders of images to a 3rd folder in a batch process if I created a custom Javascript.  Are there any examples of how to integrate a custom script as an action in a batch process?

    if you recieve an image from mms you can save the object to gallery and then select it as wallpaper
    If  i have helped at all a click on the white star below would be nice thanks.
    Now using the Lumia 1520

Maybe you are looking for