简体   繁体   English

当分配的空间阻止您这样做时,更改 Azure SQL 数据库层的最佳方法是什么?

[英]What is the best way to change the tier of an Azure SQL Database when allocated space prevents you from doing so?

Our database recently had gotten too full and we needed to remove some data.我们的数据库最近太满了,我们需要删除一些数据。 When we tried to do so, we got an error about the size quota as follows:当我们尝试这样做时,我们收到有关大小配额的错误,如下所示:

Msg 40544, Level 17, State 12, Line 1
The database '<My Database>' has reached its size quota. Partition or delete data, drop indexes, or consult the documentation for possible resolutions.

When we looked for a solution, we found this resource ( https://social.technet.microsoft.com/wiki/contents/articles/1541.windows-azure-sql-database-connection-management.aspx ), which said that “When total database size on a machine exceeds 90% of total space available on machine, all databases become read-only.当我们寻找解决方案时,我们发现了这个资源( https://social.technet.microsoft.com/wiki/contents/articles/1541.windows-azure-sql-database-connection-management.aspx ),它说“当机器上的总数据库大小超过机器上可用总空间的 90% 时,所有数据库都变为只读的。 Load balancer ensures the situation is resolved by balancing databases across machines.”负载均衡器确保通过跨机器平衡数据库来解决问题。”

At the time, our database was on an S4 tier, which can be up to 1 TB in size.当时,我们的数据库位于 S4 层上,最大可达 1 TB。 We really wanted to avoid this, but we decided to change the database to be on an P11 tier, which increased the size to 4TB, but increased the cost per month from ~$450 to ~$7000.我们真的很想避免这种情况,但我们决定将数据库更改为 P11 层,这将大小增加到 4TB,但每月的成本从约 450 美元增加到约 7000 美元。

We were able to delete the data we needed to, but when we tried to revert the tier back to S4 from P11, we were told that “The storage size of your database cannot be smaller than the currently allocated size.”我们能够删除我们需要的数据,但是当我们尝试将层从 P11 恢复到 S4 时,我们被告知“您的数据库的存储大小不能小于当前分配的大小。”

Indeed, the allocated space was now at 1.13 TB for some reason实际上,由于某种原因,分配的空间现在为 1.13 TB

在此处输入图像描述

Then, much to my dismay, I found this ( https://techcommunity.microsoft.com/t5/azure-database-support-blog/azure-sql-database-or-sql-managed-instance-database-used-data/ba-p/2162130 )然后,令我沮丧的是,我发现了这个( https://techcommunity.microsoft.com/t5/azure-database-support-blog/azure-sql-database-or-sql-managed-instance-database-used-data /ba-p/2162130 )

"The amount of formatted file space made available for storing database data. The amount of space allocated grows automatically, but never decreases after deletes. This behavior ensures that future inserts are faster since space does not need to be reformatted." “可用于存储数据库数据的格式化文件空间量。分配的空间量会自动增长,但在删除后不会减少。这种行为确保了未来的插入速度更快,因为不需要重新格式化空间。”

We really need to get back down to an S4 tier database.我们真的需要回到 S4 层数据库。 Our worst case plan is that we create a brand new database, migrate our data to that new database, update any references to the old database to use the new database, then delete the old database, but does anyone know of a better way to resolve the issue?我们最坏的计划是我们创建一个全新的数据库,将我们的数据迁移到那个新数据库,更新对旧数据库的任何引用以使用新数据库,然后删除旧数据库,但是有没有人知道更好的解决方法问题?

Please try to shrink the database and the log file.请尝试收缩数据库和日志文件。

DBCC SHRINKFILE (log, 0)

DBCC SHRINKDATABASE (N'db1')

Adjust the MAX SIZE of the database accordingly also:相应地调整数据库的 MAX SIZE:

ALTER DATABASE DATABASE_NAME
MODIFY (EDITION='BUSINESS', MAXSIZE=750 GB)

After that try to scale down the database.之后尝试缩小数据库。

暂无
暂无

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

相关问题 SQL Server故障转移群集数据库访问层的最佳实践是什么? - What is best practice for SQL Server failover cluster database access tier? 如何检查SQL Server数据库的Azure定价层更改历史记录? - How to check Azure Pricing tier change history for SQL Server Database? 从SQL服务器将数据同步到Azure的最佳方法是什么 - What is the best way to sync data into Azure from a SQL server 将数据从 SQL Server 迁移到 Oracle 数据库的最佳方法是什么 - what is the best way to migrate data from SQL Server to Oracle database 将本地 SQL Server 数据库同步到 Azure Windows Server SQL Server 的最佳方法是什么 - What's the best way to Sync on premise SQL Server database to Azure Windows Server SQL Server 从SQL Server(或SQL Azure)数据库检索大量数据的最佳方法 - The best way to retrieve large amounts of data from a SQL Server (or SQL Azure) database 是否有关于如何从2层应用程序连接到SQL Server数据库的最佳实践? - Is there a best practice on how to connect to a SQL Server database from a 2-tier application? 如果列中有数据,更改SQL Server数据库中列类型的最佳方法是什么? - What is the best way to change the type of a column in a SQL Server database, if there is data in said column? 在视图定义(SQL Server 2008 R2)中更改硬编码数据库引用的最佳方法是什么? - What's the best way to change hard coded database references in view definitions (SQL Server 2008 R2)? Azure SQL 数据库(S0 层) - 如何成功终止进程 - Azure SQL Database (S0 tier) - How to successfully kill the process
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM