<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>JIMMY HARPER'S OPERATIONS MANAGER BLOG : database</title><link>http://blogs.technet.com/jimmyharper/archive/tags/database/default.aspx</link><description>Tags: database</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>SQL Database Properties Not Discovered</title><link>http://blogs.technet.com/jimmyharper/archive/2009/06/11/sql-database-properties-not-discovered.aspx</link><pubDate>Thu, 11 Jun 2009 20:26:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3253623</guid><dc:creator>jimmyharper</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/jimmyharper/comments/3253623.aspx</comments><wfw:commentRss>http://blogs.technet.com/jimmyharper/commentrss.aspx?PostID=3253623</wfw:commentRss><description>&lt;P&gt;I ran into an issue recently where some SQL Databases were not showing any properties in OpsMgr, other than the database name:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/SQLDatabasePropertiesNotDiscovered_ABB3/image_2.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/SQLDatabasePropertiesNotDiscovered_ABB3/image_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/SQLDatabasePropertiesNotDiscovered_ABB3/image_thumb.png" width=470 height=340 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/SQLDatabasePropertiesNotDiscovered_ABB3/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get these properties, the database discovery script runs the “sp_helpdb” stored procedure against the database.&amp;nbsp; To test this, open SQL Server Managment Studio, connect to the SQL Instance in question, open a new query window and run “sp_helpdb &amp;lt;database name&amp;gt;”":&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/SQLDatabasePropertiesNotDiscovered_ABB3/image_4.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/SQLDatabasePropertiesNotDiscovered_ABB3/image_4.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/SQLDatabasePropertiesNotDiscovered_ABB3/image_thumb_1.png" width=1115 height=335 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/SQLDatabasePropertiesNotDiscovered_ABB3/image_thumb_1.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;NOTE: You should run this under the same account that is used for the “SQL Server Discovery Account” RunAs Profile….if you haven’t defined an account for this profile, then use the Action Account.&lt;/P&gt;
&lt;P&gt;If this doesn’t return any results (as shown below), then the problem is likely due to permissions.&amp;nbsp; From the SQL MP guide, the requirements for DB discovery are:&lt;/P&gt;
&lt;TABLE border=1 cellSpacing=0 cellPadding=0&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=295&gt;
&lt;P&gt;· EXEC permissions for (sp_helpdb)&lt;/P&gt;
&lt;P&gt;· Select from sys.databases table in the master database&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/SQLDatabasePropertiesNotDiscovered_ABB3/image_8.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/SQLDatabasePropertiesNotDiscovered_ABB3/image_8.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/SQLDatabasePropertiesNotDiscovered_ABB3/image_thumb_3.png" width=824 height=306 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/SQLDatabasePropertiesNotDiscovered_ABB3/image_thumb_3.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Also, before running sp_helpdb, the discovery script will query to get a list of databases.&amp;nbsp; In SQL 2005/2008, the query is:&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#ff0000&gt;SELECT name, state_desc FROM sys.databases WHERE source_database_id IS NULL&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;In SQL 2000, the query is:&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#ff0000&gt;SELECT name FROM sysdatabases&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The difference is that in SQL 2005/2008, we have the “WHERE source_database_id IS NULL“ clause, which will eliminate snapshot databases…..so if the SQL instance has any snapshot databases, they will not be discovered.&amp;nbsp; We also select the “state” column from sys.databases in SQL 2005/2008 DB discovery, and if the state is not “ONLINE”, then the discovery ends there….so this would be another reason why the database properties do not show up in OpsMgr.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Attached to this blog are debug version of the database discovery script:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;DiscoverSQL2005DB_debug.txt – Use this for SQL 2005/2008&lt;/P&gt;
&lt;P&gt;DiscoverSQL2000DB_debug.txt – Use this for SQL 2000&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;To run the script:&lt;/STRONG&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Rename to .vbs&lt;/LI&gt;
&lt;LI&gt;Run the following command: &lt;/LI&gt;&lt;/OL&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;cscript DiscoverSQL2005DB_debug.vbs &lt;FONT color=#ff0000&gt;&lt;STRONG&gt;&amp;lt;fqdn&amp;gt;&lt;/STRONG&gt; &lt;STRONG&gt;&amp;lt;Server\instance&amp;gt;&lt;/STRONG&gt;&lt;/FONT&gt; "exclude:"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;Replace the bold items with:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#ff0000&gt;&amp;lt;fqdn&amp;gt;&lt;/FONT&gt;&lt;/STRONG&gt; = Full Qualified Domain Name of the SQL Server (server.domain.com)&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#ff0000&gt;&lt;STRONG&gt;&amp;lt;Server\instance&amp;gt;&lt;/STRONG&gt;&lt;/FONT&gt; = SQL Server instance that we want to discover DBs on.&amp;nbsp; If it is the default instance, it will just be the server name (SERVER), otherwise it will be SERVER\INSTANCE&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Sample output from my server:&lt;/P&gt;
&lt;P&gt;Server name is jimmyhsql1.jimmyhdom.com&lt;/P&gt;
&lt;P&gt;SQL instance is OpsDB&lt;/P&gt;
&lt;P&gt;Command line is &lt;STRONG&gt;cscript discoversql2005db_debug.vbs jimmyhsql1.jimmyhdom.com jimmyhsql1\opsdb "exclude:"&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Output (I only copied the output for the first couple DBs):&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Entering DoDatabaseDiscovery function... &lt;BR&gt;Connection string is Server=jimmyhsql1\opsdb;Database=master;Trusted_Connection= &lt;BR&gt;yes &lt;BR&gt;Error number is 0 &lt;BR&gt;Querying for list of non-snapshot databases... &lt;BR&gt;Error number is 0 &lt;BR&gt;================================== &lt;BR&gt;DatabaseName: master &lt;BR&gt;DatabaseState ONLINE &lt;/P&gt;
&lt;P&gt;Runing sp_helpdb master &lt;BR&gt;ErrorNumber: 0 &lt;BR&gt;If no results are listed below, then sp_helpdb did not return anything....check &lt;BR&gt;permissions &lt;/P&gt;
&lt;P&gt;DatabaseSize: 4 &lt;BR&gt;DatabaseSizeNumeric: 4 &lt;BR&gt;LogSize: 0.5 &lt;BR&gt;LogSizeNumeric: 0 &lt;BR&gt;RecoveryModel: SIMPLE &lt;BR&gt;Updateability: READ_WRITE &lt;BR&gt;UserAccess: MULTI_USER &lt;BR&gt;Collation: SQL_Latin1_General_CP1_CI_AS &lt;BR&gt;DatabaseAutogrow: True &lt;BR&gt;LogAutogrow: True &lt;BR&gt;Owner: sa &lt;BR&gt;================================== &lt;/P&gt;
&lt;P&gt;================================== &lt;BR&gt;DatabaseName: tempdb &lt;BR&gt;DatabaseState ONLINE &lt;/P&gt;
&lt;P&gt;Runing sp_helpdb tempdb &lt;BR&gt;ErrorNumber: 0 &lt;BR&gt;If no results are listed below, then sp_helpdb did not return anything....check &lt;BR&gt;permissions &lt;/P&gt;
&lt;P&gt;DatabaseSize: 23.0625 &lt;BR&gt;DatabaseSizeNumeric: 23 &lt;BR&gt;LogSize: 1 &lt;BR&gt;LogSizeNumeric: 1 &lt;BR&gt;RecoveryModel: SIMPLE &lt;BR&gt;Updateability: READ_WRITE &lt;BR&gt;UserAccess: MULTI_USER &lt;BR&gt;Collation: SQL_Latin1_General_CP1_CI_AS &lt;BR&gt;DatabaseAutogrow: True &lt;BR&gt;LogAutogrow: True &lt;BR&gt;Owner: sa &lt;BR&gt;==================================&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3253623" width="1" height="1"&gt;</description><enclosure url="http://blogs.technet.com/jimmyharper/attachment/3253623.ashx" length="9129" type="application/x-zip-compressed" /><category domain="http://blogs.technet.com/jimmyharper/archive/tags/Discovery/default.aspx">Discovery</category><category domain="http://blogs.technet.com/jimmyharper/archive/tags/SQL/default.aspx">SQL</category><category domain="http://blogs.technet.com/jimmyharper/archive/tags/database/default.aspx">database</category><category domain="http://blogs.technet.com/jimmyharper/archive/tags/script/default.aspx">script</category></item></channel></rss>