Home Database Mysql Tutorial SQLServer 数据库故障修复顶级技巧之一

SQLServer 数据库故障修复顶级技巧之一

Jun 07, 2016 pm 06:00 PM
sqlserver bug fix database

SQL Server 2005 和 2008 有几个关于高可用性的选项,如日志传输、副本和数据库镜像。

所有这些技术都能够作为维护一个备用服务器的手段,同时这个数据库可以在你原先的主数据库出问题时上线并作为新的主服务器。然而,你必须记住的是将备用服务器替换上线只是完成了一半的故障修复工作。

要保证你的应用正常工作,在数据库外部还有许多注意事项。这其中包括登录信息、数据库用户、调度任务、DTS 和 SSIS 包、可执行文件、系统数据库中的对象、同名数据库、链接服务器等等。

有时这些细小的依赖只有在你进行一个数据库故障恢复时才会发现,这样你又不得不花费大量时间进行调试和评估导致这个问题的根源。此外,你还必须让第二台服务器和应用尽可能快地上线以减少停机时间。因此,提前做设置是非常重要的。

当涉及到高可用性和SQL Server 的灾难恢复规划时,你应该谨记我本人所喜欢的一个拉丁谚语 ——Si vis pacem, para bellum,它的意思翻译过来就是“如果你想要得到和平,那就得先作好战争准备。”记住这一点后,让我们来看看一些可能会遇到的问题。我也将建议几个预先可以完成的任务,以确保数据库故障恢复过程快速有效地完成。

SQL Server 登录信息与数据库用户

你的故障恢复服务器应该备份所有的登录信息和数据库用户,包括密码。登录信息可以在任何时候创建,但是如果你使用日志传输或数据库镜像,你的数据库将处理恢复状态,这样你只有在它们重新上线后才能完成恢复过程。

使用 Windows 认证,可以很容易地将登录信息映射到数据库用户。然而,如果你使用的是 SQL 认证,那么你需要手动地在你从另一个服务器获得的数据库上重新建立登录信息与数据库用户的连接。因此,你在迁移数据库时会丢失登录信息和数据库用户之间的连接。

当你在第二台服务器上恢复数据库后,运行这些代码:

USE YourDatabaseName

EXEC sp_change_Users_Login 'UPDATE_ONE', YourDBUserName, YourLogin

保持登录信息同步的另一个方法是遵循 Microsoft Knowledge Base 上关于 在 SQL Server 实例之间传输登录信息和密码 的文章的步骤。这篇文章阐述了如何使用原始的 SID 脚本化登录信息。当在故障恢复数据库服务器上创建这些登录信息时,登录信息与数据库用户之间的连接会被保存,这样你就不必运行上面的脚本修复孤立的用户。
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to import mdf file into sqlserver How to import mdf file into sqlserver Apr 08, 2024 am 11:41 AM

The import steps are as follows: Copy the MDF file to SQL Server's data directory (usually C:\Program Files\Microsoft SQL Server\MSSQL\DATA). In SQL Server Management Studio (SSMS), open the database and select Attach. Click the Add button and select the MDF file. Confirm the database name and click the OK button.

How to recover accidentally deleted database in sqlserver How to recover accidentally deleted database in sqlserver Apr 05, 2024 pm 10:39 PM

If you accidentally delete a SQL Server database, you can take the following steps to recover: stop database activity; back up log files; check database logs; recovery options: restore from backup; restore from transaction log; use DBCC CHECKDB; use third-party tools. Please back up your database regularly and enable transaction logging to prevent data loss.

How to delete sqlserver if the installation fails? How to delete sqlserver if the installation fails? Apr 05, 2024 pm 11:27 PM

If the SQL Server installation fails, you can clean it up by following these steps: Uninstall SQL Server Delete registry keys Delete files and folders Restart the computer

How to change sqlserver English installation to Chinese How to change sqlserver English installation to Chinese Apr 05, 2024 pm 10:21 PM

SQL Server English installation can be changed to Chinese by following the following steps: download the corresponding language pack; stop the SQL Server service; install the language pack; change the instance language; change the user interface language; restart the application.

What is the difference between mysql and sqlserver syntax What is the difference between mysql and sqlserver syntax Apr 22, 2024 pm 06:33 PM

The syntax differences between MySQL and SQL Server are mainly reflected in database objects, data types, SQL statements and other aspects. Database object differences include the storage engine and how filegroups are specified, and the creation of indexes and constraints. Data type differences involve differences in numeric types, character types, and date and time types. SQL statement differences are reflected in result set limitations, data insertion, update and delete operations, etc. Other differences include how identity columns, views, and stored procedures are created. Understanding these differences is important to avoid errors when using different database systems.

How to delete database in sqlserver How to delete database in sqlserver Apr 05, 2024 pm 11:00 PM

To delete a SQL Server database, please perform the following steps in sequence: 1. Log in to SQL Server Management Studio; 2. Expand the database node; 3. Right-click the database to be deleted; 4. Select "Delete"; 5. Confirm the deletion. Note: Deleting the database is irreversible, please make sure you have backed up important data and disconnected other objects.

How to recover data deleted from sqlserver How to recover data deleted from sqlserver Apr 05, 2024 pm 10:45 PM

SQL Server deleted data can be recovered through transaction rollback (rolling back uncommitted transactions). Database log (restore data from log). SQL Server native backup (restore database from backup). Third-party recovery tools (use advanced technology to recover data). Contact Microsoft Support (for dedicated help).

What should I do if sqlserver cannot be deleted and cannot be reinstalled? What should I do if sqlserver cannot be deleted and cannot be reinstalled? Apr 05, 2024 pm 11:30 PM

The problem that SQL Server cannot be reinstalled due to incomplete deletion can be solved by following the following steps: manually delete files and registry entries; use SQL Server installation and uninstall tools; use third-party uninstall tools; check Windows Event Viewer; restart the computer; reinstall SQL Server.

See all articles