Frequently Used Queries For Audit In Sql Server


There are various queries we want to identify some quick info about our servers. So this is collection of those queries.

These cant be directly copied as post size will be huge, so you can directly go to required link

  • When My SQL Login Password Last Reset (Click Here)
  • Who Is Connected Using DAC In SQL Server  (Click Here)
  • Sleeping Sessions in SQL Server from last 30 Mins (Click Here)

  • How To Find Size of All Databases In SQL Server (Click Here)
  • How To list files ,date and size inside a folder using SQL Server ( Click Here )
  • Script To Get Available And Free Disk Space From SQL Server (Click here)
  • List all pages of table in SQL Server (Click here)
  • Which SP_configure Options Require Reboot In SQL Server (Click here)
  • Script To Retrieve SQL Server Database Backup History (Click Here)

  • When SQL Server Evaluation Edition is Expiring ?? ( Click Here )
  • Find SQL Server Details Using Query Analyzer (Click Here)
  • How to find On Which Port SQL Server Is Running  ( Click Here )
  • How To view Registered SPN "Existing Service Principal Name" ( Click Here )
  • Find Version of Double-Take From Registry Using SQL Query ( Click Here )
  • Find "Last Checkdb Run For All Databases" in SQL server ( Click Here )
  • Find Database Restore History In SQL Server  ( Click Here )
  • Currently Running Queries on SQL Server (Click here)
  • SQL Server Job details (Click here)
  • Which Transaction Filling Log Space (Click here)


  • ALL SQL Server Details Using Query Analyzer ( Click Here )
  • Find SQL Server Hardware details using SQL Query ( Click Here )
  • When Table Data is Last accessed and Modified (Click Here)
  • When Column Was added in table in Sql server (Click Here)
  • Table Belongs to Which Databases (Click Here)


  • kill all SPID in Database or Multiple database (Click Here)
  • Fix Orphan user for all databases in SQL Server (Click Here)
  • Shrink all database files together (Click Here)
  • Script for Multiple Restore in SQL Server (Click Here)
  • Copy all files from one drive to other via SQL Server Script xp_cmdshell (Click Here)
  • Copy all files from one drive to other via SQL Server Script using Robocopy (Click Here)
  • Delete Transaction log file in SQL server (Click here)

  • List files ,date and size inside a folder using SQL Server (Click here)
  • Find Version of Double-Take From Registry Using SQL Query ( Click Here )



8 comments: