Solved

How to get the table names associated with a server

Posted on 2016-07-28
3
56 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the hope of saving someone else's sanity... About a year ago we bought a Cisco 1921 router with two ADSL/VDSL EHWIC cards to load balance local network traffic over the two broadband lines we have, but we couldn't get the routing to work consi…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

19 Experts available now in Live!

Get 1:1 Help Now