Cannot open database "database" requested by the login. The login failed. Login failed for user 'user'
Tech-Today

Cannot open database "database" requested by the login. The login failed. Login failed for user 'user'


Often you will encounter this error if you are restoring a database from one machine into another.

What causes the error:
On a full backup of the database, it includes all the objects within it like tables, views, procedures, etc and also the users.

So when we restore the database on another machine, and the user is not on that machine. Or if it is there, the mapping would be deleted.

What to do:

1.) Execute this:
exec sp_revokedbaccess 'username'
http://msdn.microsoft.com/en-us/library/ms188909.aspx
This would delete the carried user in the database

2.) Now open your MSSQL Server Managerment Studio

3.) Click Security->Logins

4.) Right click the "user" click Properties, and in the "User Mapping" tab click the appropriate rights that we want the user to have for the database chosen




- How To Install Mysql In Ubuntu 16.04
The following commands allow us to install a MySQL server on Ubuntu 16.04, create a database, user and table. And finally, tune the server. # install mysql sudo apt-get update sudo apt-get upgrade sudo apt-get install mysql-server sudo mysql_secure_installation...

- Database Diagram Support Objects Cannot Be Installed Because This Database Does Not Have A Valid Owner
I encountered the error below when creating a diagram in the Management Studio. "Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog...

- Mssql Generate Script To Create A Database Schema Only
I want to duplicate my database schema, but I do not want to copy the data contents. There are 3rd party tools which I can use to achieve the same result. But I prefer to use the Microsoft SQL Server Management Studio. To do so: 1.) Open Microsoft SQL...

- Setting Mssql Server 2005 Table 2000 Compatible
Recently I was developing a c# application that uses sqlserver2005 database (express edition) setup on my laptop which has win7 os. The problem is the public server where I will deploy the application is only running a mssql server 2000 database. My application...

- How To Allow Remote Connection In Mssql Server, And Allowing Sql Server Authentication In The Registry
Problem: If the MSSql Server is not properly configured it usually gives named pipes error like "error 1326" and so on. There are 3 simple things that we have to set to allow remote connection on an mssql server: 1.) Make sure that the server itself accepts...



Tech-Today








.