Table of Contents
    SQL Server 2005镜像高可用性模式
            (证书认证)
" >    SQL Server 2005镜像高可用性模式
            (证书认证)
Home Database Mysql Tutorial SQL Server 2005 镜像配置(三)

SQL Server 2005 镜像配置(三)

Jun 07, 2016 pm 03:14 PM
server sql Configuration mirror

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


--在MIR-A上为数据库实例创建证书

USE master;

CREATE CERTIFICATE MIR_A_cert

   WITH SUBJECT = 'MIR_A certificate',

  START_DATE = '01/27/2008',

  EXPIRY_DATE = '01/01/2099'

GO


--在MIR-A上使用上面创建的证书为数据库实例创建镜像端点

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


四、为主体数据库配置入站连接


--在MIR-A上为MIR-B创建登陆

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上为MIR_W创建登陆

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-B上为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


--在MIR-B上为MIR-W创建登陆

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


--在MIR-W上为MIR-B创建登陆

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.)通过系统目录视图查看数据库镜像配置情况


USE MASTER

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


十三、测试故障转移情况

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

Video Face Swap

Video Face Swap

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

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)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1263
29
C# Tutorial
1237
24
What is the difference between HQL and SQL in Hibernate framework? What is the difference between HQL and SQL in Hibernate framework? Apr 17, 2024 pm 02:57 PM

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).

The working principle and configuration method of GDM in Linux system The working principle and configuration method of GDM in Linux system Mar 01, 2024 pm 06:36 PM

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

CentOS7 various version image download addresses and version descriptions (including Everything version) CentOS7 various version image download addresses and version descriptions (including Everything version) Feb 29, 2024 am 09:20 AM

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

Comparison and differences of SQL syntax between Oracle and DB2 Comparison and differences of SQL syntax between Oracle and DB2 Mar 11, 2024 pm 12:09 PM

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 Oracle SQL Usage of division operation in Oracle SQL Mar 10, 2024 pm 03:06 PM

"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.

Detailed explanation of the Set tag function in MyBatis dynamic SQL tags Detailed explanation of the Set tag function in MyBatis dynamic SQL tags Feb 26, 2024 pm 07:48 PM

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

Understand Linux Bashrc: functions, configuration and usage Understand Linux Bashrc: functions, configuration and usage Mar 20, 2024 pm 03:30 PM

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

How to install, uninstall, and reset Windows server backup How to install, uninstall, and reset Windows server backup Mar 06, 2024 am 10:37 AM

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

See all articles