Sponsored Content
Full Discussion: Doing a SQL rollup in unix
Top Forums Programming Doing a SQL rollup in unix Post 302646149 by guessingo on Thursday 24th of May 2012 02:31:57 PM
Old 05-24-2012
Doing a SQL rollup in unix

If anyone is familiar with Oracle, there is a way to trace a file. Then there is is a script called tkprof that will generate a report that includes a rollup of some values. The problem with this script is that it only does the rollup properly if the query is finished. So I need something quick and dirty that I can run while the query is running so I can get an idea of what part of the query is taking the longest.

There are ways to do this in the DB, but I want to try this.
Code:
 WAIT #10: nam='db file sequential read' ela= 12563 file#=1785 block#=1900856 blocks=1 obj#=378783 tim=5692604680960
 WAIT #10: nam='db file sequential read' ela= 12183 file#=1812 block#=57235 blocks=1 obj#=378760 tim=5692604693206
 WAIT #10: nam='db file sequential read' ela= 13177 file#=1785 block#=1914568 blocks=1 obj#=378783 tim=5692604707687
 WAIT #10: nam='db file sequential read' ela= 22778 file#=1759 block#=1849055 blocks=1 obj#=378760 tim=5692604730526
 WAIT #10: nam='db file sequential read' ela= 9205 file#=1812 block#=15570 blocks=1 obj#=378760 tim=5692604739987
 WAIT #10: nam='db file sequential read' ela= 483 file#=1812 block#=81772 blocks=1 obj#=378760 tim=5692604740550
 WAIT #10: nam='db file sequential read' ela= 293 file#=1812 block#=81646 blocks=1 obj#=378760 tim=5692604741094
 WAIT #10: nam='db file sequential read' ela= 372 file#=1825 block#=12076 blocks=1 obj#=378783 tim=5692604742348
 WAIT #10: nam='db file sequential read' ela= 10610 file#=1812 block#=122033 blocks=1 obj#=378760 tim=5692604753034
 WAIT #10: nam='db file sequential read' ela= 17977 file#=1812 block#=114700 blocks=1 obj#=378760 tim=5692604771284

I need to grep on WAIT

grep "WAIT" filename |

The awk is an issue. the nam= part can change. so a standard awk on spaces wont work.

basically I want to do this

for each obj#=<value>, I want to sum up the ela and tim fields. and I want to do a count of the total number of entries.

note that the tim= and ela= needs to be parsed out so I can some up the numbers.
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unix variables from sql / pl/sql

How do I dynamically assign the below output to unix shell variables so I can build a menu in a shell script? Example: var1 = 1 var2= SYSTEM var3 = 2 var4= UNDOTBS1 and so on, then in the shell script I can use the variables to build a menu. set serveroutput on declare... (2 Replies)
Discussion started by: djehres
2 Replies

2. UNIX for Dummies Questions & Answers

Execute PL/SQL function from Unix script (.sql file)

Hi guys, I am new on here, I have a function in oracle that returns a specific value: create or replace PACKAGE BODY "CTC_ASDGET_SCHED" AS FUNCTION FN_ASDSCHEDULE_GET RETURN VARCHAR2 AS BEGIN DECLARE ASDSchedule varchar2(6); ASDComplete... (1 Reply)
Discussion started by: reptile
1 Replies

3. Shell Programming and Scripting

How to use sql data file in unix csv file as input to an sql query from shell

Hi , I used the below script to get the sql data into csv file using unix scripting. I m getting the output into an output file but the output file is not displayed in a separe columns . #!/bin/ksh export FILE_PATH=/maav/home/xyz/abc/ rm $FILE_PATH/sample.csv sqlplus -s... (2 Replies)
Discussion started by: Nareshp
2 Replies

4. Shell Programming and Scripting

rollup and concat fields in a group

Hello, I have a file with two fields in the following format.. NewYork|Rob Boston|Mellisa NewYork|Kevin Boston|John Chicago|Mike Boston|Tom My output should be: NewYork|Rob,Kevin Boston|Mellisa,John,Tom Chicago|Mike Basically I need to rollup on column A and stringconcat column... (5 Replies)
Discussion started by: bperl
5 Replies

5. Shell Programming and Scripting

How can i run sql queries from UNIX shell script and retrieve data into text docs of UNIX?

Please share the doc asap as very urgently required. (1 Reply)
Discussion started by: 24ajay
1 Replies
SYSTEMD-NETWORKD-WAIT-ONLINE.SERVICE(8) 		     systemd-networkd.service			   SYSTEMD-NETWORKD-WAIT-ONLINE.SERVICE(8)

NAME
systemd-networkd-wait-online.service, systemd-networkd-wait-online - Wait for network to come online SYNOPSIS
systemd-networkd-wait-online.service /lib/systemd/systemd-networkd-wait-online DESCRIPTION
systemd-networkd-wait-online is a one-shot system service that waits for the network to be configured. By default, it will wait for all links it is aware of and which are managed by systemd-networkd.service(8) to be fully configured or failed, and for at least one link to gain a carrier. OPTIONS
The following options are understood: -i, --interface= Network interface to wait for before deciding if the system is online. This is useful when a system has several interfaces which will be configured, but a particular one is necessary to access some network resources. This option may be used more than once to wait for multiple network interfaces. When used, all other interfaces are ignored. --ignore= Network interfaces to be ignored when deciding if the system is online. By default, only the loopback interface is ignored. This option may be used more than once to ignore multiple network interfaces. --timeout= Fail the service if the network is not online by the time the timeout elapses. A timeout of 0 disables the timeout. Defaults to 120 seconds. SEE ALSO
systemd(1), systemd-networkd.service(8) systemd 237 SYSTEMD-NETWORKD-WAIT-ONLINE.SERVICE(8)
All times are GMT -4. The time now is 10:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy