473,839 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
11 36086
Ian
Chuck wrote:
Ian <ia*****@mobile audio.com> wrote in
news:40******** **@corp.newsgro ups.com:

Chuck wrote:
Ian <ia*****@mobile audio.com> wrote in news:40b6d34d$1 _1
@corp.newsgr oups.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*****@mobile audio.com> wrote in
news:40******** **@corp.newsgro ups.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
2718
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 the list of the databases. How do I do that using command line from the windows client machine? Thanks.
11
5331
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 should configured to work, how memory is shared or not, etc. I can not seem to find any good links to this information. Thanks, Mike
0
1427
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 databases and db2 connect pass through traffic (to z/os). I want our db2 connect traffic to go through a separate instance so that it doesn't take away resources from the local databases. The configuration I would like to have is: Server1
0
1489
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 one instance on a server. I have a situation where I have many instances on one server, with many small databases, about 20 instances with about 45 databases. Sounds great so far doesn't it? Anyway my question at this point is when trying to...
1
1959
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 isntances on a server by using the db2ilist command. What's the sequence of commands needed to pull up a list of the dataqbases inside an isntance.
3
1861
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 been told but IBM support that this isn't currently possible for a client to do. I'd like to get a second opinion since the CCA seems to be able to manage it without any problems so the API must be there to do it. The main reason why I'd like...
2
2141
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 always list only the databases, belonging to the instance its name was in the DB2INSTANCE at the moment of the start of my program. Any "attach to.." or seting DB2INSTANCE in the program afterwards (at least on windows) doesn't seem to make the...
4
2054
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 installed and run in multiple instances with the configuration data (database, login, etc.) stored in an app.config file. Up to now I was concerned with Windows CE apps only so both running an app as service and running multiple instances of...
2
1830
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 database. Probably there will be only a single database , although there could be more. Let's call this database CORE. We'll could have a single instance with, say, CORE_DEV1, CORE_DEV2, CORE_DEV3, etc. (We'd also have a separate production...
0
9854
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10584
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7827
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5681
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4482
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3131
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.