Sponsored Content
Top Forums Shell Programming and Scripting Scripted change of Oracle password on expiry Post 302531613 by gr8_usk on Friday 17th of June 2011 09:38:01 AM
Old 06-17-2011
Hi All,

Here is below what I am trying,
Code:
Code:
#!/bin/shset -xORACLE_HOME="/optware/oracle/9.2.0.2_64"SQLPLUS="${ORACLE_HOME}/bin/sqlplus"PASS="xyz"PATH=$ORACLE_HOME/bin:$PATHLD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:$LD_LIBRARY_PATHexport ORACLE_HOME PATH LD_LIBRARY_PATH ENVfor HOST in `cat ora_srv_list.txt`do$SQLPLUS -S -L user/abc@${HOST} << EOD_ORA $PASS $PASS exit EOD_ORA done
Below is the output which I am getting,



Code:
ORACLE_HOME=/optware/oracle/9.2.0.2_64SQLPLUS=/optware/oracle/9.2.0.2_64/bin/sqlplusPASS=xyzPATH=/optware/oracle/9.2.0.2_64/bin:+ export ORACLE_HOME PATH LD_LIBRARY_PATH ENV cat ora_srv_list.txt + /optware/oracle/9.2.0.2_64/bin/sqlplus -S -L user/abc@oradb catxyzxyzquitERROR:ORA-28001: the password has expiredChanging password for userSP2-0650: New passwords do not matchPassword unchangedSP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus

Seems this is getting messed up up because it is asking twice to enter password.

Pelase advice how do I fix this.

Regards,
Uday


Code:
#!/bin/sh
set -x
ORACLE_HOME="/optware/oracle/9.2.0.2_64"
SQLPLUS="${ORACLE_HOME}/bin/sqlplus"
PASS="xyz"

PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:$LD_LIBRARY_PATH
export ORACLE_HOME PATH LD_LIBRARY_PATH ENV
for HOST in `cat ora_srv_list.txt`
do
$SQLPLUS -S -L user/abc@${HOST} << EOD_ORA 
$PASS 
$PASS 
exit 
EOD_ORA 
done

Code:
ORACLE_HOME=/optware/oracle/9.2.0.2_64
SQLPLUS=/optware/oracle/9.2.0.2_64/bin/sqlplus
PASS=xyz
PATH=/optware/oracle/9.2.0.2_64/bin:
+ export ORACLE_HOME PATH LD_LIBRARY_PATH ENV cat ora_srv_list.txt 
+ /optware/oracle/9.2.0.2_64/bin/sqlplus -S -L user/abc@oradb cat
xyz
xyz
quit
ERROR:
ORA-28001: the password has expired

Changing password for user

SP2-0650: New passwords do not match
Password unchanged
SP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

password expiry

Hi, under SUN Unix, in which file the expiry date of a user password is indicated ? Many thanks. (2 Replies)
Discussion started by: big123456
2 Replies

2. Solaris

Notification of password expiry.

Hi, Is there any way of sending an email to a number of users indicating that the passwords of user accounts will expire? Currently we have a test server with a number of oracle test accounts on it. Each of these accounts correspond to an instance of Oracle on the server. These... (2 Replies)
Discussion started by: sparcman
2 Replies

3. Solaris

Notification of password expiry.

Hi, Is there any way of sending an email to a number of users indicating that the passwords of user accounts will expire? Currently we have a test server with a number of oracle test accounts on it. Each of these accounts correspond to an instance of Oracle on the server. These... (2 Replies)
Discussion started by: sparcman
2 Replies

4. Solaris

SSH Password-less login fails on password expiry.

Hi Gurus I have a few Sol 5.9 servers and i have enabled password less authentication between them for my user ID. Often i have found that when my password has expired,the login fails. Resetting my password reenables the keys. Do i need to do something to avoid this scenario or is this... (2 Replies)
Discussion started by: Renjesh
2 Replies

5. Shell Programming and Scripting

password expiry notification

Hi, Could someone please let me know how to write script for passwd expiry notification on salaries boxes. Regards Dnyan (1 Reply)
Discussion started by: dnyan
1 Replies

6. Solaris

disable password expiry

Hi How do i disable password expiration on ldap? It runs on Solaris 10 machine. Thanks in advance. (3 Replies)
Discussion started by: hrist
3 Replies

7. Shell Programming and Scripting

Password expiry report

Hi All, I want to write a script that will send the alert when linux server password expiry for user 'x' is less than 12 days. I have written the below script but this is not working for expiry date 04 july script;- P_EXPIRY_DATE=`chage -l msdp| grep 'Password expires' | awk ' {... (2 Replies)
Discussion started by: abhigrkist
2 Replies

8. Shell Programming and Scripting

Password Expiry while accessing Oracle table

Hi All, I am not able to access an oracle table even if the table is present. After initial analysis, found that there is a password warning for the specified oracle user. Can you please help me in ignoring the password expiry and access the oracle table ? However, the log file does not store the... (4 Replies)
Discussion started by: tapan8984
4 Replies

9. Shell Programming and Scripting

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 ... (2 Replies)
Discussion started by: navsan420
2 Replies

10. UNIX for Beginners Questions & Answers

Change - Password expiry Reset (Boot)

I have been searching the web for the answer to this question but without joy. Hopefully, someone here can point me in the right direction... We have a number of application OS accounts which require to be set with password non-expiry via the chage command, such as for example... chage -M 0... (7 Replies)
Discussion started by: ru4n1
7 Replies
CHSH(1) 							   User Commands							   CHSH(1)

NAME
chsh - change login shell SYNOPSIS
chsh [options] [LOGIN] DESCRIPTION
The chsh command changes the user login shell. This determines the name of the user's initial login command. A normal user may only change the login shell for her own account; the superuser may change the login shell for any account. OPTIONS
The options which apply to the chsh command are: -h, --help Display help message and exit. -R, --root CHROOT_DIR Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory. -s, --shell SHELL The name of the user's new login shell. Setting this field to blank causes the system to select the default login shell. If the -s option is not selected, chsh operates in an interactive fashion, prompting the user with the current login shell. Enter the new value to change the shell, or leave the line blank to use the current one. The current shell is displayed between a pair of [ ] marks. NOTE
The only restriction placed on the login shell is that the command name must be listed in /etc/shells, unless the invoker is the superuser, and then any value may be added. An account with a restricted login shell may not change her login shell. For this reason, placing /bin/rsh in /etc/shells is discouraged since accidentally changing to a restricted shell would prevent the user from ever changing her login shell back to its original value. FILES
/etc/passwd User account information. /etc/shells List of valid login shells. /etc/login.defs Shadow password suite configuration. SEE ALSO
chfn(1), login.defs(5), passwd(5). shadow-utils 4.5 01/25/2018 CHSH(1)
All times are GMT -4. The time now is 07:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy