Solved

How to get the table names associated with a server

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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 Syntax 2 283
detecting a database behind a website 3 368
Pivot and Unpivot in Sybase 2 1,629
Sybase 15.7 database backup 8 631
This tutorial shows how to create a greeting card by combining two image layers and a text layer on a PC using a free image editing app.
February 24, 2017 — On February 23, Travis Ormandy, a vulnerability researcher at Google, reported on Twitter (https://twitter.com/taviso/status/834900838837411840) that massive stores of data have been leaked by CloudFlare, a company that provide…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

773 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