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, resolving and proactively working to prevent performance or oth

SQL Server 2016 Windows Server 2016 Firewall Rule Step-By-Step.

SQL Server 2016 Windows Server 2016 Firewall Rule Step-By-Step. Opening Firewall in SQL Server 2016. Once the SQL Server is installed on the machine. We must enable the incoming traffic i.e., from the application to the SQL Server Database. For this purpose, we must create rule for SQL Server ports so that the application can connect to database & perform the CRUD operations on the tables. Now Let’s start Step-by-Step to enable it. 1.   Start System and Login (As Administrator); 2.   Open Control Panel. Click on Windows Firewall; 3. Now click on Advanced Settings; 4. Windows Firewall console open. If you click on Properties (right side) – you can disable firewall for all networks. We going to Inbound Rules (left side) for our rule creation; After Clicking on the Inbound rules. We will see the below screen.  Click on New

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, Active Transaction.  When ever there is status as Activ