SQL default database deleted by mistake

Source: Internet
Author: User

I met today, and I solved it myself. This is what I summed up: (no matter where the post sank)
The SQL Server default database was deleted, the server could not be connected, and the user "" Login failed.
1, modify the default database for this user using the Administrator account.
Enterprise Manager, expand Server Groups, expand Servers, expand Security, click Logins, right-click the appropriate login account, and then reset the default database in properties.
When this account is the highest account, login is not possible, the security node is more unable to see.
↓↓↓↓↓↓↓↓↓↓↓↓
2. If no other administrator is logged in to the account and cannot be modified in Enterprise Manager, use the osql command-line tool:
The osql tool is a Microsoft Windows 32 command Prompt tool that you can use to run Transact-SQL statements and script files. The osql tool communicates with the server using the ODBC database application programming Interface (API).
Type cmd in Start-to-run, using "OSQL-?" command, you can display Help for the osql command line.
Note: The options list for the osql tool is case-sensitive and is noted when used.
osql/u "sa"/P "123"/d "master"/q "exec sp_defaultdb n ' sa ', n ' master '"/S "database service period name"

SQL default database deleted by mistake

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.