YourSQLDba将数据库置于紧急模式的原因浅析
从SQL SERVER 2000 上迁移了一个数据库到SQL SERVER 2008 R2上,暂且用DataBaseName代替迁移的真实的数据库名(后面的资料也会将数据库真实的名字用DataBaseName代替),迁移过程中也没有啥问题,配置了YourDataBase,作业YourSQLDba_FullBackups_And_Maintena
从SQL SERVER 2000 上迁移了一个数据库到SQL SERVER 2008 R2上,暂且用DataBaseName代替迁移的真实的数据库名(后面的资料也会将数据库真实的名字用DataBaseName代替),迁移过程中也没有啥问题,配置了YourDataBase,作业“YourSQLDba_FullBackups_And_Maintenance”每天凌晨12点整运行,结果第一天晚上YourDatabase将数据库DataBaseName置于紧急模式,检查错误日志情况如下:
错误现象:
YourSQLDba对数据库做一致性检查时,发现有错误,所以它将该数据库置于紧急模式,具体内容如下所
查看YourSQLDba的具体错误日志信息
单击Action字段,香港虚拟主机,看到的内容如下(太多内容,部分省略)
错误日志具体内容
对数据库执行DBCC CHECKDB('DataBaseName')得到的内容跟YourSQLDba的错误日志信息一致
DCC CHECKDB
分析原因:
这些错误提示数据页在保留空间中不正确的值,在SQL 2000中,这些错误也有可能是数据条目或者数据页的数目跟索引或表中记录的不一致所导致的。CheckDB 不会修复类似错误,在SQL 2005 中CheckDB只会给出一个警告信息。这不是什么严重的错误,按照提示运行DBCC UPDATEUSAGE行了,这通常发生在SQL 2000升级为2005/2008后,在SQL 2005/2008中一般不会遇到。刚好我这个数据库DataBaseName是从SQL 2000升级到SQL 2008,其实这确实不是一个什么严重错误,但是YourSQLDba意识到了“严重性”将数据库出于紧急模式,不能让系统或用户继续操作该数据库了,那么接下来用DBCC UPDATEUSAGE 解决该问题。
Code Snippet
关于DBCC UPDATEUSAGE的MSDN解释如下:
-----------------------------------------------------------------------------------------------------------------------
备注DBCC UPDATEUSAGE 将针对表或索引中的每个分区更正行、已用页、保留页、叶级页和数据页的计数。如果系统表中没有错误,则 DBCC UPDATEUSAGE 不返回数据。如果发现错误,并对其进行更正,同时没有使用 WITH NO_INFOMSGS,DBCC UPDATEUSAGE 将返回系统表中更新的行和列。
使用 DBCC UPDATEUSAGE 同步空间使用计数器。因为 DBCC UPDATEUSAGE 在大型表或大型数据库中运行可能会需要一些时间,所以通常只在怀疑 sp_spaceused 返回的值不正确时使用。sp_spaceused 在返回表或索引的空间信息之前接受可选参数以运行 DBCC UPDATEUSAGE。
升级数据库在 SQL Server 的早期版本中,用于表和索引行计数以及页计数的值可能不正确。根据 SQL Server 2005 之前的版本创建的数据库可能包含错误的计数。因此,虚拟主机,我们建议在升级之后运行 DBCC UPDATEUSAGE,以便更正所有的无效计数。
DBCC CHECKDB 已得到增强,虚拟主机,可以检测页计数或行计数变为负值的情况。检测到上述问题后,DBCC CHECKDB 的输出会包含一个警告和一个建议,建议运行 DBCC UPDATEUSAGE 解决该问题。
------------------------------------------------------------------------------------------------------------------------

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Even answering calls in Do Not Disturb mode can be a very annoying experience. As the name suggests, Do Not Disturb mode turns off all incoming call notifications and alerts from emails, messages, etc. You can follow these solution sets to fix it. Fix 1 – Enable Focus Mode Enable focus mode on your phone. Step 1 – Swipe down from the top to access Control Center. Step 2 – Next, enable “Focus Mode” on your phone. Focus Mode enables Do Not Disturb mode on your phone. It won't cause any incoming call alerts to appear on your phone. Fix 2 – Change Focus Mode Settings If there are some issues in the focus mode settings, you should fix them. Step 1 – Open your iPhone settings window. Step 2 – Next, turn on the Focus mode settings

Go language is an efficient, concise and easy-to-learn programming language. It is favored by developers because of its advantages in concurrent programming and network programming. In actual development, database operations are an indispensable part. This article will introduce how to use Go language to implement database addition, deletion, modification and query operations. In Go language, we usually use third-party libraries to operate databases, such as commonly used sql packages, gorm, etc. Here we take the sql package as an example to introduce how to implement the addition, deletion, modification and query operations of the database. Assume we are using a MySQL database.

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

HTML cannot read the database directly, but it can be achieved through JavaScript and AJAX. The steps include establishing a database connection, sending a query, processing the response, and updating the page. This article provides a practical example of using JavaScript, AJAX and PHP to read data from a MySQL database, showing how to dynamically display query results in an HTML page. This example uses XMLHttpRequest to establish a database connection, send a query and process the response, thereby filling data into page elements and realizing the function of HTML reading the database.

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

PHP is a back-end programming language widely used in website development. It has powerful database operation functions and is often used to interact with databases such as MySQL. However, due to the complexity of Chinese character encoding, problems often arise when dealing with Chinese garbled characters in the database. This article will introduce the skills and practices of PHP in handling Chinese garbled characters in databases, including common causes of garbled characters, solutions and specific code examples. Common reasons for garbled characters are incorrect database character set settings: the correct character set needs to be selected when creating the database, such as utf8 or u
