LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-30-2004, 09:36 AM   #1
anirudh
Member
 
Registered: Aug 2004
Location: bangalore india
Posts: 50

Rep: Reputation: 15
Lightbulb 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.

Last edited by anirudh; 10-08-2004 at 06:58 AM.
 
Old 09-30-2004, 01:11 PM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
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
 
Old 10-01-2004, 07:19 AM   #3
anirudh
Member
 
Registered: Aug 2004
Location: bangalore india
Posts: 50

Original Poster
Rep: Reputation: 15
Exclamation in windows

hi there
i have a win 2000 runing 10g grid control i wanna use emctl config agent credentials emrep10.acme.comracle_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
 
Old 10-04-2004, 06:06 AM   #4
anirudh
Member
 
Registered: Aug 2004
Location: bangalore india
Posts: 50

Original Poster
Rep: Reputation: 15
Exclamation

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.comracle_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
 
Old 10-04-2004, 07:31 AM   #5
anirudh
Member
 
Registered: Aug 2004
Location: bangalore india
Posts: 50

Original Poster
Rep: Reputation: 15
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
 
Old 10-08-2004, 06:44 AM   #6
anirudh
Member
 
Registered: Aug 2004
Location: bangalore india
Posts: 50

Original Poster
Rep: Reputation: 15
Thumbs up

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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql: debian-sys-maint password changed by accident, possible to change it back? ldp Linux - Software 7 08-29-2014 04:57 AM
password changing bshearer *BSD 3 04-26-2005 10:13 AM
Is a Linux sys w/o any passwd's as secure as a microsoft windows sys w/no passwd? t3gah Linux - Security 4 04-22-2005 08:01 PM
Changing password ust Linux - Software 1 10-03-2003 04:18 AM
Attention to PostgreSQL / MySQL (DBA) leshka_uk Linux - Software 1 02-10-2003 12:48 PM


All times are GMT -5. The time now is 11:26 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration