如何计算数据库占用的总内存
我正在使用 sqlserver 2008,如何计算数据库中包含表(> 30)及其数据所占用的总内存。
我的意思是,如果我有数据库(DB_name)并且有几个表(tblabc,tbldef......),其中包含数据,如何计算服务器中数据库占用的总内存。
请帮助我。
谢谢拉姆
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看mdf和日志文件的大小
编辑:Sql Server将其数据库存储在mdf文件(一个或多个)中。您还需要 lof 文件。查看您的数据库存储在哪里,这些文件是您需要的文件。
请注意,如果您使用 FILESTREAM,实际文件不在数据库 (mdf)
EDIT2:Books Online 中
创建数据库时,必须指定数据和日志文件的初始大小或接受默认大小。当数据添加到数据库时,这些文件会变满。
因此,即使没有数据,也会有一个具有一定大小的文件。
默认情况下,数据文件会根据需要增长,直到没有剩余磁盘空间。
...
或者,SQL Server 允许您创建数据文件,这些文件在填充数据时可以自动增长,但仅限于预定义的最大大小。这可以防止磁盘驱动器完全耗尽磁盘空间。
如果添加数据(并且文件中没有更多空间),文件会增大,但是当删除数据时,它会保持其大小,您需要缩小它......
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...
我想你指的是磁盘空间而不是内存。这很难得到正确的结果,因为您必须确切地知道 SQL Server 如何存储数据、索引等。幸运的是,您不必计算它,只需启动 Microsoft SQL Server Management Studio 即可。右键单击您的数据库 -> 报告 -> 磁盘使用情况。
I suppose that you refer to disk space and not memory. That would be very hard to get correct since you would have to know exactly how SQL Server stores the data, indexes and so on. Fortunately you do not have to calculate it, just fire up Microsoft SQL Server Management Studio. Right click on your database->Reports->Disk usage.