Wie kann ich beim MS SQL Server ermitteln wieviel freier Speicherplatz in einer Datenbank noch vorhanden ist?
Hallo,
ich suche nach einer SQL-Abfrage um feststellen zu können wie voll eine Datenbank eines Microsoft-SQL-Servers (SQL2017, aber gerne auch bei älteren Versionen) bereits ist.
Wie kann ich das mit SQL abfragen?
Vielen Dank für Tipps!
Armin
ich suche nach einer SQL-Abfrage um feststellen zu können wie voll eine Datenbank eines Microsoft-SQL-Servers (SQL2017, aber gerne auch bei älteren Versionen) bereits ist.
Wie kann ich das mit SQL abfragen?
Vielen Dank für Tipps!
Armin
Please also mark the comments that contributed to the solution of the article
Content-Key: 396111
Url: https://administrator.de/contentid/396111
Printed on: April 25, 2024 at 11:04 o'clock
3 Comments
Latest comment
Moin,
google kaputt?
ms sql get size of database
Führt zu folgendem Micorosft-Thread: Get Total Size of Database with a T-SQL query.
Gruß
em-pie
google kaputt?
ms sql get size of database
Führt zu folgendem Micorosft-Thread: Get Total Size of Database with a T-SQL query.
Gruß
em-pie
Hallo,
Gruß
Frank
SELECT database_name = db_name(database_id),
log_size_mb = CAST(SUM(CASE when type_desc = 'LOG' then size end) * 8./1024 as decimal(8,2)),
row_size_mb= CAST(SUM(CASE when type_desc = 'ROWS' then size end) * 8./1024 as decimal(8,2)),
total_size_mb = cast(sum(size) * 8. / 2014 as decimal(8,2))
from sys.master_files with(nowait)
WHERE database_id = db_id() -- füraktuelle DB
Group by database_id
Gruß
Frank