SQL Server index related dynamic management views and functions

Microsoft SQL Server provides DBAs and Developers with several index related dynamic management views and functions, which they can use to maintain, modify, tune and identify missing indexes. Some of these dynamic management views (DMVs) and functions (DMFs) you might use are listed as follow:

  • sys.dm_db_index_operational_stats — Returns information about low level input/output (I/O) operations, locking and latching contention, and access methods.
  • sys.dm_db_index_usage_stats — Returns an index operations count, identifying operations performed and the last time each operation was performed.
  • sys.dm_db_index_physical_stats — Returns information about table and index size and fragmentation, including both in-row and LOB data.
  • sys.dm_db_missing_index_details — Returns detailed information about missing indexes, including the table, columns used in equality operations, columns used in inequality operations, and columns used in include operations.
  • sys.dm_db_missing_index_group_stats — Returns information about groups of missing indexes, which SQL Server updates with each query execution (not based on query compilation or recompilation).
  • sys.dm_db_missing_index_groups — Returns information about missing indexes contained in a missing index group.

How to Find SQL Server Started date & Time – 4 Scripts to Find SQL Server Started Time

There  are so many way of finding the sql server started date time.

1. SQL Server Log

2.  using DMV

3. Using TempDB Creation date (as it is recreated when SQL Server is started every time)

4. Start Time of Default Trace

Examples : 

1. SQL Server Log :

SQL Server Management Studio –> Management –> SQL Server Logs –> We need to Search for the “SQL SERVER Starting….Image


 sp_readerrorlog 0,1,’Copyright (c)’




2. Using DMV :

SELECT sqlserver_start_time FROM sys.dm_os_sys_info;


3. Using TempDb Creation Date

select crdate from sys.sysdatabases where name=’tempdb’

4. Default Trace :


SELECT login_time FROM sys.dm_exec_sessions WHERE session_id = 1;



SQL SERVER 2012 System Databases

  • Master
    • Purpose – Core system database to manage the SQL Server instance.  In SQL Server 2005, the Master database is the logical repository for the system objects residing in the sys schema.  In SQL Server 2000 and previous editions of SQL Server, the Master database physically stored all of the system objects.
    • Functionality
      • Instance configurations
      • Databases residing on the instance
      • Files for each database
      • Logins
      • Linked\Remote servers
      • Endpoints
  • MSSQLResource
    • Purpose – The Resource database is responsible for physically storing all of the SQL Server 2005 system objects. This database has been created to improve the upgrade and rollback of SQL Server system objects with the ability to overwrite only this database.
    • Prominent Functionality
      • System object definition
    • Additional Information
      • Introduced in SQL Server 2005 to help manage the upgrade and rollback of system objects
      • Prior to SQL Server 2005 the system related data was stored in the master database
      • Read-only database that is not accessible via the SQL Server 2005 tool set
      • The database ID for the Resource database is 32767
      • The Resource database does not have an entry in master.sys.databases
  • TempDB
    • Purpose – Temporary database to store temporary tables (#temptable or ##temptale), table variables, cursors, work tables, row versioning, create or rebuild indexes sorted in TempDB, etc. Each time the SQL Server instance is restarted all objects in this database are destroyed, so permanent objects cannot be created in this database.
    • Prominent Functionality
      • Manage temporary objects listed in the purpose above
    • Additional Information
      • Each time a SQL Server instance is rebooted, the TempDB database is reset to its original state
  • Model
    • Purpose – Template database for all user defined databases
    • Prominent Functionality
      • Objects
      • Columns
      • Users
  • MSDB
    • Purpose – Primary database to manage the SQL Server Agent configurations
    • Prominent Functionality
      • SQL Server Agent Jobs, Operators and Alerts
      • DTS Package storage in SQL Server 7.0 and 2000
      • SSIS Package storage in SQL Server 2005
  • Distribution
    • Purpose – Primary data to support SQL Server replication
    • Prominent Functionality
      • Database responsible for the replication meta data
      • Supports the data for transaction replication between the publisher and subscriber(s)
  • ReportServer
    • Purpose – Primary database for Reporting Services to store the meta data and object definitions
    • Prominent Functionality
      • Reports security
      • Job schedules and running jobs
      • Report notifications
      • Report execution history
  • ReportServerTempDB
    • Purpose – Temporary storage for Reporting Services
    • Prominent Functionality
      • Session information
      • Cache