Source and Target count checking


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Source and Target count checking
# 1  
Old 04-02-2008
Bug Source and Target count checking

Hi

My source database is seibel and the target is oracle. I need to check the count for source query and target query. if it is equal then i need to send and success mail to an email id. If it is not equal need to send an failure mail to an email id.

pl let me know about the script in ksh.

Thanks
Babu

Last edited by ksmbabu; 04-02-2008 at 06:34 AM.. Reason: ksh missed
# 2  
Old 04-02-2008
Question Do you have any part of this written?

In rough terms...

scnt=$(execute command to learn source count)
tcnt=$(execute command to learn target count)

if [ $scnt -eq $tcnt ]
then
mailx -s "files match" good@myco.com
else
mailx -s "files do not match" bad@myco.com
fi
# 3  
Old 04-03-2008
Thanks Joeyg.

Select count(*) Tbl -- Src table

count(*)
---------
10

select count(*) from tbl --target table

count(*)
---------
10

i write the src and tgt out put to src_count.out and tgt_count.out

#!/bin/ksh

SUBJECT=`echo "COUNT MATCHING"`
SUBJECT1=`echo "COUNT NOT MATCHING"`
RECIPIENT=abc@abc.com
cd /babu
src_cnt=`cat src_count.out | tail -1`
tgt_cnt=`cat tgt_count.out | tail -1`

if [ $src_cnt -eq $tgt_cnt ]
then
echo "Source Count $src_cnt \nTarget Count $tgt_cnt" | mailx -s "$SUBJECT" $RECIPIENT
exit 1
else
echo "Source Count $src_cnt \nTarget Count $tgt_cnt" | mailx -s "$SUBJECT1" $RECIPIENT
exit 0
fi

The above code works fine..

One more points i need to have.... As i told my source is seibel and Target is oracle
how i will connect to the database through shell script..

As of now i just created two files /path/src_count.out and /path/tgt_count.out and put the count as
count(*)
--------
10

for target
count(*)
-------
10
and save the two files and processed the output.

But pl let me know how to connect to DB connect string thro shell script

Thanks
Babu
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Move multiple files 4rm Source to different target folders based on a series num in the file content

Dear Experts my scenario is as follows... I have one source folder "Source" and 2 target folders "Target_123456" & "Target_789101". I have 2 series of files. 123456 series and 789101 series. Each series has got 3 types of fiels "Debit", "Refund", "Claims". All files are getting... (17 Replies)
Discussion started by: phani333
17 Replies

2. Shell Programming and Scripting

Error files count while coping files from source to destination locaton as well count success full

hi All, Any one answer my requirement. I have source location src_dir="/home/oracle/arun/IRMS-CM" My Target location dest_dir="/home/oracle/arun/LiveLink/IRMS-CM/$dc/$pc/$ct" my source text files check with below example.text file content $fn "\t" $dc "\t" $pc "\t" ... (3 Replies)
Discussion started by: sravanreddy
3 Replies

3. UNIX for Dummies Questions & Answers

How to count number files successfully copied from source to target location?

Hi Guys, how to count number of files successfully copied while coping files from source to destination path ex:10 files from source to target location copying if 8 files copied successfully then echo successfully copied=8 failure=2 files if two files get error to coping files... (2 Replies)
Discussion started by: sravanreddy
2 Replies

4. Post Here to Contact Site Administrators and Moderators

How to count successfully copy files source to target location with check directory in Linux?

Hi guys...please any one help me .... how to copy files from source to target location if 5 files copied successfully out of 10 files then implement success=10 and if remaining 5 files not copied successfully then count error=5 how to implement this condition with in loop i need code linux... (0 Replies)
Discussion started by: sravanreddy
0 Replies

5. Shell Programming and Scripting

Checking data with source

I can derive a group from 2 sources Group Table Derived Source1 Source2 BAC GA1 TR HGT FG1 RF2 If a variable between both sources match in the value (col3) then the variable in the derived must match the same value. Group Variable Value GA1 V1 AA TR V1 AA then we know Group... (3 Replies)
Discussion started by: abh.kumar
3 Replies

6. Shell Programming and Scripting

Reconcilations script between Source and Target

Hi, I am new to DB2 and in need of urgent help. Here we have about 100 queries (SQL) that have been manually executed to retrieve totals from different tables and post it to Excel spreadsheet. Is there any way I can create a shell script as a wrapper and execute these queries and create a... (5 Replies)
Discussion started by: bhaskar v
5 Replies

7. UNIX for Advanced & Expert Users

sudo needs to source target user's .shrc

I'm configuring a sudo Runas_Alias in the sudoers file on a hp-ux 11.31 system. The goal is to allow some hp-ux accounts to sudo to a service account and run commands as that user. Here's the related sudoers entries: User_Alias DMSTAFF = %dmstaff Runas_Alias DMALIAS = dmadmin DMSTAFF ... (2 Replies)
Discussion started by: mp5802
2 Replies

8. Shell Programming and Scripting

Shell script to transfer the files from source to target server.

I need to write a shell script to transfer the files every hour from source - target server. The cron job should be running every hour and shouldn't copy already copied files to the remote server ? I was able to write intial script but not able to get the logic for (in the next run it should... (12 Replies)
Discussion started by: radhirk
12 Replies

9. UNIX for Dummies Questions & Answers

vi, c/source/target g?

hi in vi, i have a file and i wanted to replace all wnix to unix. is the below correct. c/wnix/unix g... i have tried , and the above is not right... help? (7 Replies)
Discussion started by: yls177
7 Replies
Login or Register to Ask a Question