Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Enabling the replication database
- use master
- exec sp_replicationdboption @dbname = N'PROD_DB', @optname = N'publish', @value = N'true'
- GO
- exec [PROD_DB].sys.sp_addlogreader_agent @job_login = null, @job_password = null, @publisher_security_mode = 1
- GO
- exec [PROD_DB].sys.sp_addqreader_agent @job_login = null, @job_password = null, @frompublisher = 1
- GO
- -- Adding the snapshot publication
- use [PROD_DB]
- exec sp_addpublication @publication = N'MY_PUBLICATION', @description = N'Snapshot publication of database ''PROD_DB'' from Publisher ''PROD_SERVER''.', @sync_method = N'native', @retention = 0, @allow_push = N'true', @allow_pull = N'true', @allow_anonymous = N'true', @enabled_for_internet = N'false', @snapshot_in_defaultfolder = N'false', @alt_snapshot_folder = N'\PROD_SERVERc$ReplData', @compress_snapshot = N'false', @ftp_port = 21, @ftp_login = N'anonymous', @allow_subscription_copy = N'false', @add_to_active_directory = N'false', @repl_freq = N'snapshot', @status = N'active', @independent_agent = N'true', @immediate_sync = N'true', @allow_sync_tran = N'false', @autogen_sync_procs = N'false', @allow_queued_tran = N'false', @allow_dts = N'false', @replicate_ddl = 1
- GO
- exec sp_addpublication_snapshot @publication = N'MY_PUBLICATION', @frequency_type = 4, @frequency_interval = 1, @frequency_relative_interval = 0, @frequency_recurrence_factor = 0, @frequency_subday = 8, @frequency_subday_interval = 6, @active_start_time_of_day = 172234, @active_end_time_of_day = 162234, @active_start_date = 0, @active_end_date = 0, @job_login = N'mydomainsvc_account', @job_password = N'securepassword123', @publisher_security_mode = 1
- exec sp_grant_publication_access @publication = N'MY_PUBLICATION', @login = N'sa'
- GO
- exec sp_grant_publication_access @publication = N'MY_PUBLICATION', @login = N'NT AUTHORITYSYSTEM'
- GO
- exec sp_grant_publication_access @publication = N'MY_PUBLICATION', @login = N'NT AUTHORITYNETWORK SERVICE'
- GO
- exec sp_grant_publication_access @publication = N'MY_PUBLICATION', @login = N'mydomainsvc_account'
- GO
- exec sp_grant_publication_access @publication = N'MY_PUBLICATION', @login = N'NT SERVICESQLSERVERAGENT'
- GO
- exec sp_grant_publication_access @publication = N'MY_PUBLICATION', @login = N'NT SERVICEMSSQLSERVER'
- GO
- exec sp_grant_publication_access @publication = N'MY_PUBLICATION', @login = N'distributor_admin'
- GO
- -- Adding the snapshot articles
- use [PROD_DB]
- exec sp_addarticle @publication = N'MY_PUBLICATION', @article = N'MY_TABLE_1', @source_owner = N'dbo', @source_object = N'MY_TABLE_1', @type = N'logbased', @description = N'', @creation_script = N'', @pre_creation_cmd = N'drop', @schema_option = 0x000000000803509D, @identityrangemanagementoption = N'none', @destination_table = N'MY_TABLE_1', @destination_owner = N'dbo', @status = 24, @vertical_partition = N'true', @ins_cmd = N'SQL', @del_cmd = N'SQL', @upd_cmd = N'SQL'
- -- Adding the article's partition column(s)
- exec sp_articlecolumn @publication = N'MY_PUBLICATION', @article = N'MY_TABLE_1', @column = N'ID', @operation = N'add', @force_invalidate_snapshot = 1, @force_reinit_subscription = 1
- exec sp_articlecolumn @publication = N'MY_PUBLICATION', @article = N'MY_TABLE_1', @column = N'DATA_1', @operation = N'add', @force_invalidate_snapshot = 1, @force_reinit_subscription = 1
- exec sp_articlecolumn @publication = N'MY_PUBLICATION', @article = N'MY_TABLE_1', @column = N'DATA_2', @operation = N'add', @force_invalidate_snapshot = 1, @force_reinit_subscription = 1
- exec sp_articlecolumn @publication = N'MY_PUBLICATION', @article = N'MY_TABLE_1', @column = N'DATA_3', @operation = N'add', @force_invalidate_snapshot = 1, @force_reinit_subscription = 1
- -- Adding the article synchronization object
- exec sp_articleview @publication = N'MY_PUBLICATION', @article = N'MY_TABLE_1', @view_name = N'SYNC_MY_TABLE_1_1__95', @filter_clause = N'', @force_invalidate_snapshot = 1, @force_reinit_subscription = 1
- GO
- The replication option 'publish' of database 'PROD_DB' has already been set to true.
- Job 'PROD_SERVER-PROD_DB-8' started successfully.
- Msg 156, Level 15, State 1: Incorrect syntax near the keyword 'from'.
- Msg 21745, Level 16, State 1, Procedure sp_MSrepl_articleview, Line 272
- Cannot generate a filter view or procedure. Verify that the value specified for the @filter_clause parameter of sp_addarticle can be added to the WHERE clause of a SELECT statement to produce a valid query.
- Msg 20027, Level 11, State 1, Procedure sp_MSrepl_articlecolumn, Line 152
- The article 'MY_TABLE_1' does not exist.
- Msg 20027, Level 11, State 1, Procedure sp_MSrepl_articlecolumn, Line 152
- The article 'MY_TABLE_1' does not exist.
- Msg 20027, Level 11, State 1, Procedure sp_MSrepl_articlecolumn, Line 152
- The article 'MY_TABLE_1' does not exist.
- Msg 20027, Level 11, State 1, Procedure sp_MSrepl_articlecolumn, Line 152
- The article 'MY_TABLE_1' does not exist.
- Msg 20027, Level 11, State 1, Procedure sp_MSrepl_articleview, Line 128
- The article 'MY_TABLE_1' does not exist.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement