我通過運行PowerShell腳本從.bak
文件恢復數據庫。今天,當我試圖用「Reports」檢查數據庫時,我發現它已被禁用。見截圖:在SQL Server中禁用數據庫報告選項
不太清楚是否有什麼毛病我來恢復數據庫的腳本,但在這裏它是:
$restoredDbName = "dbx"
[string] $dbCommand = "RESTORE DATABASE [$($restoredDbName)] " +
"FROM DISK = N'$($bakFilePath)' " +
"WITH FILE = 1," +
"MOVE N'$($fileLogicalName)' TO N'$($restorePathD)\$($restoredDbName).mdf'," +
"MOVE N'$($fileLogicalName)_Log' TO N'$($restorePathD)\$($restoredDbName)_Log.ldf',"
if($bakFilename.Contains("xyz")) {
$dbCommand += "MOVE N'abc' TO N'$($restorePathD)\$($restoredDbName).ndf',"
}
$dbCommand += "NOUNLOAD, REPLACE, STATS = 1"
你是否確實沒有權限問題?您是否嘗試使用具有系統管理員權限('sa')的用戶連接到服務器以檢查問題是否仍然存在? –
我試過'sa',但仍然不能正常工作... – user1888955
您使用的是什麼版本的SSMS? – supergrady