.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

model database is not accessible - how can I fix this?

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :


I came into work this morning to discover some problems with an application that uses our SQL Server database. After checking the event viewer, the error messages suggested that the when the application was trying to connect to the database, the login for the 'sa' user failed (the 'sa' user and password seems to be stored in a web config file that is used by the application to connect to the SQL Server database. So I then tried and failed to connect to SQL Server through SQL Server Management Studio as the 'sa' login. The error message says that:

a connection was successfully established with the server but then an error occurred during the login process. (provider: Shared memory provider, error: 0 - no process is on the other end of the pipe). (Microsoft SQL Server, error: 233)

If I login to SQL Server Management Studio with another login and look at the properties for the 'sa' login, when I go to the user mapping bit I get an error message saying that one or more databases are unavailable (the model database) and it can't be added to the list. After clicking 'ok' to close the error message, the user mapping for the 'sa' login says that the 'sa' login isn't mapped to any databases. So I'm guessing this is why I can't connect to SQL Server with the 'sa' login.

In SQL Server Management Studio if I then go to Databases>

View Complete Post

More Related Resource Links

Entity Data Model and database view returning the same columns as there are in a table


When adding a stored procedure into the Entity Data Model I can select whether the procedure returns a scalar, a (new) complex type or one of the entity types I already defined. 

How do I do something similar for a view?

I mean assuming I have a view like this

CREATE VIEW FilteredFoos as SELECT Foo.* FROM Foo join ... WHERE ...

(that is a view that implements some involved filtering, but returns all columns from one table) how do I add it to the project so that I can use the entity set, but get the Foo objects, not some new FilteredFoo objects.

var foos = myDB.FilteredFoos.Include("Bar").ToList();

foreach (Foo foo in foos) { ...

Thanks, Jenda

EF - How to change database used by model

I created an Entity Frameworks model (.edmx). Now, I want to change the database that my model is using. How do I do that? Just change the connection string in the .edmx Properties, or is there more that is required?

Database Switched to Simple Recovery Model


Hi there,

We came across a situation where the transaction log was full and we extended the disk that holds the transaction log. What happened after that is the log truncated and we noticed the recovery model of the database switched from FULL to SIMPLE. Does anyone come across this behaviour?

Thanks in advance.


Yong Hwee

Can I create an ADO.NET Entity Data Model for a MySQL database using Visual Web Express 2010?


Can I create  an  ADO.NET Entity Data Model for a MySQL database using Visual Web Express 2010?

If yes, are there any documentation or tutorials?


How do you create a ADO.NET Entity Data Model for a MySQL database using Visual Web Express 2010?


Can I create a ADO.Net Entity Data Model for a MySql(5.0.1) Database using a Visual Web Express 2010? If yes, can anyone please let me know how to do this.

sql server will not start - Database 'model' cannot be opened. It is in the middle of a restore.

Sql server service will not start after server reboot:

2009-08-13 14:15:43.94 spid7s      SQL Trace ID 1 was started by login "sa".
2009-08-13 14:15:43.97 spid7s      Starting up database 'mssqlsystemresource'.
2009-08-13 14:15:43.97 spid7s      The resource database build version is 10.00.1600. This is an informational message only. No user action is required.
2009-08-13 14:15:44.30 Server      A self-generated certificate was successfully loaded for encryption.
2009-08-13 14:15:44.30 spid7s      Server name is 'WIN-37R9WFWAJIB\MSDB1'. This is an informational message only. No user action is required.
2009-08-13 14:15:44.32 spid10s     Starting up database 'model'.
2009-08-13 14:15:44.32 Server      Server is listening on [ 'any' <ipv6> 49167].
2009-08-13 14:15:44.33 Server      Server is listening on [ 'any' <ipv4> 49167].
2009-08-13 14:15:44.33 Server      Server local connection provider is ready to accept connection on [ \\.\pipe\SQLLocal\MSDB1 ].
2009-08-13 14:15:44.33 Server      Server named pipe provider is ready to accept connection on [ \\.\pipe\sql\query ].
2009-08-13 14:15:44.35 spid10s     The database 'model' is marked RESTORING and is in a state that does not allow recovery to be run.
2009-08-13 14:15:44.38 Server      Server is listening on [ ::1 <ipv6> 491

sql server will not start - Database 'model' cannot be opened


I just ran into this problem.  I've seen other posts and have ran the net start MSSQL$MYDBNAME /c /m /T3600 command to which is responds service is starting and service was started successfully.

However when I run sqlcmd -e it doesn't work.  I get a Named Pipes Provider: error.  I'm on the actual server where this instance has been installed.  I don't think I need named_pipes as we use tcpip.

If I look in services it still shows the service as down.

This is SQL Server 2008 R2 on Windows Data Center 2008 R2.

Any tips?

Populate entity data model from database


I've been using entity data models for quite a few sections of my website and find it really good for saving things to the database.

After searching for a while, I can't seem to find a good way to populate a new instance with data from a database other than using a data reader. E.G:

MyClass.myID = reader("myID")

Am I missing something?

Differences between SQL Server database definition and dynamyc data .edmx model


I am trying to customize a ForeignKey_Edit under a different name but I am having a problem with this: If I am listing one of the entities I have 4 columns that appear as links. My guess is that they are the Foreign Keys because they are the same fields listed as DropDownLists on top of the page.

One of this fields is the one I am trying to customize but if I use the UIHint attribute or property I got an error message saying that the columns can't be used as a Foreign Key because it isn't  a Foreign Key, but it is.

I have checked the database definition and in it the column appears as Foreign Key but in the Dynamic Data .edmx model appears as a simple field because it doesn't show the small key on the left icon. Only primary keys have the key.

Is this a bug or am I going the wrong direction?


Perform database operations in data entity model


hi ..

i want to know how to perform database operations link inser,update,delete in data entity model using ado.net data entity model(.edmx)

i was follow the instructions from asp.net site this link
http://www.asp.net/aspnet-in-net-35-sp1/videos/getting-started-with-dynamic-data and i succesfully created .edmx file and i run the

project it load all my table and if i selects a particular table it shows the details of my table..

but i want to perform insert,delete and update operations..i want to put a page and perform this sample operations using edmx..i dont know how to do this operations.

how to do this...
need ur suggestions..

explain me with suitable examples using c# for(.edmx)..


Is it possible to export a database model from visio to Sql Server 2005?


Hi there,

I cannot seem to find a way to export a database model from Visio to Sql Server.

Can somebody provide a walkthrough how to export it?


Thanks a lot

Model database locked


I asked poeple at my place to use a written stored procedure to create databases rather than use the SSMS GUI.  However, since a while, I see some lock occuring on the database model which prevents further creation of databases.

I wonder what might be the source of those lock?

Not sure the issue is related to the procedure, all it does is some validations of the parameters, creation and alter of the database followed by a backup of master db.  The code to create and alter the database is taken directly out the the "script" button when using the GUI to create a new database with the exception of a few alter db which I discarded.

Anybody has an idea what may be the source of lingering locks on model database?  Am I interfering in the process by altering databses right after their creation or something?

The process creating the lock is from has "SYSTEM" as nt_username and seems to be reading the growth / autogrowth settings of the model database.  When outputing the input buffer:

(SET NOCOUNT ON  SELECT size / 128.0 as fileSize,  file_id as fileId,  FILEPROPERTY(name, 'SpaceUsed') / 128.0 as fileUsed,  CASE WHEN max_size = -1 OR max_size = 268435456 THEN -1 ELSE max_size / 128 END as fileMaxSize,  CASE WHEN growth = 0 THEN 0 ELSE 1 END as IsAutoGrow,  is_

Is a database online when it is changed from full to simple recovery model?



We have some databases that occaisally have very large ldf files and I have learned that the best way to shrink the ldf file is to change the backup mode to simple, shrink the log file, convert it back to full and do a full database backup so that the log file backups will run again. My question is during this process is the database available to the end users? When you guys do this do you feel it is nessesary to let the end users know or will they not notice what is going on?



Thanks! Kevin

Multiple database support with Entity Framework

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

Export Visio Database Table Names to Excel

If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend