① sql創建用戶對象失敗,該怎麼解決
原因:
sql server中「登錄」與「用戶」的區別,「登錄」用於用戶身份驗證,而資料庫「用戶」帳戶用於資料庫訪問和許可權驗證。登錄通過安全識別符 (SID) 與用戶關聯。將資料庫恢復到其他伺服器時,資料庫中包含一組用戶和許可權,但可能沒有相應的登錄或者登錄所關聯的用戶可能不是相同的用戶。這種情況被稱為存在「孤立用戶」。 此時是不能通過新建登錄或者是對同名登錄授予對應資料庫的「用戶」許可權來解決登錄問題,因為SQL Server會報出「錯誤15023:當前資料庫中已存在用戶或角色」
解決:
為了解決這個問題,需要調用系統存儲過程sp_change_users_login,具體用法如下:
Use Northwind
Go
sp_change_users_login 'update_one', 'test', 'test'
其中Northwind為存在孤立用戶的資料庫,update_one是存儲過程的參數,表示只處理一個用戶,前一個test是「用戶」,後一個test是「登錄」,以上這個SQL表示將伺服器登錄「test」與 Northwind 資料庫用戶「test」重新連接起來。這樣就可以正常使用資料庫了。
② 在sql server 中新添加的用戶,登錄失敗。錯誤:18456
如果是本地資料庫可以用windows驗證
打開microsoft
sql
server
management
studio
express,右鍵點擊伺服器,選擇properties,在彈出窗口中點擊security切換到安全面板,將server
authentication伺服器認證從windows
authentication
mode(windows用戶認證模式)修改為sql
server
and
windows
authentication
mode(sql
server和windows認證模式),ok。
添加用戶:
打開你的microsoft
sql
server
management
studio
express
先用sa連接你的資料庫.
然後在管理器中點擊security(安全性)--logins(用戶)--右鍵--new
logins(新用戶)
在彈出的窗口中輸入用戶名
然後勾選單選框為"sql
server
驗證"
輸入用戶密碼.
然後在窗口的右邊選擇server
roles(用戶角色)
將public與sysadmin勾上.
點擊ok,添加完成.
③ sql server用sql添加角色成員出錯!
將MH_Happy用戶添加到MyRole角色中應該這樣寫:
EXEC sp_addrolemember MyRole,MH_Happy
④ sql把資料庫角色許可權賦值是出錯
角色管理:
--創建角色 r_test
EXEC sp_addrole 'r_test'
--授予 r_test 對 jobs
表的所有許可權
GRANT ALL ON jobs TO r_test
--授予角色 r_test 對 titles 表的 SELECT
許可權
GRANT SELECT ON titles TO r_test
--添加登錄
l_test,設置密碼為pwd,默認資料庫為pubs
EXEC sp_addlogin
'l_test','pwd','pubs'
--為登錄 l_test 在資料庫 pubs 中添加安全賬戶 u_test
EXEC
sp_grantdbaccess 'l_test','u_test'
--添加 u_test 為角色 r_test 的成員
EXEC
sp_addrolemember 'r_test','u_test'
⑤ 在sql server 中新添加的用戶,登錄失敗。錯誤:18456
如果是本地資料庫可以用windows驗證
打開microsoft
sql
server
management
studio
express,右鍵點擊伺服器,選擇properties,在彈出窗口中點擊security切換到安全面板,將server
authentication伺服器認證從windows
authentication
mode(windows用戶認證模式)修改為sql
server
and
windows
authentication
mode(sql
server和windows認證模式),ok。
添加用戶:
打開你的microsoft
sql
server
management
studio
express
先用sa連接你的資料庫.
然後在管理器中點擊security(安全性)--logins(用戶)--右鍵--new
logins(新用戶)
在彈出的窗口中輸入用戶名
然後勾選單選框為"sql
server
驗證"
輸入用戶密碼.
然後在窗口的右邊選擇server
roles(用戶角色)
將public與sysadmin勾上.
點擊ok,添加完成.
⑥ SQL語句將登陸添加到伺服器角色列表老是顯示錯誤
資料庫是2012么?
⑦ oracle SQL developer 視圖創建角色的時候出現錯誤,怎麼解決
看看這段:
當我們在CDB中使用傳統方式創建用戶會遇到錯誤
sys@LUOCS12C> create user luocs identified by oracle default tablespace luocs;
create user luocs identified by oracle default tablespace luocs
*
ERROR at line 1:
ORA-65096: invalid common user or role name
sys@LUOCS12C> !oerr ora 65096
65096, 00000, "invalid common user or role name"
// *Cause: An attempt was made to create a common user or role with a name
// that wass not valid for common users or roles. In addition to
// the usual rules for user and role names, common user and role
// names must start with C## or c## and consist only of ASCII
// characters.
// *Action: Specify a valid common user or role name.
//
根據錯誤提示了解,在CDB中用戶得以C##開頭,如下:
sys@LUOCS12C> create user c##luocs identified by oracle default tablespace luocs;
User created.
⑧ 為什麼SQL資料庫創建用戶失敗 有圖 請懂的來幫幫忙
可能是你資料庫里沒有sp_addlogin,可以網路找下自己恢復或在其他地方復制一個過來。。。