svrmgrl question

svrmgrl question

Post by Scott Weine » Sun, 04 Mar 2001 01:27:42



I want to execute a sql script: Test.sql using svrmgrl.

In the Test.sql there are some values that I would like ot have passed
in as paramters.

For instance:
SELECT * FROM TABLE_NAME

WHat syntax do I use to pass TABLE_NAME in as a call to svrmgrl?

Note I am doing this as a batch process so it has to be a single command
line.

Thanks!

 
 
 

svrmgrl question

Post by Kevin Bran » Sun, 04 Mar 2001 03:20:04


using a shell wrapper ( unix or MKS Toolkit in windows ), construct the sql
statement and feed it to svrmgrl via a HERE document.

:
#
# Shell script start
CONNECT=scott/tiger
TABLE_NAME=$1
SQLSTMT="select * from $TABLE_NAME"
TNS_SERVICE=""

# Assuming your Oracle Environment is set:
$ORACLE_HOME/bin/svrmgrl <<EOT
    connect ${CONNECT}${TNS_SERVICE};
    ${SQLSTMT};
EOT

# Shell script end

If script name is "runit" and is executable, callit like this...
    runit <table_name>

That is minimal and you probably should start using SQL*PLUS, but it's a
good starting point.

-Kevin


Quote:> I want to execute a sql script: Test.sql using svrmgrl.

> In the Test.sql there are some values that I would like ot have passed
> in as paramters.

> For instance:
> SELECT * FROM TABLE_NAME

> WHat syntax do I use to pass TABLE_NAME in as a call to svrmgrl?

> Note I am doing this as a batch process so it has to be a single command
> line.

> Thanks!


 
 
 

svrmgrl question

Post by Scott Weine » Sun, 04 Mar 2001 04:31:39


Thanks!

- Scott


> using a shell wrapper ( unix or MKS Toolkit in windows ), construct the sql
> statement and feed it to svrmgrl via a HERE document.

> :
> #
> # Shell script start
> CONNECT=scott/tiger
> TABLE_NAME=$1
> SQLSTMT="select * from $TABLE_NAME"
> TNS_SERVICE=""

> # Assuming your Oracle Environment is set:
> $ORACLE_HOME/bin/svrmgrl <<EOT
>     connect ${CONNECT}${TNS_SERVICE};
>     ${SQLSTMT};
> EOT

> # Shell script end

> If script name is "runit" and is executable, callit like this...
>     runit <table_name>

> That is minimal and you probably should start using SQL*PLUS, but it's a
> good starting point.

> -Kevin



> > I want to execute a sql script: Test.sql using svrmgrl.

> > In the Test.sql there are some values that I would like ot have passed
> > in as paramters.

> > For instance:
> > SELECT * FROM TABLE_NAME

> > WHat syntax do I use to pass TABLE_NAME in as a call to svrmgrl?

> > Note I am doing this as a batch process so it has to be a single command
> > line.

> > Thanks!