Unable to open user default database login failed __ Database

Source: Internet
Author: User
Tags knowledge base

Unable to open the user default database, logon failed, which is one of the problems that SQL Server users are familiar with. When using Enterprise Manager, Query Analyzer, various kinds of tools and application software, as long as the connection to the SQL Server database, it is possible to encounter this problem, causing this error occurred more than the reason, let us analyze the cause of the problem and the solution.

First, why
The default database for the login account is deleted.

Second, the solution:
(a), using the Administrator account to modify the default database for this account
1, open Enterprise Manager, expand the server group, and then expand the server
2. Expand "Security", expand Login, right-click the corresponding login account, select from the pop-up menu, properties
3. Re-select the default database for this login account

--No login, no security node seems to be able to open.


(b), if there is no other administrator login account, can not be modified in Enterprise Manager, using the isql command line tool
isql/u "sa"/P "sa password"/d "master"//"EXEC sp_defaultdb n ' sa ', n ' master '"
If you use Windows authentication method, use the following command:
isql/e/d "Master"/q "exec sp_defaultdb n ' builtin/administrators ', n ' master '"


Reference: Microsoft Chinese Knowledge Base article: How to troubleshoot connection problems in SQL Server 2000
Address: http://support.microsoft.com/default.aspx?scid=kb; zh-cn;827422

------------
This error generally occurs as follows:

Import a database into the MS SQL database, in Enterprise Manager, all Tasks-> restore the database-> Select Restore from device, locate the database file "Xxx.db", import.
Error: Device activation errors, please use the WITH MOVE option to flag the valid location of the file.

Workaround: Right-click Database (Note that is not a particular database)-> All Tasks-> Restore the database-> Select Restore from Device, select the name of the database you want to revert to, and then in the tab, select the mandatory restore database on the existing database. Then in the following changes to the physical path of the database restore, this path if there is a path, otherwise there will be the above error, logical file name can not be changed.

--------------

is available only if you are logged on by a user with a different default database. [--default database for individual users]

Edit SQL Server registration, change to SQL Server authentication, and log on with SA the default database for the

SA can be detached-> SQL Server.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.