| title | Display data & log space info for a database | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| description | Learn how to display the data and log space information for a database in SQL Server by using SQL Server Management Studio or Transact-SQL. | ||||||||
| ms.date | 08/01/2016 | ||||||||
| ms.prod | sql | ||||||||
| ms.prod_service | database-engine, sql-database, sql-data-warehouse, pdw | ||||||||
| ms.reviewer | |||||||||
| ms.technology | supportability | ||||||||
| ms.topic | conceptual | ||||||||
| helpviewer_keywords |
|
||||||||
| ms.assetid | c7b99463-4bab-4e9b-9217-fcb0898dc757 | ||||||||
| author | stevestein | ||||||||
| ms.author | sstein | ||||||||
| monikerRange | >=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current | ||||||||
| ms.custom | seo-lt-2019 |
[!INCLUDESQL Server Azure SQL Database Synapse Analytics PDW ] This topic describes how to display the data and log space information for a database in [!INCLUDEssCurrent] by using [!INCLUDEssManStudioFull] or [!INCLUDEtsql].
Permission to execute sp_spaceused is granted to the public role. Only members of the db_owner fixed database role can specify the @updateusage parameter.
-
In Object Explorer, connect to an instance of [!INCLUDEssNoVersion] and then expand that instance.
-
Expand Databases.
-
Right-click a database, point to Reports, point to Standard Reports,, and then click Disk Usage.
-
Connect to the [!INCLUDEssDE].
-
From the Standard bar, click New Query.
-
Copy and paste the following example into the query window and click Execute. This example uses the sp_spaceused system stored procedure to report disk space information for the
Vendortable and its indexes.
USE AdventureWorks2012;
GO
EXEC sp_spaceused N'Purchasing.Vendor';
GO -
Connect to the [!INCLUDEssDE].
-
From the Standard bar, click New Query.
-
Copy and paste the following example into the query window and click Execute. This example queries the sys.database_files catalog view to return specific information about the data and log files in the [!INCLUDEssSampleDBobject] database.
USE AdventureWorks2012;
GO
SELECT file_id, name, type_desc, physical_name, size, max_size
FROM sys.database_files ;
GO
SELECT (Transact-SQL)
sys.database_files (Transact-SQL)
sp_spaceused (Transact-SQL)
Add Data or Log Files to a Database
Delete Data or Log Files from a Database