DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Tuesday, April 4, 2017

Steps for bulk password reset in database using shell script

Please find the below steps to reset the bulk password in a database using shell script.




The script is ready. Our work is simple going forward for bulk password reset.





oracle@database02:~$ pwd

/export/home/oracle







oracle@database02:~$ ls -rlth PWD_RESET.sh list.log

-rw-r--r--   1 oracle   dba           10 Feb  7 11:32 list.log

-rw-r--r--   1 oracle   dba          297 Feb  7 11:36 PWD_RESET.sh









Just give the username details in list.log and run like below in the required databases.





oracle@database02:~$ sh PWD_RESET.sh list.log






The password will be changed for the users which u have mentioned in list.log.







See the example below:

-----------------------------------

oracle@database02:~$ cat PWD_RESET.sh

#sample script

a=`cat $1`; export a

for owner in $a

do

sqlplus -s '/as sysdba' << EOF

conn / as sysdba


alter user "$owner" identified by "2017data" account unlock password expire;


exit;

EOF

echo "##############################$owner PWD IS CHANGED################################"
done




oracle@database02:~$ cat list.log

2537

2538










oracle@database02:~$ sh PWD_RESET.sh list.log




User altered.




##############################2537 PWD is CHANGED################################




User altered.




##############################2538 PWD is CHANGED################################






No comments: