Teach you how to operate SQL Server Images

Source: Internet
Author: User

MSSQL has launched the image function since 2005.

The SQL Server image is unreadable. The entire database is in the norecovery mode.

SQL Server images can only be 1-to-1 images, but images and logshipping can be used to achieve one-to-many and image chains.

SQL Server image authentication is divided into certificates and windows authentication. windows authentication must be implemented in one domain.

Not every company's production environment is a domain. The advantage of the domain is that it can implement failover clustering + image hybrid implementation.

The following describes the authentication method image.

Environment: win2008 + mssql2008

1. Create a database master key on the master database

 
 
  1. create master key encryption  by password ='123!@#abc'; 

2. Create a certificate

 
 
  1. create certificate host_105with subject='host_105_c' 

3. Create an endpoint

 
 
  1. create endpoint endport_mirrorstate=started 
  2. as tcp(listener_port=1522, listener_ip=all)
  3. for database_mirroring(authentication=certificate host_105,
  4.  encryption=required algorithm AES, role=all ); 

4. Back up the certificate and copy the certificate to the backup server.

 
 
  1. backup certificate host_105 to file='c:\host_105.cer'; 

5. Repeat steps 1-4 on the backup machine to replace all certificates with host_105 with host_106)

6. Create an SQL verification account on the host and bind it with the certificate

 
 
  1. create login mirror_b with password='xwj1234!@#$'
  2. create user mirror_b 
  3. for login mirror_bcreate certificate host_106
  4. authorization mirror_bfrom file='c:\host_106.cer'grant 
  5. connect on endpoint:: endport_mirror to mirror_b  

7. Create an SQL verification account on the image machine and bind it with the certificate

 
 
  1. create login mirror_a with password;='xwj1234!@#$'    
  2. create user mirror_a for login mirror_a;    
  3. grant connect on endpoint::   
  4. endport_mirror to mirror_a;  
  5. create certificate host_105authorization mirror_afrom file='c:\host_105.cer'; 

8. Create the mongo_test Database Log mode in the master database and set it to full mode and restore it on the mirror database. The Restore Mode is norecovery.

9. Synchronize Images

 
 
  1. --- Run alter database pai_test on the backup storage.
  2. Set partner = 'tcp: // 192.168.1.105: 8080'
  3. --- Run alter database pai_test on the host
  4. Set partner = 'tcp: // 192.168.1.106: 8080'
  5. --- Set to high-performance mode alter database pai_testset safety off

10 tests

 
 
  1. -- Run on host
  2. Create table test (id int );
  3. Insert into test select 1;
  4. -- Execute
  5. Create database pai_test_snp
  6. On primary
  7. (Name = 'mirror _ test', filename = 'C: \ pai_test.mdf ')
  8. As snapshot of snapshot _test;
  9. Use cmd_testselect * from test

11 open the Image Monitor

11. mirror + logshipping

Original article title: MSSQLMiRROR

Link: http://www.cnblogs.com/xwj1985/archive/2010/08/08/1795225.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.