Skip to main content

SQL Server DMV's

Dynamic Managment Views
sys.dm_db_mirroring_connections - connection id, connect time,total bytes sent and received etc.
sys.dm_db_missing_index_details – to find out missing index.
sys.dm_exec_requests - Returns information about each request that is executing within SQL Server like: - transaction ID, session id, blocking process, open transactions count and many more.
Select * from sys.sysprocesses to get blocking information’s.
 sys.dm_os_cluster_nodes - This view returns a row for each node in the failover cluster instance configuration. If the current instance is a failover clustered instance, it returns a list of nodes on which this failover cluster instance (formerly ‘virtual server’) has been defined. If the current server instance is not a failover clustered instance, it returns an empty row set.
sys.dm_os_hosts - Returns all the hosts currently registered in an instance of SQL Server.
sys.dm_os_memory_clerks - This DMV will help how much memory SQL Server has allocated through AWE
sys.dm_db_file_space_usage - This DMV provides the space usage information of TEMPDB database.
sys.dm_db_session_space_usage - This DMV provides the number of pages allocated and de-allocated by each session for the database
sys.dm_db_index_usage_stats - This DMV is used to get useful information about the index usage, for all objects in all databases. This also shows the date and time of seeks and scan for each index, date and time of usage of index.
select * from sys.dm_db_index_usage_stats where database_id=db_id('test') and object_id=object_id('reporting.abc'): this query gives information’s about the date and time of last user seek, last user scan, last user update and many more info.
sys.dm_exec_connections - This DMV shows all the connection to SQL Server.
Sys.dm_db_index_physical_stats (dbid,null,null,null,null)it gives information about index stats like fragmentation etc.
sys.dm_os_buffer_descriptors :- Which object is taking largest amount in buffer pool
sys.dm_db_task_space_usage : - to find out which task is consuming more space in tempdb
SYS.DM_OS_SYS_INFO : - to find out memroy details, gives the information when SQL Server started in SQL 2008.
sys.dm_exec_query_stat - The query against sys.dm_exec_query_stats is an efficient way to determine which query is using the most cumulative CPU.
select * from sys.dm_exec_sql_text(sql_handle) – sql handle is the hash value of sql text. It returns the exact sql statement that executed.

Comments

Popular posts from this blog

Self Introduction and Responsibilities of a SQL Server DBA.

Hi, Self Introduction:                      I am Vang chew bigger , currently I am working with   Citronics , Here my role is SQL Server Database Administrator , I am having 3+ yrs Exp in SQL SERVER DBA with T-SQL, I have experience on SQL Server 2000, 2005 and 2008, I have a great experience on installation and configuration of SQL SERVER versions, and also applying the patches, hot fix, services packs and RTM’s accordingly, involved in upgrading on in place and side by side as per client requirement, and also Migrating the database on SQL SERVER 2000 to 2005 and 2008, Solid experience on configuring and maintenance of High availability SQL Server solutions, including Log shipping, Database Mirroring, Replication(Transactional and Merge) and SQL Server Clustering., having experience on performance tuning on server level, database level and query level, Responsible for working with application developers in identifying,...

Shrinking a SQL Server Log File with Database in Always ON Availability.

Shrinking a SQL Server Log File with Database in Always ON Availability.                    Once we had a situation in our production server that the database which is in Always ON Availability group has been grown to the maximum size.  Many of them say that we can't shrink the log file as the database is in Always ON and we should take the downtime to perform the operation. But we shrink-ed the database log file to 5 GB from 180 GB. Steps are as below: --To Check the Number of pages allocated by the LogFile. DBCC LOGINFO --To check the file sixe sp_helpdb [SQLPantry] --To check the Log file Size DBCC SQLPERF(LOGSPACE) The above statement will show the logspace of all db at present situation. --To check the Log_reuse_wait description of a log file. select log_reuse_wait_desc,* from sys.databases The above statement will show the status of the log whether it has to be backuped i.e., LogBackup, Nothing, Ac...

SQL Server 2022 Features in Detail.

SQL Server 2022 Features in Detail. 1. Data Virtualization: Data virtualization in SQL Server 2022 enables you to access and query data from various sources as if they were part of a single database. This eliminates the need for complex data integration processes and allows for seamless querying of distributed data. 2. Machine Learning Services Enhancements: SQL Server 2022 offers enhanced integration with machine learning frameworks like TensorFlow and PyTorch. This enables you to train and deploy machine learning models directly within the database, bringing AI-driven insights closer to the data. 3. Improved Security: The Data Discovery and Classification capabilities in SQL Server 2022 help identify sensitive data and apply appropriate security measures. Always Encrypted technology ensures that sensitive data remains encrypted in various scenarios. 4. Big Data Clusters: Big data clusters allow you to manage and query large datasets across SQL Server, Hadoop, and Spark clusters. This...