Home Database Mysql Tutorial SQLSERVER复制的要点

SQLSERVER复制的要点

Jun 07, 2016 pm 05:42 PM
sqlserver copy Main points

SQLSERVER复制的要点 在论坛里经常有人问: SQLSERVER复制出问题了!!SQLSERVER复制不运行了!! SQLSERVER复制遇到阻塞了!! 然后最后来一句:怎麽办??????????????? 大家知道:我们使用SQLSERVER复制功能主要用来读写分离,当然还有其他

SQLSERVER复制的要点

在论坛里经常有人问:SQLSERVER复制出问题了!!SQLSERVER复制不运行了!!SQLSERVER复制遇到阻塞了!!

然后最后来一句:“怎麽办???????????????”

大家知道:我们使用SQLSERVER复制功能主要用来读写分离,当然还有其他的场景会用到SQLSERVER复制,不过大部分还是用在"读写分离"

根据《SQLSERVER数据库大型应用解决方案总结》里总结的SQLSERVER复制的优缺点

文章地址:

优缺点 :

(1) 数据的实时性差:数据不是实时同步到自读服务器上的,当数据写入主服务器后,要在下次同步后才能查询到。

(2) 数据量大时同步效率差:单表数据量过大时插入和更新因索引,磁盘IO等问题,性能会变的很差。

(3) 同时连接多个(至少两个)数据库:至少要连接到两个数据数据库,实际的读写操作是在程序代码中完成的,容易引起混乱。

(4) 读具有高性能高可靠性和可伸缩:只读服务器,免备案空间,因为没有写操作,会大大减轻磁盘IO等性能问题,大大提高效率。

只读服务器可以采用负载均衡,主数据库发布到多个只读服务器上实现读操作的可伸缩性。

 ------------------------------------------------------华丽的分割线-----------------------------------------------------------

其实我们可以只同步某些表,不需要将整个数据库里的所有表都同步到订阅服务器上,而且SQLSERVER还支持只同步一张表里的某些列

有些人就是将整个数据库里的表都同步,不管哪些表是经常访问的,哪些表数据量比较大,哪些表不适合加主键或者索引

因为同步的一个条件是,表里必须要有主键,如果你需要同步所有表,那不是所有表都要加上主键??大家知道加上主键

相当于给表加了聚集索引,那么肯定影响数据修改的性能,所以大家只需要把需要同步/发布的表发布出来就可以了

没必要把整个库都发布出来,还有一些存储过程、函数、视图也是一样,只需要同步经常访问的或者必须要用到的就可以了

--------------------------------------------------------华丽的分割线---------------------------------------------------------

复制的前提条件:

(1)为了提高执行效率,可以限制订阅服务器获得的所有数据,或仅发布订阅者真正需要的数据或订阅者有权得到的数据
 
(2)在实现快照复制之前,网站空间,为快照复制留出充足的磁盘空间
 
(3)在实现事务复制之前,分配足够的日志空间,为分发数据库留有足够的磁盘空间
 
(4)为每一个表创建主键
 
(5)实现合并复制前移去timestamp列,由于订阅服务器的数据也会传递到发布服务器,

应确保数据的完整性在各个订阅服务器上都能得到保证,维护表之间的关联参照

(6)在所有IDENTITY属性字段上加上NOT FOR REPLICATION设置,以保证SQLSERVER在复制代理程序所添加的行上保留起始标识值,

但是继续在其他用户所添加的行上增加标识值。当用户将某个新行添加到表时,标志值以通常的方式增加。当复制代理程序将该新行复制到

订阅服务器时,再将该行插入到订阅服务器表中时不更改标识值

----------------------------------------------------------华丽的分割线-----------------------------------------------------

下面附上我写的一篇文章,虚拟主机,关于复制的介绍和复制的注意事项,如果提高复制性能,定制复制标准,定义复制等

SQLSERVER复制

1、只发布必要的表或字段

2、定制性能标准

3、提高常规复制的性能

里面有几个注意点,希望读者可以详细认真地读一下,o(∩_∩)o

希望文章能帮到大家

如有不对的地方,欢迎大家拍砖!!

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)

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 solve the problem that the object named already exists in the sqlserver database How to solve the problem that the object named already exists in the sqlserver database Apr 05, 2024 pm 09:42 PM

For objects with the same name that already exist in the SQL Server database, the following steps need to be taken: Confirm the object type (table, view, stored procedure). IF NOT EXISTS can be used to skip creation if the object is empty. If the object has data, use a different name or modify the structure. Use DROP to delete existing objects (use caution, backup recommended). Check for schema changes to make sure there are no references to deleted or renamed objects.

How to check sqlserver port number How to check sqlserver port number Apr 05, 2024 pm 09:57 PM

To view the SQL Server port number: Open SSMS and connect to the server. Find the server name in Object Explorer, right-click it and select Properties. In the Connection tab, view the TCP Port field.

What to do if the sqlserver service cannot be started What to do if the sqlserver service cannot be started Apr 05, 2024 pm 10:00 PM

When the SQL Server service fails to start, here are some steps to resolve: Check the error log to determine the root cause. Make sure the service account has permission to start the service. Check whether dependency services are running. Disable antivirus software. Repair SQL Server installation. If the repair does not work, reinstall SQL Server.

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.

Where is the sqlserver database? Where is the sqlserver database? Apr 05, 2024 pm 08:21 PM

SQL Server database files are usually stored in the following default location: Windows: C:\Program Files\Microsoft SQL Server\MSSQL\DATALinux: /var/opt/mssql/data The database file location can be customized by modifying the database file path setting.

How to copy lyrics from QQ Music How to copy lyrics How to copy lyrics from QQ Music How to copy lyrics Mar 12, 2024 pm 08:22 PM

We users should be able to understand the diversity of some functions when using this platform. We know that the lyrics of some songs are very well written. Sometimes we even listen to it several times and feel that the meaning is very profound. So if we want to understand the meaning of it, we want to copy it directly and use it as copywriting. However, if we want to use it, we still need to You just need to learn how to copy lyrics. I believe that everyone is familiar with these operations, but it is indeed a bit difficult to operate on a mobile phone. So in order to give you a better understanding, today the editor is here to help you. A good explanation of some of the above operating experiences. If you also like it, come and take a look with the editor. Don’t miss it.​

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

See all articles