How to restore the database's account login name/username etc _mssql

Source: Internet
Author: User

When we reload the system, or reload the database, after attaching the database, we find that there is a username in the database, but there are no login names in SQL Server.

For example

First look at the username is the user name of his last system

Now let's go ahead and add this login name

Click Cancel

Go to Query Analyzer and select the database you want to repair

Sp_change_users_login ' This can query orphaned users under the current database

We only need to select the current database for you to fix the database and then run sp_change_users_login ' update_one ', ' username ', ' login '

The system prompts you to fix an orphaned user.

Users who refresh the database will see that the user name and login name correspond.

In addition to a little tip, sometimes LDF files will be very large this time, now you want to compress the database Query Analyzer inside

Inside the operation of the DUMP transaction databasename with NO_LOG, and then shrink the log file, the final result is 1024K

In addition: Modify the sqlserver2000 database port

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.