LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   changing sys and dba password (https://www.linuxquestions.org/questions/programming-9/changing-sys-and-dba-password-237079/)

anirudh 09-30-2004 09:36 AM

got the solution:changing sys and dba password
 
i have to automatically change the pasword of sys and dba in 100 servers with a command line script,i know their present password and ip address,i am using oracle database 10g how can i do this.

jim mcnamara 09-30-2004 01:11 PM

I don't know how your systems are configured, etc - but here is a skeleton script.

Code:

#!/bin/ksh
# parameter $1 = textfile
exsql () 
{                                         
 awk '{ if(NR == 1) {                               
        STR=sprintf("%s/%s",UI,PW)                 
        print STR                                   
        print "set pagesize 0;"                             
        }                                           
        print $0}' UI=$UID PW=$PSWD | sqlplus -s 
}
#ORACLE_HOME must point to the Oracle tree on the local box

# textfile record layout:  username passwd newpassword Oracle_nodename instance
# example                  SYS      FIDDLE  NEWS101    MYPROD          PROD
while read username passwd newpasswd nodename instance
do
    export ORACLE_SID=$instance
    export TWO_TASK=$nodename
    export UID=$username
    export PSWD=$passwd
    echo "
    PASSWORD
    $passwd
    $newpassword
    $newpassword
    exit" | exsql
   

done  < $1
exit


anirudh 10-01-2004 07:19 AM

in windows
 
hi there
i have a win 2000 runing 10g grid control i wanna use emctl config agent credentials emrep10.acme.com:oracle_database
in my script to change the password of different servers so that my repository of the passwords is updated in my control database. can you help me do this.
regards
anirudh

anirudh 10-04-2004 06:06 AM

i want to run the DOS command as a bat file through web control page

emctl config agent credentials %hostname:%instancename
this command works as follows in linux as
$PROMPT>./emctl config agent credentials emrep10.acme.com:oracle_database
Oracle Enterprise Manager 10g Release 10.1.0.2.0
Copyright (c) 2002, 2003 Oracle Corporation. All rights reserved.
Name = emrep10.us.oracle.com, Type = oracle_database
Want to change for "UserName" (y/n):n
Want to change for "password" (y/n):y
Enter the value for "password" :*******
EMD reload completed successfully

this command is in say d:/oracle/agent/bin directory windows2000

this has to run as a batch file and has to read the hostname and instancename from a file
(there are 100 host and instance name)
also the interactive part ie username and password has to be ('n','y') this has to be provided to the command when it ask for this from the file
also the new password has to be read from the file and feed to the command
and this has to be for all the host and instance name provided in the file
it has to run on windows

plz help
:confused:

anirudh 10-04-2004 07:31 AM

set path=D:\oracle\product\10.1.0\agent\bin
# parameter $1 = textfile

while read hostname instancename n y newpasswd
do
win32::Spawn (emctl config agent credentials, $hostname:$instancename,PID)

expect "Want to change for \"UserName\" (y/n):"

send "$n\r"

expect "Want to change for \"password\" (y/n):"

send "$y\r"

expect "Enter the value for \"password\" :"

send "$newpasswd\r"

interact

exit
could some one help me to get this to work on the windows system as perl or batch

anirudh 10-08-2004 06:44 AM

hi there
i found a solution to the problem
we could use the EM CLI (enterprise manager command line interpreter) it supports a verb modify_targets -credentials
also it can take in argfile as input to execute the commands as
>emcli argfile arg_file_name
arg_file contains
all the credentials like
modify_target -name=<taget_name1> -type=<target_type such as oracle_database,host etc> - credentials="<>"
modify_target -name=<taget_name2> -type=<target_type such as oracle_database,host etc> - credentials="<>"
etc
this arg file is a ascii file so we execute it through the command line inerpreter
as refered above
Thanx
Anirudh


All times are GMT -5. The time now is 02:32 PM.