Solved

How to get the table names associated with a server

Posted on 2016-07-28
3
40 Views
Last Modified: 2016-08-01
In Sybase, I can run this query - select * from sysservers

and get a list of servernames which host my database(s). So how do I find out which databases are associated with my list of servers?


srvid    srvstatus   srvname  srvnetname srvclass
-------    -------------    ------------  -----------------  -----------
1             0                KITOS01   KITOS01        7
2          1024             SPLIISO    SPLIISO         10
0
Comment
Question by:brgdotnet
3 Comments
 
LVL 26

Assisted Solution

by:wilcoxon
wilcoxon earned 250 total points
ID: 41734070
I don't know of any way to get a list of databases from a remote server but you can get the list of databases on the current server by doing "select name from sysdatabases" (if you want only non-system databases, it looks like you could add "where status2 > 0").
0
 
LVL 3

Accepted Solution

by:
knel1234 earned 250 total points
ID: 41738007
If its me doing this then it would be a nested loop in a shell script (ie ksh).  You will need a list of your server names in a list (flat file or array).  Next you will do a select (as above) to get a list of databases [ie select * from sysdatabases where name not in ('master', 'model', 'sybsystemprocs','sybsystemdb','sybsecurity','dbccdb')
and name not like ('tempdb%') ]  
Important Note: you can certainly use the "status2 > 0" like approach above however you need to ensure 1) you get the results you expect.   For example, I often use multiple tempdbs and my tempdb2 has a status2 of 1.  Ultimately context is the key.  Are you looking for users dbs? or total disk consumption?  What is the business/management/technical requirement here?  2) you need to assume that these status bits don't get "magically" updated by SAP.  

Again, just my thoughts not even sure this thread is still going
cheers
0
 
LVL 2

Author Closing Comment

by:brgdotnet
ID: 41738317
Thank you.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
We have come a long way with backup and data protection — from backing up to floppies, external drives, CDs, Blu-ray, flash drives, SSD drives, and now to the cloud.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now