Sql-Server

SQL Server 錯誤“數據庫 ‘mssqlsystemresource’ 不存在。”

  • January 16, 2018

在 Linux 上,每當我執行use mssqlsystemresource以訪問Resource Database時,都會出現錯誤。我該如何解決這個問題。

1> use mssqlsystemresource
2> go
Msg 911, Level 16, State 1, Server x230, Line 1
Database 'mssqlsystemresource' does not exist. Make sure that the name is entered correctly.

當我嘗試sqlcmd使用 DAC ( admin:) 登錄時,使用目標數據庫-d

$ sqlcmd -I -S admin:localhost -U sa -d mssqlsystemresource -P Password0
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Cannot open database "mssqlsystemresource" requested by the login. The login failed..
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login failed for user 'sa'..

當我嘗試使用mssql-cli‘s登錄時-A,我得到

$ mssql-cli -A -d mssqlsystemresource
Username (press enter for sa): 
Password: 

Connection did not succeed.
Error message: Cannot open database "mssqlsystemresource" requested by the login. The login failed.
Login failed for user 'sa'.
Unable to connect. Please try again

mssqlsystemresource數據庫僅在單使用者模式下可用。在 Linux 上,這意味著

sudo systemctl stop mssql-server
sudo -u mssql /opt/mssql/bin/sqlservr -m

引用自:https://dba.stackexchange.com/questions/192955