Sakthi
Sakthi

Reputation: 103

Query to find the status of SQL Server

I want to know is there any query to know the status of the SQL Server.

In MySQL, we can use SHOW STATUS.. It will return the status..

mysql> SHOW STATUS;
+--------------------------+------------+
| Variable_name            | Value      |
+--------------------------+------------+
| Aborted_clients          | 0          |
| Aborted_connects         | 0          |
| Bytes_received           | 155372598  |
| Bytes_sent               | 1176560426 |
| Connections              | 30023      |
| Created_tmp_disk_tables  | 0          |
| Created_tmp_tables       | 8340       |
| Created_tmp_files        | 60         |
| Open_tables              | 1          |
| Open_files               | 2          |
| Open_streams             | 0          |
| Opened_tables            | 44600      |
| Questions                | 2026873    |
| Table_locks_immediate    | 1920382    |
| Table_locks_waited       | 0          |
| Threads_cached           | 0          |
| Threads_created          | 30022      |
| Threads_connected        | 1          |
| Threads_running          | 1          |
| Uptime                   | 80380      |
+--------------------------+------------+

Like this, any query for SQL Server..?

Upvotes: 2

Views: 392

Answers (4)

zloctb
zloctb

Reputation: 11184

mysqladmin status display a short server status message.

C:\Users\Dom>C:/xampp/mysql/bin/mysqladmin -uroot status
Uptime: 32  Threads: 1  Questions: 2  Slow queries: 0  Opens: 70  Flush tables:
1  Open tables: 63  Queries per second avg: 0.062

Upvotes: 0

Tarun Pushp
Tarun Pushp

Reputation: 11

You need to use different sys properities sys.databases, sys.sysprocesses etc

Upvotes: 1

Amarnath Balasubramanian
Amarnath Balasubramanian

Reputation: 9460

When you say "I need to know what are the queries running in the server and no. of connections, which query is taking too long. "

There is a DMV for this: sys.dm_exec_requests.

You can also refer this too

Note: You must have SQL 2005 or greater.

Upvotes: 0

Pepys
Pepys

Reputation: 991

Activity Monitor could be one of the options:

http://msdn.microsoft.com/en-us/library/cc879320.aspx

Executing stored procedure called sp_WhoIsActive could be another option. Here is the link to it: http://whoisactive.com

Upvotes: 0

Related Questions