Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to get the table names associated with a server

Posted on 2016-07-28
3
Medium Priority
?
121 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 27

Assisted Solution

by:wilcoxon
wilcoxon earned 1000 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 1000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

An overview of cyber security, cyber crime, and personal protection against hackers. Includes a brief summary of the Equifax breach and why everyone should be aware of it. Other subjects include: how cyber security has failed to advance with technol…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

604 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