Posted On March 31, 2019

MySQL: List Database Size

kimconnect 0 comments
blog.KimConnect.com >> Database >> MySQL: List Database Size
SELECT table_schema "kimconnect",
       ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM information_schema.tables
GROUP BY table_schema;
# change the owner of the database to sa
ALTER AUTHORIZATION on DATABASE::{database_name} to sa

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

SQL Language (Condensed)

SELECT [DISTINCT | MIN | MAX] column1 [AS alias]FROM table_nameWHERE condition [IS NULL|IS NOT NULL]…

PowerShell: Get SQL Server Performance Counters

Version 2 # getSqlPerformanceCounter.ps1 # version 0.02 $computername='sql0003.kimconnect.com' function getSqlPerformanceCounter($server=$env:computername,$sampleInterval=10,$maxSamples=1){ $PerformanceCounterSampleSet=$result=@() $counters=@( '\Memory\Available MBytes', '\Memory\Pages/sec',…

How to Get Table Sizes of a Database in Microsoft SQL Server

Obtain Table Sizes of One or Multiple Names -- Get sizes of multiple tables use…