473,385 Members | 1,855 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to list an instances databases

Is there a command that will list all of the databases for a particular
instance on the local machine, whether they are activated or not?

If there is no such command, is there at least a way to list only the local
databases in the db directory, and tie them back to the instance they
belong to?
--
Chuck
Remove "_nospam" to reply by email
Nov 12 '05 #1
11 36034

"Chuck" <ch***********@softhome.net> wrote in message
news:Xn**********************************@130.133. 1.4...
Is there a command that will list all of the databases for a particular
instance on the local machine, whether they are activated or not?

If there is no such command, is there at least a way to list only the local databases in the db directory, and tie them back to the instance they
belong to?


You didn't say which DB2 platform and version you are using so my remarks
pertain to V7.2 (PE) on Windows.

It's not the neatest solution in the world but if you use the Control
Center, you can easily list which databases belong to each instance. To
determine which ones are active, just execute:
db2 list active databases

The output lists the database names of each database that is active. That
should enable you to determine which ones are active and which are not.

Like I said, it's a bit of manual work, especially if you have a lot of
databases, but they say hard work builds character ;-)

If this is something you have to do frequently, you may be able to write
your own utility for it via the DB2 API. Or not; I haven't looked to see if
the necessary functions are all present in the API.

Rhino
Nov 12 '05 #2
Ian
Chuck wrote:
Is there a command that will list all of the databases for a particular
instance on the local machine, whether they are activated or not?


list database directory
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #3
Ian <ia*****@mobileaudio.com> wrote in news:40b6d34d$1_1
@corp.newsgroups.com:
list database directory


That lists all databases cataloged in the DB directory. Even one's on other
machines. What I'm looking for is a list of the databases that belong to
one instance on the local machine.

Platform AIX 5.2, DB2 8.1.

--
Chuck
Remove "_nospam" to reply by email
Nov 12 '05 #4
In article <Xn**********************************@130.133.1.4> , Chuck
(ch***********@softhome.net) says...
Ian <ia*****@mobileaudio.com> wrote in news:40b6d34d$1_1
@corp.newsgroups.com:
list database directory


That lists all databases cataloged in the DB directory. Even one's on other
machines. What I'm looking for is a list of the databases that belong to
one instance on the local machine.

Platform AIX 5.2, DB2 8.1.


db2 list db directory on <local-path>
Nov 12 '05 #5
Ian
Chuck wrote:
Ian <ia*****@mobileaudio.com> wrote in news:40b6d34d$1_1
@corp.newsgroups.com:

list database directory

That lists all databases cataloged in the DB directory. Even one's on other
machines. What I'm looking for is a list of the databases that belong to
one instance on the local machine.

Platform AIX 5.2, DB2 8.1.


OK, I guess I'm not following. You can use grep to eliminate the remote
databases from the 'list database directory' output:

db2 list db directory | grep -vp Remote

If you're looking for other databases that do not exist in the database
directory... you may have a bigger problem. :-)

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #6
list db directory on /db2dir (db directory path) : will show local database
list active databases : will show databases that are active
Chuck <ch***********@softhome.net> wrote in message news:<Xn**********************************@130.133 .1.4>...
Ian <ia*****@mobileaudio.com> wrote in news:40b6d34d$1_1
@corp.newsgroups.com:
list database directory


That lists all databases cataloged in the DB directory. Even one's on other
machines. What I'm looking for is a list of the databases that belong to
one instance on the local machine.

Platform AIX 5.2, DB2 8.1.

Nov 12 '05 #7
ud****@yahoo.com (Mike Lebermann) wrote in
news:f4*************************@posting.google.co m:
list db directory on /db2dir (db directory path) : will show local
database list active databases : will show databases that are
active Chuck <ch***********@softhome.net> wrote in message
news:<Xn**********************************@130.133 .1.4>...
Ian <ia*****@mobileaudio.com> wrote in news:40b6d34d$1_1
@corp.newsgroups.com:
> list database directory


That lists all databases cataloged in the DB directory. Even one's on
other machines. What I'm looking for is a list of the databases that
belong to one instance on the local machine.

Platform AIX 5.2, DB2 8.1.


Only if all the databases are on the same path. I can have two databases
in the same instance that are not on the same path.
--
Chuck
Remove "_nospam" to reply by email
Nov 12 '05 #8
Gert van der Kooij <ge**@invalid.nl> wrote in
news:MP************************@news.xs4all.nl:
In article <Xn**********************************@130.133.1.4> , Chuck
(ch***********@softhome.net) says...
Ian <ia*****@mobileaudio.com> wrote in news:40b6d34d$1_1
@corp.newsgroups.com:
> list database directory


That lists all databases cataloged in the DB directory. Even one's on
other machines. What I'm looking for is a list of the databases that
belong to one instance on the local machine.

Platform AIX 5.2, DB2 8.1.


db2 list db directory on <local-path>


I can still have two dbs on different paths but are part of the same
instance.
--
Chuck
Remove "_nospam" to reply by email
Nov 12 '05 #9
Ian <ia*****@mobileaudio.com> wrote in
news:40**********@corp.newsgroups.com:
Chuck wrote:
Ian <ia*****@mobileaudio.com> wrote in news:40b6d34d$1_1
@corp.newsgroups.com:

list database directory

That lists all databases cataloged in the DB directory. Even one's on
other machines. What I'm looking for is a list of the databases that
belong to one instance on the local machine.

Platform AIX 5.2, DB2 8.1.


OK, I guess I'm not following. You can use grep to eliminate the
remote databases from the 'list database directory' output:

db2 list db directory | grep -vp Remote


Ah, but I could have multiple instances on the local machine. I only want
the dbs associated with one local instance.

Besides, the output from the list db directory command is split over
several lines for each db. For grep to work you'd need to first find some
wat to combine all the lines for a db into a single line.

--
Chuck
Remove "_nospam" to reply by email
Nov 12 '05 #10
Ian
Chuck wrote:
Ian <ia*****@mobileaudio.com> wrote in
news:40**********@corp.newsgroups.com:

Chuck wrote:
Ian <ia*****@mobileaudio.com> wrote in news:40b6d34d$1_1
@corp.newsgroups.com:

list database directory
That lists all databases cataloged in the DB directory. Even one's on
other machines. What I'm looking for is a list of the databases that
belong to one instance on the local machine.

Platform AIX 5.2, DB2 8.1.

OK, I guess I'm not following. You can use grep to eliminate the
remote databases from the 'list database directory' output:

db2 list db directory | grep -vp Remote

Ah, but I could have multiple instances on the local machine. I only want
the dbs associated with one local instance.


'list db directory' only lists databases cataloged in the current instance.
Besides, the output from the list db directory command is split over
several lines for each db. For grep to work you'd need to first find some
wat to combine all the lines for a db into a single line.


On AIX, this is precisely what the -p option does: It prints the
"paragraph" that has a line containing the info you are looking for.

So, the command 'db2 list db directory | grep -vp Remote' will print out
the database directory information for local databases in the current
instance. If you want just the database names,

db2 list db directory | grep -vp Remote | \
grep 'Database name' | awk '{print $4}'


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #11
Ian <ia*****@mobileaudio.com> wrote in
news:40**********@corp.newsgroups.com:

'list db directory' only lists databases cataloged in the current
instance.
Didn't realize that. (I'm still a newbie).
Besides, the output from the list db directory command is split over
several lines for each db. For grep to work you'd need to first find
some wat to combine all the lines for a db into a single line.


On AIX, this is precisely what the -p option does: It prints the
"paragraph" that has a line containing the info you are looking for.

So, the command 'db2 list db directory | grep -vp Remote' will print
out the database directory information for local databases in the
current instance. If you want just the database names,

db2 list db directory | grep -vp Remote | \
grep 'Database name' | awk '{print $4}'


It still missed one of my local DBs for some reason, but changing the first
grep to 'grep "Local database directory" ' did the trick. Thanks for
helping me out and setting me straight on the exact behaviour of the list
db directory command.
--
Chuck
Remove "_nospam" to reply by email
Nov 12 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Zicco Fen | last post by:
We have windows clients and a DB2 UDB database on an AIX box. In Windows, if we use the Control Center, add the system, and expand on the tree, we can see the list of instances on the system and...
11
by: Mike | last post by:
Looking to find any information on how to properly configure multiple instances of DB2. This is on Win2k db2 ver 7.2. I am basically looking for information on how the multiple instance settings...
0
by: klh | last post by:
Hi group, We are attempting to install an MS clustered failover environment (mutual-takeover) for Windows 2003 and DB2 V8. All of our instances are non-partitioned. We have both local...
0
by: cjshea | last post by:
Hello Friends; I have a general question on Configuration Advisor, as I get to know it better I may have more focused questions. I have a feeling that the Advisor may assume that there is only...
1
by: Byrocat | last post by:
These particular servers do not have the DAS enabled, so I have to document the contents of the instances, initially "instance X contains n databases (A, B, C< ....)") I can get get list of...
3
by: Tim | last post by:
Hello Everyone I'd like to create a script/program that can locate all servers running DB2, finding out which instances are running/created and what databases are running under them but have...
2
by: dbrich | last post by:
Hi, has anybody tried this out, I have some troubles. I want to list (in a "c" program) all databases from the system directory, belonging to a particular instance. For some reason, these functions...
4
by: Roland Riess | last post by:
Hi all, at the moment i am developing an app which is sort of an interface to copy data from one database to another and it shall run as a service. As there are several databases the app must be...
2
by: Frank Swarbrick | last post by:
Given the following situation, I am wondering what advantages and disadvantages there would be for creating more than one instance. For testing, we want to have more than one 'version' of a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.