Wednesday, November 9, 2022

Find Disk Write Performance; 

dd if=/dev/zero of=/tmp/output bs=16k count=10k  >> /root/diskwrite.txt  (runs in a crontab)

After a while;

cat diskwrite.txt |grep bytes|awk -F "," '{print $4}'|awk '{print $1}'|awk '{top=top+$NF; print top/NR}'


Tuesday, July 5, 2022

 Oracle Turkish Character Support;

echo "

set echo off

set verify off

set termout off

set trimout on

set heading off

set feedback off

set colsep ';'

set pagesize 0

set trimspool on

set headsep off

set linesize 5000

set serveroutput off

spool $tmpdir/${fname1}.txt

alter session set nls_language='TURKISH';

SELECT AIRPORT, a.ISTNO,${perbas}||'-'||${person},sum(VALUE) from TABLE1 a, TABLE2 where a.ICAO=b.ICAO and b.SENSOR_NAME IN('RAININST','PR_INS','RAIN_TDZ2','RAIN_TDZ1') and SENSOR_TIME between to_date('$perbas','YYYYMMDDHH24Mi') and to_date('$person','YYYYMMDDHH24Mi') group by AIRPORT,a.ISTNO order by 2 ;

spool off

exit " > $sql

sqlplus -S $ouser/$opass@$oserver @$sql

Change Spesific Columns Value According to a condition


This changes 4th columns value to "none" if it is zero.

awk 'BEGIN{FS=OFS=";"} $4 == "0" ;{$4 = "none"; } {print $0}' $filename 

Wednesday, April 6, 2022

Data Select From  SAP-IQ And Insert into Windows MS-SQL


#######################################################

function iq_select

{

echo "SELECT * ISTNO, YIL, AY, GUN, SAAT, DAKIKA, KAYIT_TURU, ORT_RUZGAR_YONU, ORT_RUZGAR_HIZI, MAKS_RUZGAR_YONU, MAKS_RUZGAR_HIZI, TOPLAM_YAGIS, SICAKLIK, NEM, convert(varchar,TARIH,20) FROM AA WHERE YIL=2022 and ay>1 and ISTNO between 17100 and 17102 " > $sql

 echo "go" >>$sql

/usr/local/bin/bsqldb -U user -S dbserver -P password -i $sql -o aa.txt -t "|" -q

sed -i 's/NULL//g' aa.txt

}

#######################################################

function sql_load 

{

freebcp table1 in aa.txt -S Mssqlsrv -U user -P password -c -b 1000 -t '|'

}

#######################################################
iq_select
sql_load