SQL Server 2005 镜像配置(三)
SQL Server 2005 镜像 高可用性模式 (证书认证) 一、为主体 数据库 配置 出站连接 --创建 数据库 主密钥 CREATE MASTER KEY ENCRYPTION BY PASSWORD = '111111'; GO --在MIR-A上为 数据库 实例创建证书 USE master; CREATE CERTIFICATE MIR_A_cert WITH SU
SQL Server 2005镜像高可用性模式
(证书认证)
一、为主体数据库配置出站连接 --创建数据库主密钥 CREATE MASTER KEY ENCRYPTION BY PASSWORD = '111111'; GO
USE master; CREATE CERTIFICATE MIR_A_cert WITH SUBJECT = 'MIR_A certificate', START_DATE = '01/27/2008', EXPIRY_DATE = '01/01/2099' GO
CREATE ENDPOINT Endpoint_Mirroring STATE = STARTED AS TCP ( LISTENER_PORT=5024 , LISTENER_IP = ALL ) FOR DATABASE_MIRRORING ( AUTHENTICATION = CERTIFICATE MIR_A_cert , ENCRYPTION = REQUIRED ALGORITHM RC4 , ROLE = ALL ); GO --备份MIR-A上的证书并拷贝到MIR-B,MIR-W上 BACKUP CERTIFICATE MIR_A_cert TO FILE = 'C:\MIR_A_cert.cer'; GO
USE master; CREATE MASTER KEY ENCRYPTION BY PASSWORD = '111111'; GO --在MIR-B上为数据库实例创建证书 CREATE CERTIFICATE MIR_B_cert WITH SUBJECT = 'MIR_B certificate for database mirroring', START_DATE = '01/27/2008', EXPIRY_DATE = '01/01/2099'; GO --在MIR-B上使用上面创建的证书为数据库实例创建镜像端点 CREATE ENDPOINT Endpoint_Mirroring STATE = STARTED AS TCP ( LISTENER_PORT=5024, LISTENER_IP = ALL ) FOR DATABASE_MIRRORING ( AUTHENTICATION = CERTIFICATE MIR_B_cert, ENCRYPTION = REQUIRED ALGORITHM RC4, ROLE = ALL ); GO --备份MIR-B上的证书并拷贝到MIR-A,MIR-W上 BACKUP CERTIFICATE MIR_B_cert TO FILE = 'C:\MIR_B_cert.cer'; GO
USE master; CREATE MASTER KEY ENCRYPTION BY PASSWORD = '111111'; GO --在MIR-W上为数据库实例创建证书 CREATE CERTIFICATE MIR_W_cert WITH SUBJECT = 'MIR_W certificate for database mirroring', START_DATE = '01/27/2008', EXPIRY_DATE = '01/01/2099'; GO --在MIR-W上使用上面创建的证书为数据库实例创建镜像端点 CREATE ENDPOINT Endpoint_Mirroring STATE = STARTED AS TCP ( LISTENER_PORT=5024, LISTENER_IP = ALL ) FOR DATABASE_MIRRORING ( AUTHENTICATION = CERTIFICATE MIR_W_cert, ENCRYPTION = REQUIRED ALGORITHM RC4, ROLE = ALL ); GO --备份MIR-W上的证书并拷贝到MIR-A,MIR-B上 BACKUP CERTIFICATE MIR_W_cert TO FILE = 'C:\MIR_W_cert.cer'; GO
USE master; CREATE LOGIN MIR_B_login WITH PASSWORD = '111111'; GO --为以上登陆创建一个用户 CREATE USER MIR_B_user FOR LOGIN MIR_B_login; GO --绑定证书到用户 CREATE CERTIFICATE MIR_B_cert AUTHORIZATION MIR_B_user FROM FILE = 'C:\MIR_B_cert.cer' GO --在镜像端点上为登陆赋予CONNECT权限 GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [MIR_B_login]; GO
USE master; CREATE LOGIN MIR_W_login WITH PASSWORD = '111111'; GO --为以上登陆创建一个用户 CREATE USER MIR_W_user FOR LOGIN MIR_W_login; GO --绑定证书到用户 CREATE CERTIFICATE MIR_W_cert AUTHORIZATION MIR_W_user FROM FILE = 'C:\MIR_W_cert.cer' GO --在镜像端点上为登陆赋予CONNECT权限 GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [MIR_W_login]; GO
USE master; CREATE LOGIN MIR_A_login WITH PASSWORD = '111111'; GO --为以上登陆创建一个用户 CREATE USER MIR_A_user FOR LOGIN MIR_A_login; GO --绑定证书到用户 CREATE CERTIFICATE MIR_A_cert AUTHORIZATION MIR_A_user FROM FILE = 'C:\MIR_A_cert.cer' GO --在镜像端点上为登陆赋予CONNECT权限 GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [MIR_A_login]; GO
USE master; CREATE LOGIN MIR_W_login WITH PASSWORD = '111111'; GO --为以上登陆创建一个用户 CREATE USER MIR_W_user FOR LOGIN MIR_W_login; GO --绑定证书到用户 CREATE CERTIFICATE MIR_W_cert AUTHORIZATION MIR_W_user FROM FILE = 'C:\MIR_W_cert.cer' GO --在镜像端点上为登陆赋予CONNECT权限 GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [MIR_W_login]; GO
六、为见证数据库配置入站连接
--在MIR-W上为MIR-A创建登陆 USE master; CREATE LOGIN MIR_A_login WITH PASSWORD = '111111'; GO --为以上登陆创建一个用户 CREATE USER MIR_A_user FOR LOGIN MIR_A_login; GO --绑定证书到用户 CREATE CERTIFICATE MIR_A_cert AUTHORIZATION MIR_A_user FROM FILE = 'C:\MIR_A_cert.cer' GO --在镜像端点上为登陆赋予CONNECT权限 GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [MIR_A_login]; GO
USE master; CREATE LOGIN MIR_B_login WITH PASSWORD = '111111'; GO --为以上登陆创建一个用户 CREATE USER MIR_B_user FOR LOGIN MIR_B_login; GO --绑定证书到用户 CREATE CERTIFICATE MIR_B_cert AUTHORIZATION MIR_B_user FROM FILE = 'C:\MIR_B_cert.cer' GO --在镜像端点上为登陆赋予CONNECT权限 GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [MIR_B_login]; GO
七、在MIR-A上备份数据库
--修改Northwind数据库使用完整恢复模式 ALTER DATABASE Northwind SET RECOVERY FULL; GO --在 MIR_A 的主体服务器实例上备份数据库 --通过安全方法,将 C:\Northwind.bak 复制到MIR_B上 USE Northwind BACKUP DATABASE Northwind TO DISK = 'C:\Northwind.bak' WITH FORMAT GO
八、转到MIR-B上去恢复数据库
--在MIR-B的镜像服务器实例上还原数据库: RESTORE DATABASE Northwind FROM DISK = 'C:\Northwind.bak' WITH NORECOVERY GO
九、为镜像数据库配置镜像伙伴
--在 MIR-B 的镜像服务器实例上,将 MIR-A 上的服务器实例设置为伙伴 ALTER DATABASE Northwind SET PARTNER = 'TCP://MIR-A:5024'; GO
十、为主体数据库配置镜像伙伴和见证服务器
--在 MIR-A 的主体服务器实例上,将MIR-B上的服务器实例设置为伙伴 ALTER DATABASE Northwind SET PARTNER = 'TCP://MIR-B:5024'; GO --在 MIR-A 的主体服务器实例上,将 MIR-W 上的服务器实例设置为见证服务器 ALTER DATABASE Northwind SET WITNESS = 'TCP://MIR-W:5024'; GO
十一、配置数据库镜像事务安全级别
ALTER DATABASE Northwind SET SAFETY FULL GO 十二、分别在MIR-A和MIR-B上查看数据库镜像的配置状态
-- 1.)通过Management studio 对象资源管理器,查看主体数据库、镜像数据库状态 -- 2.)通过Management studio 对象资源管理器中的数据库属性查看状态 -- 3.)通过系统目录视图查看数据库镜像配置情况
GO SELECT * FROM sys.database_mirroring_endpoints; GO SELECT * FROM sys.database_mirroring WHERE database_id = (SELECT database_id FROM sys.databases WHERE name = 'Northwind') GO
|

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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











HQL and SQL are compared in the Hibernate framework: HQL (1. Object-oriented syntax, 2. Database-independent queries, 3. Type safety), while SQL directly operates the database (1. Database-independent standards, 2. Complex executable queries and data manipulation).

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

When loading CentOS-7.0-1406, there are many optional versions. For ordinary users, they don’t know which one to choose. Here is a brief introduction: (1) CentOS-xxxx-LiveCD.ios and CentOS-xxxx- What is the difference between bin-DVD.iso? The former only has 700M, and the latter has 3.8G. The difference is not only in size, but the more essential difference is that CentOS-xxxx-LiveCD.ios can only be loaded into the memory and run, and cannot be installed. Only CentOS-xxx-bin-DVD1.iso can be installed on the hard disk. (2) CentOS-xxx-bin-DVD1.iso, Ce

Oracle and DB2 are two commonly used relational database management systems, each of which has its own unique SQL syntax and characteristics. This article will compare and differ between the SQL syntax of Oracle and DB2, and provide specific code examples. Database connection In Oracle, use the following statement to connect to the database: CONNECTusername/password@database. In DB2, the statement to connect to the database is as follows: CONNECTTOdataba

"Usage of Division Operation in OracleSQL" In OracleSQL, division operation is one of the common mathematical operations. During data query and processing, division operations can help us calculate the ratio between fields or derive the logical relationship between specific values. This article will introduce the usage of division operation in OracleSQL and provide specific code examples. 1. Two ways of division operations in OracleSQL In OracleSQL, division operations can be performed in two different ways.

Interpretation of MyBatis dynamic SQL tags: Detailed explanation of Set tag usage MyBatis is an excellent persistence layer framework. It provides a wealth of dynamic SQL tags and can flexibly construct database operation statements. Among them, the Set tag is used to generate the SET clause in the UPDATE statement, which is very commonly used in update operations. This article will explain in detail the usage of the Set tag in MyBatis and demonstrate its functionality through specific code examples. What is Set tag Set tag is used in MyBati

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

WindowsServerBackup is a function that comes with the WindowsServer operating system, designed to help users protect important data and system configurations, and provide complete backup and recovery solutions for small, medium and enterprise-level enterprises. Only users running Server2022 and higher can use this feature. In this article, we will explain how to install, uninstall or reset WindowsServerBackup. How to Reset Windows Server Backup If you are experiencing problems with your server backup, the backup is taking too long, or you are unable to access stored files, then you may consider resetting your Windows Server backup settings. To reset Windows
