A SQL Query to find database files

 1 SELECT
 2 DB_NAME(mf.database_id) AS databaseName,
 3 name as File_LogicalName,
 4 case
 5 when type_desc = ‘LOG‘ then ‘Log File‘
 6 when type_desc = ‘ROWS‘ then ‘Data File‘
 7 Else type_desc
 8 end as File_type_desc
 9 ,mf.physical_name
10 ,num_of_reads
11 ,num_of_bytes_read
12 ,io_stall_read_ms
13 ,num_of_writes
14 ,num_of_bytes_written
15 ,io_stall_write_ms
16 ,io_stall
17 ,size_on_disk_bytes
18 ,size_on_disk_bytes/ 1024 as size_on_disk_KB
19 ,size_on_disk_bytes/ 1024 / 1024 as size_on_disk_MB
20 ,size_on_disk_bytes/ 1024 / 1024 / 1024 as size_on_disk_GB
21 FROM sys.dm_io_virtual_file_stats(NULL, NULL) AS divfs
22 JOIN sys.master_files AS mf ON mf.database_id = divfs.database_id
23 AND mf.file_id = divfs.file_id
24 ORDER BY size_on_disk_MB DESC

A SQL Query to find database files

时间: 2024-10-05 13:19:02

A SQL Query to find database files的相关文章

Entity Framework Tutorial Basics(39):Raw SQL Query

Execute Native SQL Query You can execute native raw SQL query against the database using DBContext. You can execute the following types of queries: SQL query for entity types which returns particular types of entities SQL query for non-entity types w

使用 Oracle GoldenGate 在 Microsoft SQL Server 和 Oracle Database 之间复制事务

使用 Oracle GoldenGate 在 Microsoft SQL Server 和 Oracle Database 之间复制事务 作者:Nikolay Manchev 分步构建一个跨这些平台的简单事务复制示例. 2011 年 8 月发布 大多数关注数据复制的 Oracle 技术专家都熟悉 Oracle Streams.在 2009 年之前,Streams 一直是推荐使用的最流行的 Oracle 数据分发技术. 2009 年 7 月,Oracle 收购了 GoldenGate 这一数据库复

Mysql错误:Ignoring query to other database解决方法

今天登陆mysql show databases出现Ignoring query to other database错误,又试了几个命令和sql全部提示Ignoring query to other database错误 错误如下: D:\Program Files\MySQL\MySQL Server 5.6\bin>mysql -rootWelcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection

mariadb报Ignoring query to other database解决方法

问题描述,今天登陆mariadb时,发现任何sql语句不能执行,报以下错误 MariaDB [(none)]> show databases; Ignoring query to other database MariaDB [(none)]> show tables; Ignoring query to other database MariaDB [(none)]> select database(); Ignoring query to other database 折腾了好长时间

How to perform a SQL query for fields that are null (or not null)

Okay, maybe this is lame, but when I've been away from writing SQL database queries for a while I can never remember how to search for database table fields that are either NULL, or NOT NULL. I always try to use the = operator or something else. So,

Result Cache特性之SQL QUERY结果集缓存

在Oracle 11g中,推出了Result Cache新特性,对于结果集合进行缓存处理,减少了IO,提高了性能.服务器端结果集缓存位于共享池中,缓存这SQL query结果,包括sql查询结果.函数结果.OLAP应用程序能够显著受益于服务器端结果集缓存.当然,这个益处有赖于应用程序本身.其中比较好的使用场景就是从一个大表中查询返回小部分数量的结果,比如数据仓库环境.例如,类似于物化视图通过表固化查询结果,结果集缓存也可以让你启用高级查询重写功能. 这一新特性包括三部分: 1)SQL QUERY

Freebie - Utility Form: Generate Excel Report From SQL Query In Oracle Forms 6i And 11g

Sharing a form to generate Excel file report from SQL query in Oracle Forms. This form can be used in Oracle Forms 6i and 10g / 11g. Below is the screen shot of this form and could be download from the following link: Excel_Rep.Fmb A procedure Create

SQL SERVER 2008配置Database Mail –用SQL 数据库发邮件

SQL SERVER 2008配置Database Mail –用SQL  数据库发邮件 https://blogs.msdn.microsoft.com/apgcdsd/2011/06/28/sql-server-2008database-mail-sql/ 原文来自:http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/  Aug

SQL Server查询所有DATABASE的文件大小

SELECT DB_NAME(database_id) AS [Database Name],[Name] AS [Logical Name],        ----查询SQL中所有的DataBase的文件大小[Physical_Name] AS [Physical Name],((size * 8) / 1024) AS [Size(MB)],[differential_base_time] AS [Differential Base Time] FROM sys.master_files