DB2

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesDB2

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old May 11th, 2013, 12:48 PM
333rupesh 333rupesh is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: May 2013
Posts: 1 333rupesh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 37 sec
Reputation Power: 0
Unable to extract tablespace ddl using db2look in shell script

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.

Reply With Quote
  #2  
Old October 10th, 2013, 03:00 AM
JYGallien JYGallien is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Oct 2013
Posts: 1 JYGallien User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 25 sec
Reputation Power: 0
Quote:
Originally Posted by 333rupesh
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.

=====================
Just try to add option -e in your command, it should help
JYGa.

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesDB2 > Unable to extract tablespace ddl using db2look in shell script


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap