Sunday, March 25, 2012

Cannot display database properties windows in Sql server management studio.

I use sql server 2005 developer edition with service pack 1.

When i right click on a database and i select properties an error occured with the folowing stack trace

===================================

Cannot show requested dialog.

===================================

Cannot show requested dialog. (SqlMgmt)


Program Location:

at Microsoft.SqlServer.Management.SqlMgmt.DefaultLaunchFormHostedControlAllocator.AllocateDialog(XmlDocument initializationXml, IServiceProvider dialogServiceProvider, CDataContainer dc)
at Microsoft.SqlServer.Management.SqlMgmt.DefaultLaunchFormHostedControlAllocator.Microsoft.SqlServer.Management.SqlMgmt.ILaunchFormHostedControlAllocator.CreateDialog(XmlDocument initializationXml, IServiceProvider dialogServiceProvider)
at Microsoft.SqlServer.Management.SqlMgmt.LaunchForm.InitializeForm(XmlDocument doc, IServiceProvider provider, ISqlControlCollection control)
at Microsoft.SqlServer.Management.SqlMgmt.LaunchForm..ctor(XmlDocument doc, IServiceProvider provider)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ToolsMenuItem.OnCreateAndShowForm(IServiceProvider sp, XmlDocument doc)
at Microsoft.SqlServer.Management.SqlMgmt.RunningFormsTable.RunningFormsTableImpl.ThreadStarter.StartThread()

===================================

Object reference not set to an instance of an object. (System.Data)


Program Location:

at System.Data.SqlClient.TdsParserStateObject.ReadStringWithEncoding(Int32 length, Encoding encoding, Boolean isPlp)
at System.Data.SqlClient.TdsParser.ReadSqlStringValue(SqlBuffer value, Byte type, Int32 length, Encoding encoding, Boolean isPlp, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.ReadSqlValue(SqlBuffer value, SqlMetaDataPriv md, Int32 length, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ReadColumnData()
at System.Data.SqlClient.SqlDataReader.ReadColumn(Int32 i, Boolean setTimeout)
at System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i)
at System.Data.SqlClient.SqlDataReader.GetValues(Object[] values)
at Microsoft.SqlServer.Management.Smo.DataProvider.SetConnectionAndQuery(ExecuteSql execSql, String query)
at Microsoft.SqlServer.Management.Smo.ExecuteSql.GetDataProvider(StringCollection query, Object con, StatementBuilder sb, RetriveMode rm)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.FillData(ResultType resultType, StringCollection sql, Object connectionInfo, StatementBuilder sb)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.FillDataWithUseFailure(SqlEnumResult sqlresult, ResultType resultType)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.BuildResult(EnumResult result)
at Microsoft.SqlServer.Management.Smo.DatabaseLevel.GetData(EnumResult res)
at Microsoft.SqlServer.Management.Smo.Environment.GetData()
at Microsoft.SqlServer.Management.Smo.Environment.GetData(Request req, Object ci)
at Microsoft.SqlServer.Management.Smo.Enumerator.GetData(Object connectionInfo, Request request)
at Microsoft.SqlServer.Management.Smo.ExecutionManager.GetEnumeratorDataReader(Request req)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.GetInitDataReader(String[] fields, OrderBy[] orderby)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ImplInitialize(String[] fields, OrderBy[] orderby)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.Initialize(Boolean allProperties)
at Microsoft.SqlServer.Management.Smo.SmoCollectionBase.GetObjectByKey(ObjectKeyBase key)
at Microsoft.SqlServer.Management.Smo.DatabaseCollection.get_Item(String name)
at Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseData.DatabasePrototype.DatabaseData..ctor(CDataContainer context, String databaseName)
at Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseData.DatabasePrototype.LoadDefinition(String newName)
at Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseData.DatabasePrototype..ctor(CDataContainer context)
at Microsoft.SqlServer.Management.SqlManagerUI.DBPropSheet..ctor(CDataContainer context)

Accroding to the reflected sources:

public DatabaseData(CDataContainer context, string databaseName)
{
this.mirrorSafetyLevel = MirroringSafetyLevel.Off;
this.witnessServer = string.Empty;
Database database1 = context.Server.Databases[databaseName];


There might be a problem in getting the information from the database collection. So do the following steps:

-Run the profiler to the when the execution of the command stops. (Guess it has to do something with the database name)
-Select the database name from the sysdatabases and post it here

SELECT Name, DATALENGTH(Name),LEN(Name) from sys.databases

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||

When i try to create a new view, in any of the databases i saw an error


Object reference not set to an instance of an object. (SQLEditors)


Program Location:

at System.Data.SqlClient.TdsParserStateObject.ReadStringWithEncoding(Int32 length, Encoding encoding, Boolean isPlp)
at System.Data.SqlClient.TdsParser.ReadSqlStringValue(SqlBuffer value, Byte type, Int32 length, Encoding encoding, Boolean isPlp, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.ReadSqlValue(SqlBuffer value, SqlMetaDataPriv md, Int32 length, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ReadColumnData()
at System.Data.SqlClient.SqlDataReader.ReadColumn(Int32 i, Boolean setTimeout)
at System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i)
at System.Data.SqlClient.SqlDataReader.GetValues(Object[] values)
at Microsoft.SqlServer.Management.Smo.DataProvider.SetConnectionAndQuery(ExecuteSql execSql, String query)
at Microsoft.SqlServer.Management.Smo.ExecuteSql.GetDataProvider(StringCollection query, Object con, StatementBuilder sb, RetriveMode rm)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.FillData(ResultType resultType, StringCollection sql, Object connectionInfo, StatementBuilder sb)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.FillDataWithUseFailure(SqlEnumResult sqlresult, ResultType resultType)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.BuildResult(EnumResult result)
at Microsoft.SqlServer.Management.Smo.DatabaseLevel.GetData(EnumResult res)
at Microsoft.SqlServer.Management.Smo.Environment.GetData()
at Microsoft.SqlServer.Management.Smo.Environment.GetData(Request req, Object ci)
at Microsoft.SqlServer.Management.Smo.Enumerator.GetData(Object connectionInfo, Request request)
at Microsoft.SqlServer.Management.Smo.ExecutionManager.GetEnumeratorDataReader(Request req)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.GetInitDataReader(String[] fields, OrderBy[] orderby)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ImplInitialize(String[] fields, OrderBy[] orderby)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.OnPropertyMissing(String propname)
at Microsoft.SqlServer.Management.Smo.Database.get_DefaultSchema()
at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDataDesignerNode.GetDefaultSchema(Server server, String databaseName)
at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDataDesignerNode.GenerateNewObjectUrn()
at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDataDesignerNode.SetObjectAndParentUrns(Urn originalUrn)
at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VirtualProjectNode..ctor(Urn urn, DocumentOptions options, IManagedConnection connection)
at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VirtualProjectNode.Allocate(Urn origUrn, DocumentType editorType, DocumentOptions options, IManagedConnection connection)
at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VirtualProject.Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con)
at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con)
at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.CreateDesignerWindow(IManagedConnection mc, DocumentOptions options)

I think that there is a problem with the server installation. I will try to reinstalle it.

|||If you want to solve the problem, follow the mentioned steps to reproduce the executed script on the server. That might also help others to solve their problems and help to improve the product itself.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de|||

Hi,

Please make sure the database exists and is not deleted by clicking refresh on the server node and see if you can still see the database whose properties you were not able to access. I believe the database was dropped by some other means and your SSMS window was not refreshed after that.

Hope this helps.

Thanks,

Sravanthi.

|||Stack trace dump means there might be a probelm with the Windows, a virus or mismatch of hotfix/service pack on operating system. Make sure to check what has been changed since this was working correctly in previous state, if not you might try testing the same on other machine.|||All databases are in place. i can open tables and see their data.|||

thats what i believe too.

The problem appears after an update from microsoft windows update which find that my windows sql server installation need the service pack 1 update. I selected and install it.

after that i download and install service pack 2 for sql server 2005 but of course this doesn't correct anything.

I have in the same computer a sqlserver express edition installed and from microsoft sql server managment studio i can work properly with this instance without a problem (in case i thought that was a problem from microsoft sql server managment studio).

About response from Jens K. Suessmeyer .

Whene i execute the line

SELECT 'AdventureWorks', DATALENGTH('AdventureWorks'),LEN('AdventureWorks') from sys.databases

i get

'An error occurred while executing batch. Error message is: Object reference not set to an instance of an object.'

with any database there are in this installation.


|||

Hi,

From where are you running the queries? Please run the query SELECT Name, DATALENGTH(Name),LEN(Name) from sys.databases (run it as is as Jens K. Suessmeyer has given, dont replace Name in the query, if you want it specific to AdventureWorks just add a where clause). Run this query from new query window in SSMS and let us know the output. From the error that you are getting "Object reference..." looks like you are trying to run the query programmatically. Just run it from a SSMS query window and let us know the output. Make sure the database that is causing all these issues comes up in the query result.

Sravanthi

|||If you believe its SSMS tools problem, try to reinstall them again.|||

All databases causing that issues

The result after executing the above query is

NAME (no column name) (no column name)

master 12 6
tempdb 12 6
model 10 5
msdb 8 4
ReportServer$MAIMOY2005 46 23
ReportServer$MAIMOY2005TempDB 58 29
BASE DE DATOS ORIGINAL 44 22
ALKI 8 4
aspnetdb_ALKI 26 13
AdventureWorks 28 14
AdventureWorksDW 32 16

(11 row(s) affected)

|||After a full uninstall and reinstall everything seems to work perfect. Aftes installation i install also service pack 2 downloaded and installed locally and everything works properly.|||

somehow, i missed this thread and I am sure if I could furnish this information bit earlier it would have been helpful. nevertheless, i think i should share my experience in this regards. the story is as follows :)

One of our development server had the same problem and I have documented this error. But at that time I was on the tows and somehow I was to get rid of this problem and I did the same trick - reinstalling the SQL Server. But I was not satisfied by this solution. when I did the postmortem of the process then I realized that our TL used to synchronies the Development database from Visio. There were many connection used to connect to different database (from visio) and one of them was to connect to master database. He used the master connection , and Visio automatically detects the objects in the connected database which are not there in the Model and it ask whether u want to delete those object or not. He selected Yes and Visio deleted all the objects from master database which are not there in the model. I verified the objects between two instances Master databases. There were five system tables missing , the missing tables were spt_fallback_db,spt_fallback_dev,spt_fallback_usg,spt_monitor,spt_value. Then I created the script of these tables from other instance and run on the problem server, but those tables were not having owner , though it shows owner as DBO. Actually these tables comes under System Tables tree but when I created these by the script those created as user table. I was pretty sure that these problem were because of these tables got deleted. But I was not having time to do R&D on this and I reinstalled the instance.

(a) How come Visio able to delete system tables (the irony is that , in SSMO these tables are shown as System Tables , but if u use sp_help it is shown as Usertable).

(b) IF somehow these tables got deleted, how can we restore these table and revert back to normal stage without reinstalling anything.

Also question to Antonisk, is something like this was happened in your side…

I think we need to dig out the root of this problem. If these tables are so critical , then these should not be deletable from anywhere. If it is a bug the we need to report this to MS..

Thanks for the time

Madhu

|||I don't use Visio at all. Also i can't check if this was the problem (system tables missing) because I reinstall the Sql Server.sql

No comments:

Post a Comment