<< Click to Display Table of Contents >> Navigation: Monitoring Tools > checkdb > Usage |
Command Line Parameters
checkdb /u <USER> /p <PASS> /q <SQLQUERY> /c /l <DSN|ConnectionString>
DSN or Connection String |
DSN or connection string to connect to |
/u <USERNAME> |
Username to connect as (DSN only) |
/p <PASSWORD> |
Password for USERNAME (DSN only) |
/q <SQLQUERY> |
SQL query to execute upon successful connection |
/c |
Log all output to console |
/l |
Log all output to event log |
When using a connection string, both username and password need to be specified inside the connection string, the /u and /p options cannot be used. |
Examples
Example 1: Check whether the database defined in DSN EventSentry is available and log output to the console
checkdb /u eventsentry_web /p !$^&3jdk3 /c EventSentry
Example 2: Check whether the database defined in the connection string is available and log output to the event log
checkdb /l "driver={SQL Server};server=mssqlserver;Network=DBMSSOCN;database=EventSentry;uid=eventsentry_svc;pwd=1234"
Example 3: Check whether the database defined in DSN EventSentry is available, verify that the table ESEventlogLog exists and log output to the console and event log
checkdb /u eventsentry_web /p !$^&3jdk3 /q "select top 1 * from ESEventlogLog" /c /l EventSentry
Sample Output
C:\>checkdb /u eventsentry_web /p password /q "select top 1 * from ESEventlogLog" /c /l SQLSERVER
Connect : OK
DB Type : Microsoft SQL Server
Time : 1 second(s)
SQL Query: select top 1 * from ESEventlogLog -> OK
Example event from the event log