How can I create a query that will find all the databases on different servers?
I have four servers, PRDSVR, UATSVR, DEVSVR, TRNSVR; with either copies of the same database on each server or standalone databases that may only be on one or two servers.
I would like to create a query that searches for all databases, listing the server, databases on that server, and the size of each of the databases. How can I achieve this?
Thanks in advance for any suggestions.
Best Answer
Four part naming convention.
Add a linked server that will define the security context for connecting, then refer to
PRDSVR.master.sys.databases
and the like.