linux_shell_skripting

Scripts for DB2

  • Load data in tables

#!/bin/bash
#This scripts inserts 10000 rows in tables received and received_passanger for testing purposes

db2 "connect to DB1"
for (( i = 1; i <= 10000; i++ ))
do
  db2 "insert into pdc.received(received_id,received_dt,inter_number,message_type) values ($i+2,(select current timestamp(8) from SYSIBM.SYSDUMMY1),(select SMALLINT(RAND() * 10000+1) from sysibm.sysdummy1),2)";
  db2 "insert into pdc.received_passenger(received_passenger_id,carrier_code,flight_number,received_id) values((select SMALLINT(RAND() * 10000+1) from sysibm.sysdummy1),(select SMALLINT(RAND() * 10000+1) from sysibm.sysdummy1),(select SMALLINT(RAND() * 10000+1) from sysibm.sysdummy1),$i+2)";
done

  • Edit the UDEV rules:


#!/bin/bash

cntData=1
cntFRA=1

for scsiID in `cat scsiIDs.txt`; do

if (("$cntData" <= "8")); then
echo "KERNEL==\"sd?1\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id -g -u -s %p\", RESULT==\"$scsiID\", NAME=\"/oradev/ora-data$cntData\", OWNER=\"oracle\", GROUP=\"dba\", MODE=\"0660\"" >> test.txt
fi
((cntData++))

if (("$cntData" > 9)); then
echo "KERNEL==\"sd?1\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id -g -u -s %p\", RESULT==\"$scsiID\", NAME=\"/oradev/ora-fra$cntFRA\", OWNER=\"oracle\", GROUP=\"dba\", MODE=\"0660\"" >> test.txt
((cntFRA++))
fi

done

  • linux_shell_skripting.txt
  • Last modified: 2019/10/18 20:04
  • by 127.0.0.1