databasesql server

How to find total number of read/write on sql server databases

The following SQL will tell you  how many reads and writes the databases on your sql server instances has serviced :

SELECT
d.Name AS DatabaseName,
COUNT(c.connection_id) AS NumberOfConnections,
ISNULL(SUM(c.num_reads), 0) AS NumberOfReads,
ISNULL(SUM(c.num_writes), 0) AS NumberOfWrites
FROM sys.databases d
LEFT JOIN sys.sysprocesses s ON s.dbid = d.database_id
LEFT JOIN sys.dm_exec_connections c ON c.session_id = s.spid
WHERE (s.spid IS NULL OR c.session_id >= 51)
GROUP BY d.Name ;

Slick..eh ?  Using this you can find the read and write ratio on your databases