need help with oracle repair script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting need help with oracle repair script
# 1  
Old 08-16-2004
need help with repair script

I have a problem. I am attempting to create a repair script for oracle that will read in a print file and perform a repair on an oracle database using the data in the print file. My restrictions are
1) each in list (items with-in parens) must be no more the 250 lines and the last item in the inlist must not end with a comma, but with a ');'.

Any help with this script would be appreciated.

-------------- Segment of print file --------------
T,10, 31,V, 460, 15,00,1,02,01,B,L,0,0 |
T,11, 29,V, 485, 15,00,1,02,01,B,L,0,0 |
T,12, 36,V, 510, 15,00,1,02,01,B,L,0,0 |
T,13, 21,V, 550, 130,00,1,02,01,B,L,0,0 |
}
{
B,10,N,1|
01,"08054KKAODM "|
02,"P08054KKAODM "|
--------------------------------------------------------

-----------Current Code-----------------
#!/bin/ksh
echo Enter the print number
read PFILE < /dev/tty
echo update po_ln$actn_hst > repair.sql
echo set rcv_labels='N' >> repair.sql
echo where PO_ACTN_TP_CD = 'MAN' >> repair.sql
echo AND RCV_LABELS='Y' >> repair.sql
echo AND po_cd in \( >> repair.sql
cat RLPU_PAR.$PFILE|grep '^01,"'|sort|uniq|cut -c 5-17|sed -e 's/ *$//g'|sed "s/$/',/g"|sed "s/^/'/g" >> repair.sql
----------------------------------------------

--------fragment of Repair.sql ---------------
more repair.sql
update po_ln
set rcv_labels=N
where PO_ACTN_TP_CD = MAN
AND RCV_LABELS=Y
AND po_cd in (
'02154C2EMXO',
'03044K8HKAS',
'0304FF117',
'04019916Y',
'04074KP8704',
'04079936Y',
'04079937Y',
'04079938Y',
-----------------------------------------------

Last edited by beilstwh; 08-16-2004 at 02:35 PM..
# 2  
Old 08-17-2004
The SQL syntax is cleaned up, and there is a COMMIT; at the end
so your data changes are saved.

It really does'nt matter if you use an in list or not. It works just as well with one line update statements. It's just a bigger .SQL file. IMO.

this is a start:

Code:
#!/bin/ksh

                    
echo "enter file number "
read PFILE < /dev/tty      
let tmp=""
for result in `grep '^01,"' RLPU_PAR.$PFILE | cut -c 5-17`
do      
        printf \
"update po_ln set rcv_labels='N' where PO_ACTN_TP_CD = 'MAN' AND RCV_LABELS='Y' AND po_cd ='%s';\n" \
       $result

done
echo "COMMIT;"
exit

Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Boot Loaders

Where to get windows 7 iso file of repair?

I need to make a bootable usb of windows 7 repair disc iso file so that I can use it in case my system doesn't boot up. On net I am getting complete windows 7 OS iso but I need only the repair disc for making bootable iso. I am not sure whether I used right word by using the word disc here... (3 Replies)
Discussion started by: ravisingh
3 Replies

2. AIX

AIX mirroring repair

Hello colleagues! One day I found that a LV was not mirrored properly. Some manipulations were realized so the mirroring became well. Please look jpg attached, may be it would be useful for somebody. (4 Replies)
Discussion started by: DaySky
4 Replies

3. Hardware

Repair HDD with approporiate partitioning

Hi gurus, this is non standard linux question but I thing linux could help with this :) I have HDD (Samsung) which contains bad sectors (or clusters/blocks - dont know exact terminology). I downloaded official software for diagnostic (bootable CD with free DOS and utility) - and I executed low... (3 Replies)
Discussion started by: wakatana
3 Replies

4. UNIX for Dummies Questions & Answers

How to repair DNS

I am using Mac OS X and my server keeps crashing every several hours or so. I have checked the log file at /var/log/system.log and the entries closest to the crash read Mar 15 22:27:23 server servermgrd: servermgr_dns: no name available via DNS for 192.168.84.21 Mar 15 22:27:23 server... (4 Replies)
Discussion started by: timgolding
4 Replies

5. Windows & DOS: Issues & Discussions

Windows XP recovery/repair mode

hello again all, assume I can not log in to the windows installation, (maybe) because of a system file corruption or failure.. however, I do log in to the system using the windows CD with R (repair) mode, that is the command line prompt. Is there a way in that command prompt to copy the files... (10 Replies)
Discussion started by: milhan
10 Replies

6. UNIX for Advanced & Expert Users

fsck command - what does it check/repair??

While rebooting one of the UNIX systems here at work, the boot-up process halted and a message appeared telling me that I had to run the fsck command. The command to the best of my knowledge went something like : fsck -F ufs /dev/rdsk/c0t0d0s0 Can someone give me a full list of this command... (4 Replies)
Discussion started by: Kanu77
4 Replies
Login or Register to Ask a Question