在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';