Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

shell with SQL Script (Login authentication)

768495Apr 28 2010 — edited Apr 28 2010
First I hava shell script(create_ydb.sh), the content is :

#!/bin/sh
sqlplus /nolog @create_ydb.sql

Then the content of the create_ydb.sql:

set verify off
PROMPT specify a password for sys as parameter 1;
DEFINE sysPassword = &1

host /ORACLE_HOME_PATH/bin/orapwd file=/ORACLE_HOME_PATH/dbs/orapwYDB password=&&sysPassword force=y
@CreateDB.sql

Then the content of the CreateDB.sql:

connect "SYS"/"&&sysPassword" as SYSDBA
......
......
......

The first problem is , after the user input the password for sysPassword , he is not able to change it;
so I tried to move the "input password part" to the shell script, but I don't know how to pass the
value of sysPassword to the create_ydb.sql.

The second problem is , if the user input the wrong password, how can I know that in the CreateDB.sql
so that I can stop it to run and display the error message to the user.

I hope someone can help me out, thanks ^_^
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 26 2010
Added on Apr 28 2010
1 comment
1,223 views