Using Unix environment variables in login.sql [message #428721] |
Thu, 29 October 2009 11:36 |
hackett087
Messages: 5 Registered: October 2009 Location: Ireland
|
Junior Member |
|
|
I would like to be able use a Unix environment variable in the SQLPlus login.sql file.
For example:
I would like to include a line similar to the one below in my login.sql file
DEFINE TEST = $ORACLE_SID
When SQLPlus starts and runs the login.sql file, I would like it to have set TEST to be equal to the value of the ORALCE_SID Unix environment variable
How can this be achieved?
Thanks.
|
|
|
|
|
|
|
Re: Using Unix environment variables in login.sql [message #428732 is a reply to message #428731] |
Thu, 29 October 2009 12:24 |
hackett087
Messages: 5 Registered: October 2009 Location: Ireland
|
Junior Member |
|
|
I'm upgrading a product at the moment. The upgrade process involves running many SQL scripts and reviewing the output. The scripts have been constructed so that the output is spooled to a directory. The directory is specified in a symbol which is hardcoded in the login.sql.
As a number of people will be running the upgrades in parallel, I don't want them to overwrite each others output, so I was hoped to set the output in the login.sql and have it point to an environment variable which I can easily set.
I have been looking at using dbms_system.get_env but I can't figure how to use it in login.sql.
I could use a shell script to update the login.sql but I was hoping to find a way to do it directly via the login.sql
Thanks,
|
|
|
|
|
Re: Using Unix environment variables in login.sql [message #428743 is a reply to message #428735] |
Thu, 29 October 2009 15:18 |
hackett087
Messages: 5 Registered: October 2009 Location: Ireland
|
Junior Member |
|
|
As the users will be logging onto the Unix server that runs the different database instances, I had not made a hard and fast distinction between client and server.
In terms of $ORACLE_SID versus instance name, either would do. The users will all be logging into the Unix server under the same user account. They will be running scripts from the same directory. The only thing that will be different is the $ORACLE_HOME and $ORACLE_SID, so I was hoping to use one of these values to direct the spooled output to different folder.
|
|
|
|
|
|