If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > db2look comand

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-18-09, 11:43
unitec unitec is offline
Registered User
 
Join Date: May 2009
Posts: 8
db2look comand

Hi everyone

I hope someone can help me, I need to create a database with all tables and tablespace that currently has been created in other server I use:
db2 create db test
and from the other server extract the ddl using:
db2look -d DB -e -l -x -a > DB.ddl
and run it with db2 -tvf DB.ddl > DB.out
but there are two schemas with tables that I donīt have =( and are 254 tables

how I can get a complete ddl do create the database with all tables and schemas ?

Thanks for the help
Reply With Quote
  #2 (permalink)  
Old 05-18-09, 14:15
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
when you say you do not have 2 schemas, you mean it did not created them? db2look should have them.

Why not restore it from the backup?
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #3 (permalink)  
Old 05-18-09, 15:49
unitec unitec is offline
Registered User
 
Join Date: May 2009
Posts: 8
yes it seams that the db2look comand does not extract the ddl for those tables
which will be the corect commands to use since the this bd is on a production server and I need to create it identical in a development box ?
Reply With Quote
  #4 (permalink)  
Old 05-18-09, 17:24
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
are you sure that those are tables? I have never heard or seen db2look missing a table.

If you run "select type from syscat.tables where tabschema = '' and tabname = ''" what do you get in the type?
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #5 (permalink)  
Old 05-18-09, 17:54
unitec unitec is offline
Registered User
 
Join Date: May 2009
Posts: 8
I get:
V
V
V
312 record(s) selected
from these comand

db2 "select type from syscat.tables where tabschema = 'XBRIOBV'"

XBRIOBV is one of the schemas I dont have in the database
Reply With Quote
  #6 (permalink)  
Old 05-18-09, 22:49
arun-dba arun-dba is offline
Registered User
 
Join Date: Jan 2009
Posts: 8
hi

i hope this will help u..


please try db2look command with -z option and specify the required schema you want to create ddl for the schema.

db2look -d DB -e -l -x -z <schemanname> > DB.ddl
Reply With Quote
  #7 (permalink)  
Old 05-19-09, 09:23
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by unitec

XBRIOBV is one of the schemas I dont have in the database
First of all, could you please tell us how you determine that a schema is missing?
Reply With Quote
  #8 (permalink)  
Old 05-19-09, 09:54
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
Quote:
Originally Posted by unitec
I get:
V
V
V
312 record(s) selected
from these comand

db2 "select type from syscat.tables where tabschema = 'XBRIOBV'"

XBRIOBV is one of the schemas I dont have in the database
In case you haven't found out already V stands for a VIEW. Those are not tables. Even so they should have showed up in your output based on the command that you showed earlier.

The only way to remove views from the output is to use option "-noview" which does not look like you did.

Are you sure you are in the right database?

As Nick said, How do you know that you are not getting that schema?
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #9 (permalink)  
Old 05-19-09, 09:59
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
I just reread your first post. You are not seeing that schema after you try to run DDL from another server on your new server.

Have you looked in your DB.out file to see if there were errors while creating those views?
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #10 (permalink)  
Old 05-19-09, 18:07
unitec unitec is offline
Registered User
 
Join Date: May 2009
Posts: 8
hi

I use the comand

$ db2 connect to DIWSTDB
and then

$ db2 list tables for all
where I get
1923 record(s) selected
Whit
Table/View Schema Type Creation time
------------------------------- --------------- ----- --------------------------
ASSAY_FOUNDRY_BOOKINFO ASSAY V 2008-02-23-12

on the old box
What mean the Type "V" and "T" ?
Then I did the same on the new box where I want the database, I checked that output and I found that XBRIOBV is not in here =(

Regards!
Reply With Quote
  #11 (permalink)  
Old 05-20-09, 08:54
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
The type 'V' indicates a view. The schema in your listing shows as 'ASSAY'; why do you expect it to be 'XBRIOBV' in on the new system?

Last edited by n_i; 05-20-09 at 09:00.
Reply With Quote
  #12 (permalink)  
Old 05-20-09, 09:40
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
Go to your original DB and run this command:

Select substr(tabschema,1,20) as tabschema, type, count(*) from syscat.tables where tabschema = 'XBRIOBV' group by tabschema, type

then run the same command in your new DB and give us a complete output that shows exactly what command you ran and what you got back.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #13 (permalink)  
Old 05-20-09, 09:41
unitec unitec is offline
Registered User
 
Join Date: May 2009
Posts: 8
Yes that is just part of the ouput and 'XBRIOBV' is an schema that I do not have in the new system and the ouput from the ddl I run db2look -d DB -e -l -x -a > DB.ddl all is successful
Please help!
Reply With Quote
  #14 (permalink)  
Old 05-20-09, 16:09
unitec unitec is offline
Registered User
 
Join Date: May 2009
Posts: 8
Hi all
I checked the db2look -d DB -e -l -x -a > DB.ddl ouput and found that with it I get the ddl from views that I dont have so it seams that one of them were not complete susscessfully so I run the ddl again and works naw I have tose view in my database.

Best Regards,
=)
Reply With Quote
  #15 (permalink)  
Old 05-20-09, 16:38
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
That is why in post 9 I asked you to look at your OUT file. We could have been on a 5th drink already
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On