Hi all,
I've written a little app to change the passwords for my multiple Oracle databases (SIDs) using SQL Plus. It works great right now but there is no validation. I would like to do some error checking/trapping/validation so I can roll it out to the rest of the users here who have a similar need.
Here is the script:
Code:
ACCEPT username char prompt 'Enter your username: '
ACCEPT currpw char prompt 'Enter current password: '
ACCEPT newpw char prompt 'Enter desired password: '
PROMPT 'Connecting to SID';
CONNECT &username/&currpw@SID;
PROMPT 'Changing password...';
ALTER user &username identified by &newpw;
Here is the error checking I would like to do:
1. Make sure the connection to the database is established before continuing with the script.
2. Make sure the user doesn't enter any special characters OR NULL for their current password, new password or username.
3. Make sure the script continues with the rest of the SIDs (there are about 25) if one fails, and displays a message that the change for that SID was unsuccessful.
Also, is there a way to reference the SID as a variable?
Any help is greatly appreciated...thanks!
Chris