Showing posts with label somebody. Show all posts
Showing posts with label somebody. Show all posts

Thursday, March 29, 2012

Enumerating Sql Server Databases

Hi. I would like to enumerate all the databases in a given Sql Server instance.

I've searched and found no information. Would somebody post a piece of VB code to do that?

Thanks in advance

Rafael

You can do it with an SQL string:

use masterselect *from sys.databases
|||

SELECT

*

FROM

master.sys.databases

Should work, but there is probably a more standard way.

|||There is also a stored procedure called:sp_databases

Thursday, March 22, 2012

Enterprise Manager/Query Analyser hangs

Hi, hope somebody can help - we have found a strange problem at one of our
clients (they run SQL srv 2000 with SP4 on Windows Server 2000 with SP3) -
when they click the + on Databases on Enterprise manager, it hangs and also
hangs the server (applications accessing the DB timeout). We found that user
sa did not have access to any DBs! -- which we restored with sp_changedbowner
- but still hangs! Query analyser also hangs when opening object browser. All
other actions also very slow. Have also checked and switched off autoclose on
all DBs.
Could not yet determine how and exactly when this happened.
Any advice appreciated.
Alice van Rensburg
>. We found that user
> sa did not have access to any DBs! --
sa is a sysadmin and has acceess by default to all databases
Is it poosible another actvities on the server?
"Alice" <Alice@.discussions.microsoft.com> wrote in message
news:B476EE93-18CB-4DCE-8D24-A80EE1062587@.microsoft.com...
> Hi, hope somebody can help - we have found a strange problem at one of our
> clients (they run SQL srv 2000 with SP4 on Windows Server 2000 with SP3) -
> when they click the + on Databases on Enterprise manager, it hangs and
> also
> hangs the server (applications accessing the DB timeout). We found that
> user
> sa did not have access to any DBs! -- which we restored with
> sp_changedbowner
> - but still hangs! Query analyser also hangs when opening object browser.
> All
> other actions also very slow. Have also checked and switched off autoclose
> on
> all DBs.
> Could not yet determine how and exactly when this happened.
> Any advice appreciated.
> Alice van Rensburg
>
|||Thanx for your reply - the interesting thing is that user sa did have access
to all DBs when we last checked (in December) - something must have happened
to change that, but we do not know what. Have checked - nothing else running
on the SQL server. We are seriously considering uninstall and reinstall.
"Uri Dimant" wrote:

> sa is a sysadmin and has acceess by default to all databases
> Is it poosible another actvities on the server?
>
> "Alice" <Alice@.discussions.microsoft.com> wrote in message
> news:B476EE93-18CB-4DCE-8D24-A80EE1062587@.microsoft.com...
>
>
|||Managed to resolve this issue - seems like one of the dbs still had a
non-existing Windows NT user as dbowner. We detached all DBs, and reattached
them one by one, each time checking the owner and checking if DataBases
folder opens.
Regards
A
"Alice" wrote:
[vbcol=seagreen]
> Thanx for your reply - the interesting thing is that user sa did have access
> to all DBs when we last checked (in December) - something must have happened
> to change that, but we do not know what. Have checked - nothing else running
> on the SQL server. We are seriously considering uninstall and reinstall.
> "Uri Dimant" wrote:

Enterprise Manager/Query Analyser hangs

Hi, hope somebody can help - we have found a strange problem at one of our
clients (they run SQL srv 2000 with SP4 on Windows Server 2000 with SP3) -
when they click the + on Databases on Enterprise manager, it hangs and also
hangs the server (applications accessing the DB timeout). We found that user
sa did not have access to any DBs! -- which we restored with sp_changedbowner
- but still hangs! Query analyser also hangs when opening object browser. All
other actions also very slow. Have also checked and switched off autoclose on
all DBs.
Could not yet determine how and exactly when this happened.
Any advice appreciated.
Alice van Rensburg>. We found that user
> sa did not have access to any DBs! --
sa is a sysadmin and has acceess by default to all databases
Is it poosible another actvities on the server?
"Alice" <Alice@.discussions.microsoft.com> wrote in message
news:B476EE93-18CB-4DCE-8D24-A80EE1062587@.microsoft.com...
> Hi, hope somebody can help - we have found a strange problem at one of our
> clients (they run SQL srv 2000 with SP4 on Windows Server 2000 with SP3) -
> when they click the + on Databases on Enterprise manager, it hangs and
> also
> hangs the server (applications accessing the DB timeout). We found that
> user
> sa did not have access to any DBs! -- which we restored with
> sp_changedbowner
> - but still hangs! Query analyser also hangs when opening object browser.
> All
> other actions also very slow. Have also checked and switched off autoclose
> on
> all DBs.
> Could not yet determine how and exactly when this happened.
> Any advice appreciated.
> Alice van Rensburg
>|||Thanx for your reply - the interesting thing is that user sa did have access
to all DBs when we last checked (in December) - something must have happened
to change that, but we do not know what. Have checked - nothing else running
on the SQL server. We are seriously considering uninstall and reinstall.
"Uri Dimant" wrote:
> >. We found that user
> > sa did not have access to any DBs! --
> sa is a sysadmin and has acceess by default to all databases
> Is it poosible another actvities on the server?
>
> "Alice" <Alice@.discussions.microsoft.com> wrote in message
> news:B476EE93-18CB-4DCE-8D24-A80EE1062587@.microsoft.com...
> > Hi, hope somebody can help - we have found a strange problem at one of our
> > clients (they run SQL srv 2000 with SP4 on Windows Server 2000 with SP3) -
> > when they click the + on Databases on Enterprise manager, it hangs and
> > also
> > hangs the server (applications accessing the DB timeout). We found that
> > user
> > sa did not have access to any DBs! -- which we restored with
> > sp_changedbowner
> > - but still hangs! Query analyser also hangs when opening object browser.
> > All
> > other actions also very slow. Have also checked and switched off autoclose
> > on
> > all DBs.
> > Could not yet determine how and exactly when this happened.
> > Any advice appreciated.
> > Alice van Rensburg
> >
>
>|||Managed to resolve this issue - seems like one of the dbs still had a
non-existing Windows NT user as dbowner. We detached all DBs, and reattached
them one by one, each time checking the owner and checking if DataBases
folder opens.
Regards
A
"Alice" wrote:
> Thanx for your reply - the interesting thing is that user sa did have access
> to all DBs when we last checked (in December) - something must have happened
> to change that, but we do not know what. Have checked - nothing else running
> on the SQL server. We are seriously considering uninstall and reinstall.
> "Uri Dimant" wrote:
> > >. We found that user
> > > sa did not have access to any DBs! --
> >
> > sa is a sysadmin and has acceess by default to all databases
> >
> > Is it poosible another actvities on the server?
> >
> >
> >
> > "Alice" <Alice@.discussions.microsoft.com> wrote in message
> > news:B476EE93-18CB-4DCE-8D24-A80EE1062587@.microsoft.com...
> > > Hi, hope somebody can help - we have found a strange problem at one of our
> > > clients (they run SQL srv 2000 with SP4 on Windows Server 2000 with SP3) -
> > > when they click the + on Databases on Enterprise manager, it hangs and
> > > also
> > > hangs the server (applications accessing the DB timeout). We found that
> > > user
> > > sa did not have access to any DBs! -- which we restored with
> > > sp_changedbowner
> > > - but still hangs! Query analyser also hangs when opening object browser.
> > > All
> > > other actions also very slow. Have also checked and switched off autoclose
> > > on
> > > all DBs.
> > > Could not yet determine how and exactly when this happened.
> > > Any advice appreciated.
> > > Alice van Rensburg
> > >
> >
> >
> >