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 > How to Create schema and execute DDLs

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-16-08, 19:13
sanandkannan sanandkannan is offline
Registered User
 
Join Date: Jan 2008
Posts: 4
How to Create schema and execute DDLs

Hello Everyone,

I am very new to DB2.

1) I have installed DB2 server Personal edition only in my system.

2) I have a set of DDLs in a file(app_ddl.txt size: 200 KB) that starts with

create schema XXXX
...
...
create table XXXX.YYYY(......)
...
create table XXXX.AAAA(......)
...
...
create view XXXX.ZZZZ..... (blah..blah..blah)

3) Now I need to have the above database schema in my system using the "app_ddl.txt".

Please help me providing the steps(right from start after installation) for the setting up the DB asap.

Thanks in Advance,

Anand
Reply With Quote
  #2 (permalink)  
Old 01-17-08, 08:05
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
1) create the database (see the CREATE DATABASE command)--If you have not already.
2) Bring up DB2 command window and Connect to the database
3) run db2 -tvsf app_ddl.txt


Andy
Reply With Quote
  #3 (permalink)  
Old 01-17-08, 21:44
sanandkannan sanandkannan is offline
Registered User
 
Join Date: Jan 2008
Posts: 4
Smile How to connect to the database?

Thanks Dude!

How to connect to the database? I don't think, I have given any passwords other than admin username and admin pwd...

Help me out.
Reply With Quote
  #4 (permalink)  
Old 01-17-08, 22:23
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
What DB2 version and OS?

Start here:
http://publib.boulder.ibm.com/infoce...n/c0006305.htm

Andy
Reply With Quote
  #5 (permalink)  
Old 01-19-08, 13:31
sanandkannan sanandkannan is offline
Registered User
 
Join Date: Jan 2008
Posts: 4
Smile DB2 9.5 and Windows XP

DB2 9.5 and Windows XP

Also that, I will be moving soon to Windows NT box as well

Please let me know, how to ahead in the above two instances...

Thanks in Advance.

-Anand
Reply With Quote
  #6 (permalink)  
Old 01-21-08, 08:05
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Setting up users and password is accomplished through the OS. Please read the manuals.

Andy
Reply With Quote
  #7 (permalink)  
Old 09-30-09, 09:44
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
Quote:
Originally Posted by sanandkannan
Hello Everyone,

I am very new to DB2.

1) I have installed DB2 server Personal edition only in my system.

2) I have a set of DDLs in a file(app_ddl.txt size: 200 KB) that starts with

create schema XXXX
...
...
create table XXXX.YYYY(......)
...
create table XXXX.AAAA(......)
...
...
create view XXXX.ZZZZ..... (blah..blah..blah)

3) Now I need to have the above database schema in my system using the "app_ddl.txt".

Please help me providing the steps(right from start after installation) for the setting up the DB asap.

Thanks in Advance,
Anand
no need to create schema. if it does not exist yet, it will be created implicitly when you create a table
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
Reply With Quote
  #8 (permalink)  
Old 09-30-09, 11:41
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
Not sure why you have resurrected an old thread, but now that you did...

Yes, you are correct. Schema will be created once you issue "Create table.." statement. However, you have to be aware of that when you do so, DB2 by default will grant CREATEIN on this schema to Public.

Where is if you define schema first and then build table, then access on this schema is restricted to your ID only unless you grant access to others.

Not sure about you, but there are two things that I see problematic with letting Db2 create schema.

1. Access is granted to Public by default
2. I, DBA, now have lost all control on the schema that I support.
__________________
--
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 09-30-09, 13:15
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
Quote:
Originally Posted by Cougar8000
Not sure why you have resurrected an old thread, but now that you did...

Yes, you are correct. Schema will be created once you issue "Create table.." statement. However, you have to be aware of that when you do so, DB2 by default will grant CREATEIN on this schema to Public.

Where is if you define schema first and then build table, then access on this schema is restricted to your ID only unless you grant access to others.

Not sure about you, but there are two things that I see problematic with letting Db2 create schema.

1. Access is granted to Public by default
2. I, DBA, now have lost all control on the schema that I support.
thank you. It's good to know this...
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
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