| |
|
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.
|
 |

05-18-09, 11:43
|
|
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
|
|

05-18-09, 14:15
|
|
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
|
|

05-18-09, 15:49
|
|
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 ?
|
|

05-18-09, 17:24
|
|
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
|
|

05-18-09, 17:54
|
|
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
|
|

05-18-09, 22:49
|
|
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
|
|

05-19-09, 09:23
|
|
:-)
|
|
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?
|
|

05-19-09, 09:54
|
|
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
|
|

05-19-09, 09:59
|
|
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
|
|

05-19-09, 18:07
|
|
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!
|
|

05-20-09, 08:54
|
|
:-)
|
|
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.
|

05-20-09, 09:40
|
|
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
|
|

05-20-09, 09:41
|
|
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!
|
|

05-20-09, 16:09
|
|
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,
=)
|
|

05-20-09, 16:38
|
|
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
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|