April 12, 2013 at 1:33 pm
So I am exploring PowerShell, and found a DB with .Databases that I can't see in sys.databases.
I ran this following (starting from the Machine level with sqlps):
$i = ls
$i | %{$_.Databases}
It returns a list of all the DBs, but there is one that says that the state is Normal, Standyby.
I don't see it through SSMS, and it isn't in sys.databases.
What could cause this and what should I do about that?
April 12, 2013 at 1:35 pm
check the same database in SSMS: is it set as offline? a lot of processes don't see offline databases, i know i've tripped over that a few times.
Lowell
April 12, 2013 at 1:37 pm
Unfortunately it doesn't show up at all in SSMS.
April 12, 2013 at 1:42 pm
dkschill (4/12/2013)
So I am exploring PowerShell, and found a DB with .Databases that I can't see in sys.databases.I ran this following (starting from the Machine level with sqlps):
$i = ls
$i | %{$_.Databases}
It returns a list of all the DBs, but there is one that says that the state is Normal, Standyby.
I don't see it through SSMS, and it isn't in sys.databases.
What could cause this and what should I do about that?
What is the name of the databse?
April 12, 2013 at 1:44 pm
It is RISDB, and I was able to look up some of the metadata with Powershell. I can see that it was created last year by one of our DBAs.
April 13, 2013 at 5:40 am
Are you sure you're comparing to the correct instance?
When I run this PoSh code:
Add-PSSnapin SqlServerProviderSnapin100
Add-PSSnapin SqlServerCmdletSnapin100
Set-Location SQLSERVER:\SQL\orlando\sql2008r2$i = ls
$i | %{$_.Databases}
This is what is run on the instance when the ls is run:
exec sp_executesql N'SELECT
dtb.collation_name AS [Collation],
dtb.name AS [DatabaseName2]
FROM
master.sys.databases AS dtb
WHERE
(dtb.name=@_msparam_0)',N'@_msparam_0 nvarchar(4000)',@_msparam_0=N'master'
exec sp_executesql N'SELECT
dtb.name AS [Name]
FROM
master.sys.databases AS dtb
WHERE
(dtb.name=@_msparam_0)',N'@_msparam_0 nvarchar(4000)',@_msparam_0=N'msdb'
exec sp_executesql N'SELECT
dtb.collation_name AS [Collation],
dtb.name AS [DatabaseName2]
FROM
master.sys.databases AS dtb
WHERE
(dtb.name=@_msparam_0)',N'@_msparam_0 nvarchar(4000)',@_msparam_0=N'msdb'
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
April 13, 2013 at 11:30 am
I am 95% sure. All the other databases are the same except the one. I will run those scripts that you caught in a trace...and if I still don't see the DB then I will run a trace and see if something is a little different. I am launching sqlps from powershell...not sure on version...I know that I have put 2008 R2 on the machine I am running the scripts from.
Thanks again for the help,
Dane
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply