Home » RDBMS Server » Server Utilities » Using Unix Env on svrmgrl mod
Using Unix Env on svrmgrl mod [message #70282] Sun, 19 May 2002 03:02 Go to next message
shlomit
Messages: 1
Registered: May 2002
Junior Member
hello
i wan't to create a script that knows how to create a database with a predefine shell variable !
i have created a script that run the command :
svrmgrl << end
connect internal
@create_new_DB.sql $ORACLE_SID $ORA_REDO
end
on the create_new_DB.sql script,i wrote :
create database "&1"
........
and every time i'm running this scripts it writes :
svrmgrl> create database "&1"
*
CREATE DATABASE failed
database name has illigal character "&"
how can i change the script so it will create the DB with the predefined variable ?
please help
shlomit
Re: Using Unix Env on svrmgrl mod [message #70295 is a reply to message #70282] Tue, 21 May 2002 06:26 Go to previous message
Grant
Messages: 578
Registered: January 2002
Senior Member
I do not beleive you can do it this way because neither sqlplus or svrmgrl knows unix environment variables once it is running. There are two ways that I know of that you can do this.

1. call it on one line from you unix script using sqlplus:
sqlplus internal @sqlscript.sql $ORACLE_SID $ORA_REDO
2. Make your unix shell script dynamically create the sql script. This will make your script considerably larger but will work:
echo "Start of SQL script create_new_DB.sql" > create_new_DB.sql
echo "svrmgrl << end" >> create_new_DB.sql
echo "connect internal" >> create_new_DB.sql
echo "create database $ORACLE_SID" >> create_new_DB.sql
.......

You would have to create the whole script on the fly. I am sure there are other ways but here are two. Note ">" on the first line and ">>" on the following lines. > creates and >> appends.
Previous Topic: can we use SQL PLUS (8.1) to connect to an access DB?
Next Topic: import problem
Goto Forum:
  


Current Time: Fri Apr 19 21:08:31 CDT 2024