Operating System - HP-UX
1756265 Members
2420 Online
108843 Solutions
New Discussion

shell script help needed.

 
SOLVED
Go to solution
Rajkumar_3
Regular Advisor

Re: shell script help needed.

Hi Kok,

Thank you for the information.
I have done some modifications in the scripts.Its working now.

#I used the following script:

echo "How many rows do you want to insert into the table ? "
read NROWS
NROWS=$((NROWS * 106))
NROWS=$((NROWS / 2 ))
export NROWS
echo $NROWS

I divided NROWS /2 because i assigned 2 tablespaces while creating that table which contains HASH PARTITIONED tablespaces.The output result should be divided into 2 tablespaces,I havent specified MB there.I removed the (MB) while creating a tablespace.

#The following is the tablespace scipt which i used.

CREATE TABLESPACE GATE_DATA_PARTITION
DATAFILE '/inventory/gate_data_partition.dbf' SIZE $NROWS
DEFAULT STORAGE (INITIAL 20K NEXT 20K MINEXTENTS 2 MAXEXTENTS 100 PCTINCREASE 1)
;

CREATE TABLESPACE GATE_DATA_PARTITION1
DATAFILE '/inventory/gate_data_partition1.dbf' SIZE $NROWS
DEFAULT STORAGE (INITIAL 20K NEXT 20K MINEXTENTS 2 MAXEXTENTS 100 PCTINCREASE 1)
;
##########

If i havent entered any values while it prompts its returning an error.
Is it possible to terminate the entire script if i wont enter any thing????

R
Oracle DBA
Steven Sim Kok Leong
Honored Contributor
Solution

Re: shell script help needed.

Hi,

Add an error checking condition.

=========================================
echo "How many rows that you want to insert into the table ? \c"
read total_size
if [ "$total_size" != "" ]
then
total_size=$(expr $total_size / 1048576)
echo $total_size
else
echo No values entered...exiting
fi
=========================================
Hope this helps. Regards.

Steven Sim Kok Leong