Recently we were looking for common components that might indicate why some of our tests failed. One of the sysadmins at our Sunnyvale lab came up with a quick script which did the job. He used ‘uniq -c’ to great effect. In this example I look in my iTunes directory structyre...
Read more »
Posts Tagged ‘ Scripts ’
Counting in unix with ‘uniq-c’. Or how many of something does this thing have?
Sorting TPC-H lineitem table.
Sometimes it is useful to sort the lineitem table, in the order that Query-6 will read the data back.
Query-6 looks like so :-
set timing on;
select
sum(l_extendedprice * l_discount) as revenue
from
lineitem
where
l_shipdate >= to_date( '1995-01-01', 'YYYY-MM-DD')
and l_shipdate < add_months(to_date( '1995-01-01', 'YYYY-MM-DD'), 12)
and l_discount between 0.07 - 0.01 and 0.07 + 0.01
and l_quantity < 25;
exit;
and...
Read more »
Useful Oracle scripts
space.sql Display tablespace size and current utilisation.
SQL> @/u/little/mycode/sql/dba/space
%
% MaxPoss Max
Tablespace Name KBytes Used Free Used Largest Kbytes Used
------------------- ------------- ------------ ------------ ------ ------------ ------------ ------
m SYSTEM 1,048,576 ...
Read more »