sql-server-administration

How to calculate the total memory occupied by the database


I am using sqlserver 2008, How can I calculate the total memory occupied by the Database with tables (>30) and also data in it.

I mean if I have DB (DB_name) and with few tables(tblabc, tbldef......) with data in it, how to calculate the total memory occupied by the database in the server.

Kindly Help me.

Thanks

Ramm


Solution

  • See the sizes of mdf and log files

    EDIT: Sql Server stores its db in mdf files(one or multiple). You need the lof file too. See where your db is stored and these files are files you need.

    Be aware that if you are using FILESTREAM, the actual files are not in the db (mdf)

    EDIT2:Books Online When you create a database, you must either specify an initial size for the data and log files or accept the default size. As data is added to the database, these files become full.

    So, there is a file with some size even if you have no data..

    By default, the data files grow as much as required until no disk space remains. ... Alternatively, SQL Server lets you create data files that can grow automatically when they fill with data, but only to a predefined maximum size. This can prevent the disk drives from running out of disk space completely.

    If data is added (and there is no more space in the file)the file grows, but when it is deleted, it keeps its size, you need to shrink it...