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 > DB under dbinstance

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-02-10, 10:39
sdsu sdsu is offline
Registered User
 
Join Date: Dec 2009
Posts: 22
DB under dbinstance

Hi sorry I'm little new to DB2 ...So kindly Bare me.

Is there any way to check whether there is a Database installed in my instance ...i tried a couple of things .... but not able to figure out ..and do we need to be as db2inst user or any user to check this ???

As some one corrected me before which is was very helpful that
" You don't connect to an instance; you connect to a database, and the DBA will need to create one for you. Then you can create your schema and objects in that database, given sufficient privileges."

I though if they have created a DB in the instance then i will be able to see the Node000 dir in the /home/db2inst/sqllib directory ....but i don't see it in mine.

But i'm not really sure ....but to my understanding from the a couple of DB2 documentation i though it is this Node dir which says an existing of DB under the schema???

Can some one help me out ....i'm having very hard time and i'm not able to get some useful documentation to get all this info too.

I know it is such a pain to answer so stupid questions ...so i tried to read ..but i'm having little hard time getting all these figured out !

Thanks in advance ....Eagerly waiting for response !
Reply With Quote
  #2 (permalink)  
Old 08-02-10, 14:42
Jack Vamvas Jack Vamvas is offline
Registered User
 
Join Date: Jan 2009
Posts: 57
If you can get to a command line - try : "db2 list db directory" - this will list out the databases on that particular instance - assuming you have relevant permissions.
__________________
-------------
DBA DB2
SQL SERVER DBA
Reply With Quote
  #3 (permalink)  
Old 08-03-10, 10:08
sdsu sdsu is offline
Registered User
 
Join Date: Dec 2009
Posts: 22
Hey Thanks for the Quick Reply Jack Vamvas...Really Appreciate it !

This Is the what i'm getting from the above , So i guess i don't have any databases under this instance

$DB2/bin-> db2ilist
db2inst2


So If my understanding is right .... this shows that there is an instance created under the db2 database ( and there can be multiple instances under a single DB2)

db2 => list db directory
SQL1057W The system database directory is empty. SQLSTATE=01606


But this shows that there is no database created under the instance which belongs to the DB2 right ???


$/home/db2inst1-> ls
db2imdbd.dmp db2inst1 sqllib
$/home/db2inst1-> cd db2inst1
./home/db2inst1/db2inst1-> ls
NODE0000
/home/db2inst1/db2inst1-> cd NODE0000
.../db2inst1/db2inst1/NODE0000-> ls
SQL00001 sqldbdir

So now according to this directory structure it shows that the instance db2inst1 has a database name db2inst1 created right ????


Can Some Correct me if i'm going in a wrong track in understanding this ???

Thanks in Advance Guys .....It was really Helpful !
Reply With Quote
  #4 (permalink)  
Old 08-07-10, 00:23
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
You have instance db2inst2 as per db2ilist output. But then you're logged in as db2inst1 and there is one database under db2inst1's home dir (is this on the
same server??)

Login as db2inst1 and execute "db2 list db directory". You can also try viewing local db directory file using "strings /home/db2inst1/db2inst1/NODE0000/sqldbdir/sqldbdir"
Reply With Quote
  #5 (permalink)  
Old 08-07-10, 01:50
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
DB2 can have multiple instances, and each instance can have zero to many databases.

To find the databases in each instance, login to UNIX/Linux as the instance owner (db2inst1 or db2isnt2) and then issue the command that Bella mentioned for each each instance you are logged on to.

db2 list db directory

I think you are making some wrong conclusions based on the directory structure you see, but that is not surprising since it can be a little confusing.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #6 (permalink)  
Old 08-10-10, 23:19
sdsu sdsu is offline
Registered User
 
Join Date: Dec 2009
Posts: 22
Quote:
Originally Posted by db2girl View Post
You have instance db2inst2 as per db2ilist output. But then you're logged in as db2inst1 and there is one database under db2inst1's home dir (is this on the
same server??)

Login as db2inst1 and execute "db2 list db directory". You can also try viewing local db directory file using "strings /home/db2inst1/db2inst1/NODE0000/sqldbdir/sqldbdir"
Thanks bella and Marcus for the replys, I really Appreciate your help.
Yup it has been quite confusing to me ...especially when i try to figure some many diff situations ..... I Apologize If my Questions are really stupid ..it is just that i'm not able to figure these thing myself.

Ya i have both the instance on the same server, db2inst1 has database created under in it while there is nothing in db2inst2

now If i create a database under the db2inst2 by using create db command then the owner of this database will be db2isnt2 right ??? but then can i give another user which is on the box Grant the Admin priv to create a Schema in this database ???

Can this be done by adding the other user to the db2grp which gets created which db2inst is created ???

db2inst2 will be like the super user for any database that are been created under it right ???

The thing is need to create a DB and assign a user for it which can create schema , tables, views, triggers in that DB


Lastly if the db2 client has a instance db2inst1 and while the DB in on db2inst2 will that still work as long as we catalog or both need to same ??

Thanks guys ...I really Appreciate all your time and help !

It is a life Saver

Thanks in Advance !!!!!
Reply With Quote
  #7 (permalink)  
Old 08-11-10, 22:28
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
The following should answer most of your questions:
IBM DB2 9.5 Information Center for Linux, UNIX, and Windows
IBM DB2 9.5 Information Center for Linux, UNIX, and Windows


For a client to access a database on the server, you need to catalog the node by specifying the hostname/IP address of the server and the service name/port number of the instance and then catalog the database. You need to catalog every instance/database your client needs to access.
Reply With Quote
  #8 (permalink)  
Old 08-17-10, 09:27
sdsu sdsu is offline
Registered User
 
Join Date: Dec 2009
Posts: 22
Hey thanks Bella,

i was able to understand the db2 stuff finally, it was a bit confusing thinking about all theses things before .

anyhow so what i figured from all you guys help is that,

we can create the database under an instance as instance owner and then we just need to catalog that node with port number on the client host which needs to communicate with the database on server.


Now when i tried to grant the instance owner the dbadm privilege last night on the database that i created ..it throw an error saying that and " Unauthorized user can grant privilege to same user " but i can see the db2inst1 in syscat.dbauth table

but then when i tried to grant the privilege to other user it was successful
so does that mean i cann't grant the db2inst1 dbadm privilege as it self is the more privilege then that ???

Thanks in advance !
Reply With Quote
  #9 (permalink)  
Old 08-17-10, 14:46
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
You can't grant to yourself
Reply With Quote
  #10 (permalink)  
Old 08-18-10, 16:36
sdsu sdsu is offline
Registered User
 
Join Date: Dec 2009
Posts: 22
ohh Ok thanks Bella !!!
so that was the reason for the error message.

so just out of curiosity if i want to know whether the db2inst owner has the dbadm privilege on DB

bcoz when i query the syscat.dbauth table i see the" SYSIBM db2inst1 "
entry there so ....i'm assuming that the instance already has the dbadm privilage on the db under it right ??

Forgive me if i sound stupid .....just trying to figure out the things here.

I really appreciate all your help guys( Bella, Marcus, Jack) .... It was really helpful and i gained fair a bit of db2 stuff

Thanks Once Again !!!
Reply With Quote
  #11 (permalink)  
Old 08-18-10, 19:58
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Quote:
Originally Posted by sdsu View Post
so just out of curiosity if i want to know whether the db2inst owner has the dbadm privilege on DB

bcoz when i query the syscat.dbauth table i see the" SYSIBM db2inst1 "
entry there so ....i'm assuming that the instance already has the dbadm privilage on the db under it right ??
Login as the instance owner and execute:
db2 get authorizations
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