user,group,or role 'test' already exists in the current database,error 15023,exists15023

來源:互聯網
上載者:User

user,group,or role 'test' already exists in the current database,error 15023,exists15023
目錄

  • 目錄
    • 報錯資訊
    • 解決方案
      • - 方法1
      • - 方法2

報錯資訊

解決方案- 方法1

先建立使用者帳戶,不進行授權,然後通過下面的SQL語句將該使用者帳戶關聯至對應的資料庫使用者。優點是避免了重新授權的操作。
USE {目標資料庫}
EXEC sp_change_users_login 'Update_One', '{目標資料庫已存在的使用者名稱}', '{建立的登入使用者名稱}'

- 方法2

在建立使用者帳戶(或者授權)之前,先在對應的資料庫中刪除該同名的使用者帳戶。

還原的資料庫的所有者是 孤立使用者
查詢分析器中 執行下面語句尋找出來孤立使用者
‘exec sp_change_users_login ‘Report ”

整理自網路

相關文章

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.