Connecting to multiple instances on the same server

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Connecting to multiple instances on the same server
# 1  
Old 05-23-2018
Connecting to multiple instances on the same server

I have a db server with two instances...trying to create an expect script that will scan both the listener and the alert log files and retrieve their sizes.
Issue we have is that the .profile is hard coded with one of the databases name and script is always pulling from the same instance (testdb1) instead of skipping to the next one (testdb2).
We need help on modding the script to pull from testdb1 then connect and put from testdb2 because the paths are different.

these are the settings below.

Code:
# command for gathering Listener Log
set v_listener_command "; echo '            Listener Log' | tr '\\n' ':'; echo '' | tr '\\n' ' ' ; lsnrctl status | grep Log | awk '{ print \$4 }' | sed 's/alert\\/log.xml/trace\\/listener.log/g' | tr '\\n' ' '; echo '-' | tr '\\n' ' ' ; du -sk `lsnrctl status | grep Log | awk '{ print \$4 }' | sed 's/alert\\/log.xml/trace\\/listener.log/g'` | awk '{ print \$1 }' | tr '\\n' ' ' ;  echo '(KB)'"

# add env setting command for db01 server TEST DB
set v_command_db01_testdb1 "export PATH=/oraclet/120/bin:/usr/bin:/usr/ccs/bin:/usr/vac/bin:/usr/sbin:/sbin:/usr/bin/X11:/bin:/usr/local/bin:/usr/lbin:/usr/ucb:PATH:.;export ORACLE_HOME=/oraclet/120;export ORACLE_SID=TESTDB1;"

# add env setting command for db01 server TEST DB2
 set v_command_db01_testdb2 "export PATH=/oraclet/120/bin:/usr/bin:/usr/ccs/bin:/usr/vac/bin:/usr/sbin:/sbin:/usr/bin/X11:/bin:/usr/local/bin:/usr/lbin:/usr/ucb:PATH:.;export ORACLE_HOME=RCDB:/oraclet/120;export ORACLE_SID=TESTDB2;"

I need help with this please...so far i cannot get the script to pull from the testdb2...the sid is always set to testbd1 and thus pulling the wrong files...their paths are different.




Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 05-23-2018 at 10:16 AM.. Reason: Added CODE tags.
# 2  
Old 05-24-2018
PROVIDING MORE CLARITY TO MY PREVIOUS POSTING...

I have a db server with two instances...trying to create an expect script that will scan both the listener and the alert log files and retrieve their sizes.
Issue we have is that the .profile is hard coded with one of the databases name and script is always pulling from the same instance (testdb1) instead of skipping to the next one (testdb2).
We need help on modding the script to pull from testdb1 then connect and put from testdb2 because the paths are different.

these are the settings below.

Code:
# command for gathering Listener Log
set v_listener_command "; echo '            Listener Log' | tr '\\n' ':'; echo '' | tr '\\n' ' ' ; lsnrctl status | grep Log | awk '{ print \$4 }' | sed 's/alert\\/log.xml/trace\\/listener.log/g' | tr '\\n' ' '; echo '-' | tr '\\n' ' ' ; du -sk `lsnrctl status | grep Log | awk '{ print \$4 }' | sed 's/alert\\/log.xml/trace\\/listener.log/g'` | awk '{ print \$1 }' | tr '\\n' ' ' ;  echo '(KB)'"

# add env setting command for db01 server TEST DB
set v_command_db01_testdb1 "export PATH=/oraclet/120/bin:/usr/bin:/usr/ccs/bin:/usr/vac/bin:/usr/sbin:/sbin:/usr/bin/X11:/bin:/usr/local/bin:/usr/lbin:/usr/ucb:PATH:.;export ORACLE_HOME=/oraclet/120;export ORACLE_SID=TESTDB1;"

# add env setting command for db01 server TEST DB2
set v_command_db01_testdb2 "export PATH=/oraclet/120/bin:/usr/bin:/usr/ccs/bin:/usr/vac/bin:/usr/sbin:/sbin:/usr/bin/X11:/bin:/usr/local/bin:/usr/lbin:/usr/ucb:PATH:.;export ORACLE_HOME=RCDB:/oraclet/120;export ORACLE_SID=TESTDB2;"

-----------------
spawn output.... the second run sets the sid to hm
----------------------------------------------------------------------------------------------------------------------------------
Code:
running ssh oraclet@db01...
spawn ssh oraclet@db01 export PATH=/oraclet/120/bin:/usr/bin:/usr/ccs/bin:/usr/vac/bin:/usr/sbin:/sbin:/usr/bin/X11:/bin:/usr/local/bin:/usr/lbin:/usr/ucb:PATH:.;export ORACLE_HOME=/oraclet/120;export ORACLE_SID=TESTDB1;echo hostname | tr '\n' ':' ;hostname; echo '            Alert Log' | tr '\n' ':'; echo '' | tr '\n' ' '  ;echo /oraclet/diag/rdbms/testdb1/TESTDB1/trace/alert_TESTDB1.log | tr '\n' ' '; echo '-' | tr '\n' ' ' ; du -sk /oraclet/diag/rdbms/testdb1/TESTDB1/trace/alert_TESTDB1.log | awk '{ print $1 }'| tr '\n' ' ' ;  echo '(KB)'; echo '            Listener Log' | tr '\n' ':'; echo '' | tr '\n' ' ' ; lsnrctl status | grep Log | awk '{ print $4 }' | sed 's/alert\/log.xml/trace\/listener.log/g' | tr '\n' ' '; echo '-' | tr '\n' ' ' ; du -sk `lsnrctl status | grep Log | awk '{ print $4 }' | sed 's/alert\/log.xml/trace\/listener.log/g'` | awk '{ print $1 }' | tr '\n' ' ' ;  echo '(KB)';echo ----------------------------------------------------------------------------------------------------------------------------------
Warning!! Authorized users only. All activity may be monitored and reported.
Password:
hostname:server1
            Alert Log: /oraclet/diag/rdbms/testdb1/TESTDB1/trace/alert_TESTDB1.log - 2 (KB)
            Listener Log: /oraclet/diag/tnslsnr/server1/listener/trace/listener.log - 153742 (KB)
----------------------------------------------------------------------------------------------------------------------------------
running ssh oraclet@server1...
spawn ssh oraclet@db01 export PATH=/oraclet/120/bin:/usr/bin:/usr/ccs/bin:/usr/vac/bin:/usr/sbin:/sbin:/usr/bin/X11:/bin:/usr/local/bin:/usr/lbin:/usr/ucb:PATH:.;export ORACLE_HOME=/oraclet/120;export ORACLE_SID=TESTDB1;echo hostname | tr '\n' ':' ;hostname; echo '            Alert Log' | tr '\n' ':'; echo '' | tr '\n' ' '  ;echo /oraclet/diag/rdbms/testdb2/TESTDB2/trace/alert_RCDB.log | tr '\n' ' '; echo '-' | tr '\n' ' ' ; du -sk /oraclet/diag/rdbms/testdb2/TESTDB2/trace/alert_TESDB2.log | awk '{ print $1 }'| tr '\n' ' ' ;  echo '(KB)'; echo '            Listener Log' | tr '\n' ':'; echo '' | tr '\n' ' ' ; lsnrctl status | grep Log | awk '{ print $4 }' | sed 's/alert\/log.xml/trace\/listener.log/g' | tr '\n' ' '; echo '-' | tr '\n' ' ' ; du -sk `lsnrctl status | grep Log | awk '{ print $4 }' | sed 's/alert\/log.xml/trace\/listener.log/g'` | awk '{ print $1 }' | tr '\n' ' ' ;  echo '(KB)';echo ----------------------------------------------------------------------------------------------------------------------------------
Warning!! Authorized users only. All activity may be monitored and reported.
Password:
hostname:hatstdb01
            Alert Log: /oraclet/diag/rdbms/rcdb/TESTDB2/trace/alert_TESTDB2.log - 770 (KB)
            Listener Log: /oraclet/diag/tnslsnr/hatstdb01/listener/trace/listener.log - 153742 (KB)

**********The output is suppose to read as follows...**************Because the path to the listener logs are different between TESTDB1 and TESTDB2
Code:
            Alert Log: /oraclet/diag/rdbms/rcdb/TESTDB2/trace/alert_TESTDB2.log - 770 (KB)
            Listener Log: /oraclet/diag/tnslsnr/hatstdb01/listener_TESTDB2/trace/listener.log - 153742 (KB)

---------- Post updated at 02:46 PM ---------- Previous update was at 12:50 PM ----------

I have a db server with two instances...trying to create an expect script that will scan both the listener and the alert log files and retrieve their sizes.
Issue we have is that the .profile is hard coded with one of the databases name and script is always pulling from the same instance (testdb1) instead of skipping to the next one (testdb2).
We need help on modding the script to pull from testdb1 then connect and put from testdb2 because the paths are different.

these are the settings below.

[# command for gathering Listener Log
set v_listener_command "; echo ' Listener Log' | tr '\\n' ':'; echo '' | tr '\\n' ' ' ; lsnrctl status | grep Log | awk '{ print \$4 }' | sed 's/alert\\/log.xml/trace\\/listener.log/g' | tr '\\n' ' '; echo '-' | tr '\\n' ' ' ; du -sk `lsnrctl status | grep Log | awk '{ print \$4 }' | sed 's/alert\\/log.xml/trace\\/listener.log/g'` | awk '{ print \$1 }' | tr '\\n' ' ' ; echo '(KB)'"]

[# add env setting command for db01 server TEST DB
set v_command_db01_testdb1 "export PATH=/oraclet/120/bin:/usr/bin:/usr/ccs/bin:/usr/vac/bin:/usr/sbin:/sbin:/usr/bin/X11:/bin:/usr/local/bin:/usr/lbin:/usr/ucb:PATH:.;export ORACLE_HOME=/oraclet/120;export ORACLE_SID=TESTDB1;"]

[# add env setting command for db01 server TEST DB2
set v_command_db01_testdb2 "export PATH=/oraclet/120/bin:/usr/bin:/usr/ccs/bin:/usr/vac/bin:/usr/sbin:/sbin:/usr/bin/X11:/bin:/usr/local/bin:/usr/lbin:/usr/ucb:PATH:.;export ORACLE_HOME=RCDB:/oraclet/120;export ORACLE_SID=TESTDB2;"]

-----------------
spawn output.... the second run sets the sid to hm
----------------------------------------------------------------------------------------------------------------------------------
[running ssh oraclet@db01...
spawn ssh oraclet@db01 export PATH=/oraclet/120/bin:/usr/bin:/usr/ccs/bin:/usr/vac/bin:/usr/sbin:/sbin:/usr/bin/X11:/bin:/usr/local/bin:/usr/lbin:/usr/ucb:PATH:.;export ORACLE_HOME=/oraclet/120;export ORACLE_SID=TESTDB1;echo hostname | tr '\n' ':' ;hostname; echo ' Alert Log' | tr '\n' ':'; echo '' | tr '\n' ' ' ;echo /oraclet/diag/rdbms/testdb1/TESTDB1/trace/alert_TESTDB1.log | tr '\n' ' '; echo '-' | tr '\n' ' ' ; du -sk /oraclet/diag/rdbms/testdb1/TESTDB1/trace/alert_TESTDB1.log | awk '{ print $1 }'| tr '\n' ' ' ; echo '(KB)'; echo ' Listener Log' | tr '\n' ':'; echo '' | tr '\n' ' ' ; lsnrctl status | grep Log | awk '{ print $4 }' | sed 's/alert\/log.xml/trace\/listener.log/g' | tr '\n' ' '; echo '-' | tr '\n' ' ' ; du -sk `lsnrctl status | grep Log | awk '{ print $4 }' | sed 's/alert\/log.xml/trace\/listener.log/g'` | awk '{ print $1 }' | tr '\n' ' ' ; echo '(KB)';echo] ----------------------------------------------------------------------------------------------------------------------------------
[Warning!! Authorized users only. All activity may be monitored and reported.
Password:
hostname:server1
Alert Log: /oraclet/diag/rdbms/testdb1/TESTDB1/trace/alert_TESTDB1.log - 2 (KB)
Listener Log: /oraclet/diag/tnslsnr/server1/listener/trace/listener.log - 153742 (KB)]
----------------------------------------------------------------------------------------------------------------------------------
[running ssh oraclet@server1...
spawn ssh oraclet@db01 export PATH=/oraclet/120/bin:/usr/bin:/usr/ccs/bin:/usr/vac/bin:/usr/sbin:/sbin:/usr/bin/X11:/bin:/usr/local/bin:/usr/lbin:/usr/ucb:PATH:.;export ORACLE_HOME=/oraclet/120;export ORACLE_SID=TESTDB1;echo hostname | tr '\n' ':' ;hostname; echo ' Alert Log' | tr '\n' ':'; echo '' | tr '\n' ' ' ;echo /oraclet/diag/rdbms/testdb2/TESTDB2/trace/alert_RCDB.log | tr '\n' ' '; echo '-' | tr '\n' ' ' ; du -sk /oraclet/diag/rdbms/testdb2/TESTDB2/trace/alert_TESDB2.log | awk '{ print $1 }'| tr '\n' ' ' ; echo '(KB)'; echo ' Listener Log' | tr '\n' ':'; echo '' | tr '\n' ' ' ; lsnrctl status | grep Log | awk '{ print $4 }' | sed 's/alert\/log.xml/trace\/listener.log/g' | tr '\n' ' '; echo '-' | tr '\n' ' ' ; du -sk `lsnrctl status | grep Log | awk '{ print $4 }' | sed 's/alert\/log.xml/trace\/listener.log/g'` | awk '{ print $1 }' | tr '\n' ' ' ; echo '(KB)';echo] ----------------------------------------------------------------------------------------------------------------------------------
[Warning!! Authorized users only. All activity may be monitored and reported.
Password:
hostname:hatstdb01
Alert Log: /oraclet/diag/rdbms/rcdb/TESTDB2/trace/alert_TESTDB2.log - 770 (KB)
Listener Log: /oraclet/diag/tnslsnr/hatstdb01/listener/trace/listener.log - 153742 (KB)]

**********this is suppose to read as follows...**************Because the path to the listener logs are different between TESTDB1 and TESTDB2]

[ Alert Log: /oraclet/diag/rdbms/rcdb/TESTDB2/trace/alert_TESTDB2.log - 770 (KB)
Listener Log: /oraclet/diag/tnslsnr/hatstdb01/listener_TESTDB2/trace/listener.log - 153742 (KB)

Last edited by Corona688; 05-24-2018 at 04:22 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Multiple instances of pthread

Suppose I declare pthread_t clear_thread; and then pthread_create(&clear_thread, &detach, clear_message, this); the thread is supposed to go away, perform the service it is intended to procide, and then kill itself. A little while later, I require this service again, so I say ... (2 Replies)
Discussion started by: clerew
2 Replies

2. Programming

Control multiple program instances - open multiple files problem

Hello. This shouldn't be an unusual problem, but I cannot find anything about it at google or at other search machine. So, I've made an application using C++ and QtCreator. I 've made a new mime type for application's project files. My system (ubuntu 10.10), when I right click a file and I... (3 Replies)
Discussion started by: hakermania
3 Replies

3. Shell Programming and Scripting

Connecting to multiple unix server from unix server using shell script

Hi Gurus, I'm a unix newbie and I would like to connect to multiple unix servers from unix server using shell script i.e from server a to server b,c,d etc. I want to copy the files from unix server a to server b, c, d. I can access staright using ssh without the need to have password and user... (5 Replies)
Discussion started by: sexyTrojan
5 Replies

4. Shell Programming and Scripting

Grep with multiple instances of same pattern

Hi, This is my text file I'm trying to Grep. Apple Location Greenland Rdsds dsds fdfd ddsads http Received Return Immediately Received End My Grep command: grep only--matching 'Location.*Received' e. Because the keyword Received appears twice, the Grep command will stop at the last... (0 Replies)
Discussion started by: spywarebox
0 Replies

5. Shell Programming and Scripting

Checking for multiple instances of a process

Hi I have a scenario where i need to check multiple instances of a running shell script (abc.sh) . How can I find from inside a running shell script whether any other instance of the same script is running or not? If any other instance of same shell script is running I need to exit from... (4 Replies)
Discussion started by: raghu.amilineni
4 Replies

6. Shell Programming and Scripting

Multiple instances of a job.

Could you please let me know how to create/make a multiple instances of a job/process in ksh(shell scripting). i.e., at present the parent script is calling another child/dependent script for only once. What we want is, the parent script itself has to execute multiple times, and in each one it... (1 Reply)
Discussion started by: Gangegowda
1 Replies

7. AIX

multiple instances of same vg on same AIX machine

hi, i am new to AIX and to this forum as well. Can you please help me out with following issue/requirement 1) I have one physical volume (pv1) (a scsi disk). (pv1) on 1st AIX machine. I have a single volume group on it(vg1). 2)I removed it from the 1st AIX machine and exported to the 2nd... (1 Reply)
Discussion started by: navadeep
1 Replies

8. Shell Programming and Scripting

detecting multiple instances

Hi Gurus I have a requirement like this. i use solaris OS.. if there are 2 instances of the same ksh file running in the directory, i need to kill the ksh file that started to run latest. suppose ragha.ksh starts running thru cron in abc/xyz directory now ragha.ksh started running by any... (3 Replies)
Discussion started by: ragha81
3 Replies

9. UNIX for Dummies Questions & Answers

Multiple file instances

I am capturing text based reports with a specific program, which works no problem. However, since I send report warehouse output as they are migrated from the database software, on occasion when two capture process' initiate simultaneously, the capture file locks up. Is there a way to setup (in... (1 Reply)
Discussion started by: gozer13
1 Replies

10. UNIX for Advanced & Expert Users

multiple instances of syslogd - is it possible?

I would like to start up multiple instances of syslog daemon. I am having a little difficulty. Is this at all possible? I have separate syslog.conf1.... syslog.conf5 files. I have linked the daemon to separate files syslogd1 ... syslogd5 I have arranged the rcd.2 start/stop scripts for... (9 Replies)
Discussion started by: Gary Dunn
9 Replies
Login or Register to Ask a Question