Solved

How to get the table names associated with a server

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
Sybase SQL Anywhere ISQL 8 1,029
compare Sybase and MSSQL server 18 960
Sybase IQ how to log personalized Users? 1 209
Exposing an EAV database model as a mart for visualisation 9 131
The world seems to conceive of a curious bubble separating IT from “the business.”  More so than just about any other pursuit in the commercial world, people think of IT as some kind of an island.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 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