shell script not connecting to primary from standby site


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shell script not connecting to primary from standby site
# 1  
Old 10-23-2008
shell script not connecting to primary from standby site

Hi All,

I am using below shell script using SQL*Plus to query the MAX(SEQUENCE#) from both databases V$LOG_HISTORY view.If the STANDBY appears to be falling behind by - 2, then alert mail should be sent...

How could I achieve it with improving the below script.

#!/usr/bin/ksh

v_standby=`sqlplus -s /nolog <<END
connect / as sysdba
select /*+ rule */ max(h.sequence#) logseq_on_standby
from v\$log_history h,
v\$parameter p
where h.thread# = to_number(decode(p.value,'0',1,p.value))
and p.name = 'thread';
EXIT;
END`

ssh xyz@hostname.domain
v_primary=`sqlplus -s /nolog <<END
connect / as sysdba
select /*+ rule */ max(h.sequence#) logseq_on_primary
from v\$log_history h,
v\$parameter p
where h.thread# = to_number(decode(p.value,'0',1,p.value))
and p.name = 'thread';
exit;
exit;

Thanks for your time!!

Regards,
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

connecting servers using shell script

Hi , I have three linux servers. I want to login from one server and check some status in the other server. How to connect other server from one server using shell script. Can anyone advice on this? Thanks, Chelladurai. (4 Replies)
Discussion started by: ckchelladurai
4 Replies

2. Solaris

ifconfig primary & standby purpose

I have two ethernet interfaces nge0 and nge1. An IP assigned on nge0 is 10.10.10.1/24 and on nge1 is 20.20.20.1/24. I want to make nge0 as primary interface. My question here is, 1. Being nge0 as primary interface, if I ping to an IP 20.20.20.5, what will happen? 2. If the answer for the... (4 Replies)
Discussion started by: nthiruvenkatam
4 Replies

3. Shell Programming and Scripting

d. Write a shell script to count the number of accounts which belong to particular primary

guys, I am new shelll scripting.. this a question on passt exam paper, I was trying to solve it , I can not. the question is as follow? a. Write a shell script to count the number of accounts which belong to particular primary group in a standard UNIX system which uses local... (1 Reply)
Discussion started by: gurmad
1 Replies

4. UNIX for Dummies Questions & Answers

shell script for connecting to a different user

Hi Gurus, I want to connect to a different user in unix from my terminal. I know the password of that user and username.when i am using "su username" it asks me for the password and entering the corresponding password ,it takes me to that.but i want to write a shell script in which i will be... (4 Replies)
Discussion started by: sanjay.login
4 Replies

5. Shell Programming and Scripting

Connecting to oracle database from shell script

Hi all, I am satyakiran , i am new to the forum. i never done shell scripts for connecting to the data base (oracle) and fetching the data from the database( thru sql select statements ) i want to know 1. how to connect to the data base(oracle) using shell script 2. how to retrieve data... (8 Replies)
Discussion started by: satyakiran
8 Replies

6. Shell Programming and Scripting

shell script for primary and standby DB archive log check

Hi All, OS:AIX 5.3 64 bits I would like the below script to send alert mail with the message - "Standby logs falling behind Primary" to xyz@yahoo.com Script ===== #!/usr/bin/ksh #----------------------------------------------------------------------------- # Use SQL*Plus to query... (1 Reply)
Discussion started by: a1_win
1 Replies

7. Shell Programming and Scripting

Shell script using ssh remains connected at primary site

Hi All, OS:AIX 5.3 L My shell script using ssh remains connected at primary site and ssh doesn't get disconnected.What should be typed and where in the shell script below to do it. Shell script ======== #!/usr/bin/ksh v_standby=`sqlplus -s /nolog <<END @standby.sql END` echo... (5 Replies)
Discussion started by: a1_win
5 Replies

8. AIX

hacmp 5.3 primary and standby?

Hi All, How do I determine if a hacmp 5.3 server is a primary or a standby? Thanks in advance. (2 Replies)
Discussion started by: itik
2 Replies

9. Shell Programming and Scripting

Connecting to sybase via shell script.

Hi All, I was able to connect to sybase in shell script and also able to run few sql queries, something like this, #!/usr/bin/ksh -x temp=`echo "select name from sysobjects where type = 'U'"` results=`isql -SDS_SERVER-UAdhocUser -Pha12 <<EOF set rowcount 6 $temp go EOF` line_count=0... (1 Reply)
Discussion started by: arvindcgi
1 Replies

10. UNIX for Advanced & Expert Users

Connecting DB in the Shell Script to do SQL Query

Any link or example to write shell script for the Connecting Oracle for Quering through SQL thanks in advance ... Cheers !! Mehul Doshi (3 Replies)
Discussion started by: mehuldoshi
3 Replies
Login or Register to Ask a Question
exit(1) 							   User Commands							   exit(1)

NAME
exit, return, goto - shell built-in functions to enable the execution of the shell to advance beyond its sequence of steps SYNOPSIS
sh exit [n] return [n] csh exit [ ( expr )] goto label ksh *exit [n] *return [n] DESCRIPTION
sh exit will cause the calling shell or shell script to exit with the exit status specified by n. If n is omitted the exit status is that of the last command executed (an EOF will also cause the shell to exit.) return causes a function to exit with the return value specified by n. If n is omitted, the return status is that of the last command exe- cuted. csh exit will cause the calling shell or shell script to exit, either with the value of the status variable or with the value specified by the expression expr. The goto built-in uses a specified label as a search string amongst commands. The shell rewinds its input as much as possible and searches for a line of the form label: possibly preceded by space or tab characters. Execution continues after the indicated line. It is an error to jump to a label that occurs between a while or for built-in command and its corresponding end. ksh exit will cause the calling shell or shell script to exit with the exit status specified by n. The value will be the least significant 8 bits of the specified status. If n is omitted then the exit status is that of the last command executed. When exit occurs when executing a trap, the last command refers to the command that executed before the trap was invoked. An end-of-file will also cause the shell to exit except for a shell which has the ignoreeof option (See set below) turned on. return causes a shell function or '.' script to return to the invoking script with the return status specified by n. The value will be the least significant 8 bits of the specified status. If n is omitted then the return status is that of the last command executed. If return is invoked while not in a function or a '.' script, then it is the same as an exit. On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari- able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not performed. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
break(1), csh(1), ksh(1), sh(1), attributes(5) SunOS 5.10 15 Apr 1994 exit(1)