Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Unable to extract tablespace ddl using db2look in shell script

$
0
0
Hi,

I am using this shell script

#!/bin/bash
dbname=$1
schema=$2
table=$3
tbspace=EMP_201305
datatbsmon=201305
newmon=201306
db2look -d $dbname -l -z $schema - t $table|grep -ip $tbspace|sed 's/'$datatbsmon'/'$newmon'/' > tbs.ddl

(the tablespace names are like xxxxxx_201305 where 201305 denotes year and month)

after i execute this shell script (using sh script.sh sampledb EMPLOYEE EMP_DATA),...... tbs.ddl is empty file and it shows nothing.

But when I execute the below command in command prompt,

db2look -d sampledb -l -z Employee -t EMP_DATA|grep -ip EMP_201305|sed 's/201305/201306/g' > tbs.ddl

tbs.ddl has the ddl for the tablespace EMP_201306.

Please help me resolve this issue as i need to create the new tablespace based on the naming convention of the previous tablespace and I need to do it using shell script.

Thanks,
Rupesh.

Viewing all articles
Browse latest Browse all 13329

Trending Articles