简体   繁体   English

SQL Server Express数据库大小限制

[英]Sql Server Express db size limit

After looking at one of our databases I'm finding it confusing if I'm reaching the limit for a sql express db. 查看我们的数据库之一后,如果达到sql express数据库的限制,我会感到困惑。 The database was created with sql server express 2005 but later migrated to express 2008 r2. 该数据库是使用sql server express 2005创建的,但后来又迁移到express 2008 r2。 I understand that as of 2008 databases have 10gb limits but does that mean the database has to be created in 2008 or when I migrated it over it acquired 5gb of extra space. 我了解到,截至2008年,数据库的限制为10gb,但这是否意味着数据库必须在2008年创建,或者当我在其上进行迁移时获得5gb的额外空间。

Properties window of db in question. 有问题的数据库的属性窗口。

sp_spaceused query sp_spaceused查询

and is there anything I can do to free up space. 还有什么我可以做的以释放空间。 I ran shrink db in SSMS Wizard but it didnt seem to free up any space. 我在SSMS向导中运行了收缩数据库,但似乎没有释放任何空间。

You have a 4750 MB database of which 4580 MB are used for the transaction log of which are more than 98% in use. 您有一个4750 MB的数据库,其中4580 MB用于事务日志,而其使用率超过98%。 You have either a huge uncommitted query or you have the Full Backup Recovery Model and you do not backup your log. 您有一个巨大的未提交的查询,或者您有完整备份恢复模型,并且没有备份日志。

Right click the database in Management Studio and open the properties. 在Management Studio中右键单击数据库,然后打开属性。 Select "Files" - i guess the size of the transaction log is much bigger than that of the database file. 选择“文件”-我想事务日志的大小比数据库文件大得多。

Select "Options". 选择“选项”。 See what Recovery model is present. 查看存在什么恢复模型。 Switch it to simple and after a while another DBCC SHRINKDATABASE should free the log space. 将其切换为简单,不久后另一个DBCC SHRINKDATABASE应该释放日志空间。

You can always truncate the log file with SHRINKFILE , I believe it will free enough space so you won't have to worry. 您始终可以使用SHRINKFILE截断日志文件,我相信它将释放足够的空间,因此您不必担心。

Example: 例:

USE [dbname]
BACKUP LOG [dbname] WITH TRUNCATE_ONLY

DECLARE @InternalLogName VARCHAR(64)
SELECT TOP 1 @InternalLogName = RTRIM(LTRIM(name)) FROM sysfiles WHERE groupid = 0
DBCC SHRINKFILE (@InternalLogName)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM