Oracle DB user password change


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Oracle DB user password change
# 1  
Old 11-26-2014
Oracle DB user password change

Hi Experts,

I am trying to write a shell script to change DB user password.
Requirement:
login to multiple DBs as multiple users and change their respective passwords.
ex :users:T1,T2,T3
DB:X,Y,Z

scenario:
login as T1 to X,Y,Z
change password

login as T2 to X,Y,Z
change password

login as T3 to X,Y,Z
change password


I have tried something below.
I need to pass old and new password into DB .any idea how to achieve this.?

HTML Code:
for LINE in `cat config.data | grep -v "^#"`
do

        DB_NAME=`echo $LINE | cut -f1 -d":"`
        U_NAME=`echo $LINE  | cut -f2 -d":"`
        P_NAME=`echo $LINE  | cut -f3 -d":"`
        
sqlplus -L -S $U_NAME/$P_NAME@$DB_NAME << EOF

alter user acsdba identified by "newpass" replace oldpass; 

EOF

done

exit;
# 2  
Old 11-26-2014
What did the code you posted do? Any errors?

A minor code correction:

Code:
while IFS=":" read -r DB_NAME U_NAME P_NAME
do
...
done < config.data

# 3  
Old 11-26-2014
So are you connecting to the database with a privileged account? If not, you can only alter your own password, i.e. that of T1, T2 etc.

If you want to change a privileged account and you can't connect with that account, you might get away with becoming the OS user that owns the database (usually oracle) and doing:-
Code:
sqlplus <<-EOSQL
/ as sysdba
alter user acsdba identified by abcdefg ;
EOSQL


Can you clarify the objective a bit? I'm a little confused Smilie



Regards,
Robin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Not able to change user password

hi I am not able to change user password from root user. although it is saying updated successfully. but still I am not able to login direct to abc user. however I can login from root user by using su - abc # passwd abc Changing password for user abc. New password: BAD PASSWORD: it... (2 Replies)
Discussion started by: scriptor
2 Replies

2. Shell Programming and Scripting

How to change LPad user password?

Hi Gurus, I am lpad user in some of my server. I need to change password at certain period time. I am wondering what is the command to change the passwd. last time I asked my unix admin, they gave me a comand I chagned it. (I forgot to keep it in safe place, I lost it). this time when... (2 Replies)
Discussion started by: ken6503
2 Replies

3. HP-UX

Problem in Change Password for user

Dears, I have a problem When I tried to change password for user in HP unix it gives me this error any one can help to solve this ? bmcaddm@nmssrv05: /home/bmcaddm # passwd Changing password for bmcaddm Old password: New password: Re-enter new password: vxfs: msgcnt 810034 mesg 001: V-2-1:... (8 Replies)
Discussion started by: ahmednoaman
8 Replies

4. Shell Programming and Scripting

Scripted change of Oracle password on expiry

Hi All, I want to write a shell script to change the password on list of database servers, please guide me how do I achieve this. Please see below sample, how it is asking while manually changing the password, sqlplus test@oracle SQL*Plus: Release 9.2.0.2.0 - Production on Thu Jun 16... (4 Replies)
Discussion started by: gr8_usk
4 Replies

5. Solaris

Unable to change password for a user.

I am getting the following error message "passwd: User unknown: username" Permission denied error message when trying to change the password for that given user account. The user account is within the /etc/passwd file and I can also su to the account without any problems. This is sever is not... (11 Replies)
Discussion started by: eckmanb
11 Replies

6. Red Hat

how to force a user to change the password

RHEL 5 update 4. How to force a user to change the password at his next logon. Thanks in advance. (8 Replies)
Discussion started by: uxadmin007
8 Replies

7. UNIX for Dummies Questions & Answers

Unable To Change a User's Password

I am trying to change a user's Password, but I get the error "Password Cannot be changed; see account Administrator". Yet I am logged in as root. I also cannot access the Accounts Manager facility when SCO when using System Administration screen Error "Unable to get initial list of users" (2 Replies)
Discussion started by: Waitstejo
2 Replies

8. UNIX for Advanced & Expert Users

URGENT: Password modification for oracle user

Hi to all, Need help! For user sysoper on oracle, I want to know who and on which date/time the password has been modified? The platform is unix itself. Thanks (2 Replies)
Discussion started by: ashvik
2 Replies

9. Solaris

how can I change user name and password , of account ?

passwd only changes the password but i need to change the user name tnx (5 Replies)
Discussion started by: umen
5 Replies

10. UNIX for Dummies Questions & Answers

Can't change password for a user

All, I am unable to change a password for the user called : poller I am logged in as root When I do the following command passwd poller New Password: Permission denied Whe i enter the new password, it gives the above error. When i log in as poller and then execute the command, then... (2 Replies)
Discussion started by: rahulrathod
2 Replies
Login or Register to Ask a Question