開啟記錄檔檢視器Open Log File Viewer

適用於: 是SQL Server 否Azure SQL Database 否Azure SQL 資料倉儲 否平行處理資料倉儲 APPLIES TO: yesSQL Server noAzure SQL Database noAzure SQL Data Warehouse noParallel Data Warehouse

您可以在 SQL Server Management StudioSQL Server Management Studio 中使用記錄檔檢視器,以存取下列記錄中所擷取之錯誤和事件的相關資訊:You can use Log File Viewer in SQL Server Management StudioSQL Server Management Studio to access information about errors and events that are captured in the following logs:

  • 稽核集合Audit Collection

  • 資料收集Data Collection

  • Database MailDatabase Mail

  • 作業記錄Job History

  • SQL ServerSQL Server

  • SQL Server AgentSQL Server Agent

  • Windows 事件 (這些 Windows 事件也可以從事件檢視器存取)。Windows events (These Windows events can also be accessed from Event Viewer.)

SQL Server 2012 (11.x)SQL Server 2012 (11.x)開始,您就可以使用 [已註冊的伺服器] 來檢視本機或遠端 SQL ServerSQL Server 執行個體的 SQL ServerSQL Server記錄檔。Beginning in SQL Server 2012 (11.x)SQL Server 2012 (11.x), you can use Registered Servers to view SQL ServerSQL Server log files from local or remote instances of SQL ServerSQL Server. 當這些執行個體在線上或離線時,您可以使用 [已註冊的伺服器] 來檢視記錄檔。By using Registered Servers, you can view the log files when the instances are either online or offline. 如需線上存取的詳細資訊,請參閱本主題稍後的<從已註冊的伺服器檢視線上記錄檔>程序。For more information about online access, see the procedure "To view online log files from Registered Servers" later in this topic. 如需如何存取離線 SQL ServerSQL Server 記錄檔的詳細資訊,請參閱 檢視離線記錄檔For more information about how to access offline SQL ServerSQL Server log files, see View Offline Log Files.

您可以用許多方式來開啟記錄檔檢視器,端視想要檢視的資訊而定。You can open Log File Viewer in several ways, depending on the information that you want to view.

權限Permissions

若要存取線上 SQL ServerSQL Server 執行個體的記錄檔,需要 securityadmin 固定伺服器角色的成員資格。To access log files for instances of SQL ServerSQL Server that are online, this requires membership in the securityadmin fixed server role.

若要存取離線 SQL ServerSQL Server 執行個體的記錄檔,您必須具有 Root\Microsoft\SqlServer\ComputerManagement10 WMI 命名空間以及儲存記錄檔之資料夾的讀取權限。To access log files for instances of SQL ServerSQL Server that are offline, you must have read access to both the Root\Microsoft\SqlServer\ComputerManagement10 WMI namespace, and to the folder where the log files are stored. 如需詳細資訊,請參閱 檢視離線記錄檔主題的<安全性>一節。For more information, see the Security section of the topic View Offline Log Files.

SecuritySecurity

需要 securityadmin 固定伺服器角色中的成員資格。Requires membership in the securityadmin fixed server role.

檢視記錄檔View Log Files

  1. 在物件總管中,展開 [管理] 。In Object Explorer, expand Management.

  2. 執行下列任一步驟:Do either of the following:

    • 以滑鼠右鍵按一下 [SQL Server 記錄檔] ,指向 [檢視] ,然後按一下 [SQL Server 記錄檔] 或 [SQL Server 與 Windows 記錄檔] 。Right-click SQL Server Logs, point to View, and then click either SQL Server Log or SQL Server and Windows Log.

    • 展開 [SQL Server 記錄檔] ,以滑鼠右鍵按一下任何記錄檔,然後按一下 [檢視 SQL Server 記錄檔] 。Expand SQL Server Logs, right-click any log file, and then click View SQL Server Log. 您也可以按兩下任何記錄檔。You can also double-click any log file.

    這些記錄檔包含 [Database Mail] 、[SQL Server] 、[SQL Server Agent] 和 [Windows NT] 。The logs include Database Mail, SQL Server, SQL Server Agent, and Windows NT.

  • 在物件總管中,展開 [SQL Server Agent] ,以滑鼠右鍵按一下 [作業] ,然後按一下 [檢視記錄] 。In Object Explorer, expand SQL Server Agent, right-click Jobs, and then click View History.

    這些記錄檔包含 [Database Mail] 、[作業記錄] 和 [SQL Server Agent] 。The logs include Database Mail, Job History, and SQL Server Agent.

  • 在物件總管中,展開 [管理] ,以滑鼠右鍵按一下 [維護計畫] ,然後按一下 [檢視記錄] 。In Object Explorer, expand Management, right-click Maintenance Plans, and then click View History.

    這些記錄檔包含 [Database Mail] 、[作業記錄] 、[維護計畫] 、[遠端維護計畫] 和 [SQL Server Agent] 。The logs include Database Mail, Job History, Maintenance Plans, Remote Maintenance Plans, and SQL Server Agent.

  • 在物件總管中,展開 [管理] ,以滑鼠右鍵按一下 [資料收集] ,然後按一下 [檢視記錄] 。In Object Explorer, expand Management, right-click Data Collection, and then click View Logs.

    這些記錄檔包含 [資料收集] 、[作業記錄] 和 [SQL Server Agent] 。The logs include Data Collection, Job History, and SQL Server Agent.

  • 在物件總管中,展開 [管理] ,以滑鼠右鍵按一下 [Database Mail] ,然後按一下 [檢視 Database Mail 記錄] 。In Object Explorer, expand Management, right-click Database Mail, and then click View Database Mail Log.

    這些記錄檔包含 [Database Mail]、[作業記錄] 、[維護計畫] 、[遠端維護計畫] 、[SQL Server] 、[SQL Server Agent] 和 [Windows NT] 。The logs include Database Mail, Job History, Maintenance Plans, Remote Maintenance Plans, SQL Server, SQL Server Agent, and Windows NT.

  • 在物件總管中,依序展開 [安全性] 和 [稽核] ,以滑鼠右鍵按一下稽核,然後按一下 [檢視稽核記錄] 。In Object Explorer, expand Security, expand Audits, right-click an audit, and then click View Audit Logs.

    這些記錄檔包含 [稽核收集] 和 [Windows NT] 。The logs include Audit Collection and Windows NT.

  • 在物件總管中,依序展開 [安全性] 和 [稽核] ,以滑鼠右鍵按一下稽核,然後按一下 [檢視稽核記錄] 。In Object Explorer, expand Security, expand Audits, right-click an audit, and then click View Audit Logs.

    這些記錄檔包含 [稽核收集] 和 [Windows NT] 。The logs include Audit Collection and Windows NT.

另請參閱See Also

記錄檔檢視器 Log File Viewer
SQL Server Audit (Database Engine) SQL Server Audit (Database Engine)
檢視離線記錄檔View Offline Log Files