shell with SQL Script (Login authentication)
768495Apr 28 2010 — edited Apr 28 2010First 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 ^_^