在MS Sql Server中可以能过以下的方法查询出磁盘空间的使用情况及各数据库数据文件及日志文件的大小及使用利用率:
1、查询各个磁盘分区的剩余空间:
Exec master.dbo.xp_fixeddrives
2、查询数据库的数据文件及日志文件的相关信息(包括文件组、当前文件大小、文件最大值、文件增长设置、文件逻辑名、文件路径等)
select * from [数据库名].[dbo].[sysfiles]
转换文件大小单位为MB:
select name, convert(float,size) * (8192.0/1024.0)/1024. from [数据库名].dbo.sysfiles
3、查询当前数据库的磁盘使用情况:
Exec sp_spaceused
4、查询数据库服务器各数据库日志文件的大小及利用率
DBCC SQLPERF(LOGSPACE)
‘贰’ 如何查看SQL2000数据库中所有表的数据量大小
直接在查询分析器运行即可:
declare @id int
declare @type character(2)
declare @pages
int
declare @dbname sysname
declare @dbsize dec(15,0)
declare @bytesperpage dec(15,0)
declare @pagesperMB dec(15,0)
create table #spt_space
(
objid int null,
rows int null,
reserved dec(15) null,
data dec(15) null,
indexp dec(15) null,
unused dec(15) null
)
set nocount on
-- Create a cursor to loop through the user tables
declare c_tables cursor for
select id
from sysobjects
where xtype = 'U'
open c_tables
fetch next from c_tables
into @id
while @@fetch_status = 0
begin
/* Code from sp_spaceused */
insert into #spt_space (objid, reserved)
select objid = @id, sum(reserved)
from sysindexes
where indid in (0, 1, 255)
and id = @id
select @pages = sum(dpages)
from sysindexes
where indid < 2
and id = @id
select @pages = @pages + isnull(sum(used), 0)
from sysindexes
where indid = 255
and id = @id
update #spt_space
set data = @pages
where objid = @id
/* index: sum(used) where indid in (0, 1, 255) - data */
update #spt_space
set indexp = (select sum(used)
from sysindexes
where indid in (0, 1, 255)
and id = @id)
- data
where objid = @id
/* unused: sum(reserved) - sum(used) where indid in (0, 1, 255) */
update #spt_space
set unused = reserved
- (select sum(used)
from sysindexes
where indid in (0, 1, 255)
and id = @id)
where objid = @id
update #spt_space
set rows = i.rows
from sysindexes i
where i.indid < 2
and i.id = @id
and objid = @id
fetch next from c_tables
into @id
end
select TableName = (select left(name,60) from sysobjects where id = objid),
Rows = convert(char(11), rows),
ReservedKB = ltrim(str(reserved * d.low / 1024.,15,0) + ' ' + 'KB'),
DataKB = ltrim(str(data * d.low / 1024.,15,0) + ' ' + 'KB'),
IndexSizeKB = ltrim(str(indexp * d.low / 1024.,15,0) + ' ' + 'KB'),
UnusedKB = ltrim(str(unused * d.low / 1024.,15,0) + ' ' + 'KB')
from #spt_space, master.dbo.spt_values d
where d.number = 1
and d.type = 'E'
order by reserved desc
drop table #spt_space
close c_tables
deallocate c_tables
‘叁’ sql查询语句 数据量大
auto_result和audit_result的数据类型是什么?按照你说的是二进制字符串,那么是varchar?还是oracle的二进制clob?
‘肆’ 如何查询sqlserver数据库中数据的大小
不是很懂你的问题意思,下次提问请描述的更清楚一些;
如果是想知道某一个表占用了多大空间,你可以用下面的语句
useyourDB
go
sp_spaceusedyourTable
你会得到如下结果,各列分别是:
表名;行数;已占用空间;数据占用空间;索引占用空间;未使用空间;
‘伍’ 如何查看SQL数据库内容
1、首先,打开SQL Server的电脑软件,进入软件加载界面等待加载。
‘陆’ 怎么查看oracle数据库数据量大小
查看方法:
1、查看所有表空间及表空间大小:
select tablespace_name ,sum(bytes) / 1024 / 1024 as MBfrom dba_data_files group by tablespace_name;
2、查看所有表空间对应的数据文件:
select tablespace_name,file_name from dba_data_files;
3、修改数据文件大小:
alter database datafile 'H:ORACLEPRODUCT10.1.0ORADATAORACLEUSERS01.DBF' RESIZE 10240M;
(6)如何查看sql数据量储存扩展阅读
每张表都是作为“段”来存储的,可以通过user_segments视图查看其相应信息。
段(segments)的定义:如果创建一个堆组织表,则该表就是一个段。
sql:SELECT segment_name AS TABLENAME,BYTES FROM user_segments WHERE segment_name='表名'。
解释:
segment_name 就是要查询的表名(大写),BYTES 为表存储所占用的字节数。本sql的意思就是查询出表名和表所占的存储空间大小。
‘柒’ SQL SERVER里面如何查看一个表已经占据的容量
用如下方法查看(以sqlserver2008r2为例):
1、登录SQL Server Managment Studio。
2、在左侧的树中找到要查询的表名,如dbo.dept表。
‘捌’ 如何查看一条数据所占据空间的大小
学过电脑都知道,一个字符占用2个字节。
1TB=1024GB
1GB=1024MB
1MB=1024KB
1KB=1024B
1字节=1B
1个汉字=2B
1个大写字母或小写字母=1B
标点符号英文状态下为1B,中文全角为2B。
那你算吧,一条信息有多少字量。
‘玖’ 如何查看mysql数据库的数据量
在mysql中,每个数据库最多可创建20亿个表,一个表允许定义1024列,每行的最大长度为8092字节(不包括文本和图像类型的长度)。当表中定义有varchar、nvarchar或varbinary类型列时,如果向表中插入的数据行超过8092字节时将导致transact-sql语句失败,并产生错误信息。sql
server对每个表中行的数量没有直接限制,但它受数据库存储空间的限制。每个数据库的最大空间1048516tb,所以一个表可用的最大空间为1048516tb减去数据库类系统表和其它数据库对象所占用的空间。
‘拾’ mysql 怎么查看表数据量占用空间的sql
第一步
mysql> use information_schema;
第二步
mysql> select data_length,index_length
-> from tables where
-> table_schema='DBNAME'
-> and table_name = 'TABLENAME';
或者
mysql> select concat(round(sum(data_length/1024/1024),2),'MB') as data_length_MB, -> concat(round(sum(index_length/1024/1024),2),'MB') as index_length_MB
-> from tables where
-> table_schema='DBNAME'
-> and table_name = 'TABLENAME';