/
osbornray
/
PythonHacks
Обзор
Документация
Войти
/
osbornray
/
PythonHacks
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
AWS_MS_SQL/ConfigSourceSQLServer.sql
33 строки
2 KB
RekhuGopal
Updated to sns
23 апр 2023, 07:31
23 апр 2023, 07:31
cdbd6b7
Код
Авторство
О чём код?
--Set master database context use [master] GO --Add the awssct login to the sysadmin server role - required for replication ALTER SERVER ROLE [sysadmin] ADD MEMBER [awssct] GO --Set the recovery model to full for dms_sample - required for replication ALTER DATABASE [dms_sample] SET RECOVERY FULL WITH NO_WAIT GO --Configure this SQL Server as its own distributor exec sp_adddistributor @distributor = @@SERVERNAME, @password = N'Password1' exec sp_adddistributiondb @database = N'distribution', @data_folder = N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA', @log_folder = N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Data', @log_file_size = 2, @min_distretention = 0, @max_distretention = 72, @history_retention = 48, @security_mode = 1 GO --Change context to the distribution database use [distribution] GO --Configure replication if (not exists (select * from sysobjects where name = 'UIProperties' and type = 'U ')) create table UIProperties(id int) if (exists (select * from ::fn_listextendedproperty('SnapshotFolder', 'user', 'dbo', 'table', 'UIProperties', null, null))) EXEC sp_updateextendedproperty N'SnapshotFolder', N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\ReplData', 'user', dbo, 'table', 'UIProperties' else EXEC sp_addextendedproperty N'SnapshotFolder', N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\ReplData', 'user', dbo, 'table', 'UIProperties' GO exec sp_adddistpublisher @publisher = @@SERVERNAME, @distribution_db = N'distribution', @security_mode = 1, @working_directory = N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\ReplData', @trusted = N'false', @thirdparty_flag = 0, @publisher_type = N'MSSQLSERVER' GO