Advertisement
Guest User

Untitled

a guest
Aug 25th, 2014
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.86 KB | None | 0 0
  1. -- Enabling the replication database
  2. use master
  3. exec sp_replicationdboption @dbname = N'PROD_DB', @optname = N'publish', @value = N'true'
  4. GO
  5.  
  6. exec [PROD_DB].sys.sp_addlogreader_agent @job_login = null, @job_password = null, @publisher_security_mode = 1
  7. GO
  8. exec [PROD_DB].sys.sp_addqreader_agent @job_login = null, @job_password = null, @frompublisher = 1
  9. GO
  10. -- Adding the snapshot publication
  11. use [PROD_DB]
  12. 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
  13. GO
  14.  
  15. 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
  16. exec sp_grant_publication_access @publication = N'MY_PUBLICATION', @login = N'sa'
  17. GO
  18. exec sp_grant_publication_access @publication = N'MY_PUBLICATION', @login = N'NT AUTHORITYSYSTEM'
  19. GO
  20. exec sp_grant_publication_access @publication = N'MY_PUBLICATION', @login = N'NT AUTHORITYNETWORK SERVICE'
  21. GO
  22. exec sp_grant_publication_access @publication = N'MY_PUBLICATION', @login = N'mydomainsvc_account'
  23. GO
  24. exec sp_grant_publication_access @publication = N'MY_PUBLICATION', @login = N'NT SERVICESQLSERVERAGENT'
  25. GO
  26. exec sp_grant_publication_access @publication = N'MY_PUBLICATION', @login = N'NT SERVICEMSSQLSERVER'
  27. GO
  28. exec sp_grant_publication_access @publication = N'MY_PUBLICATION', @login = N'distributor_admin'
  29. GO
  30.  
  31. -- Adding the snapshot articles
  32. use [PROD_DB]
  33. 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'
  34.  
  35. -- Adding the article's partition column(s)
  36. 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
  37. 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
  38. 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
  39. 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
  40.  
  41. -- Adding the article synchronization object
  42. 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
  43. GO
  44.  
  45. The replication option 'publish' of database 'PROD_DB' has already been set to true.
  46. Job 'PROD_SERVER-PROD_DB-8' started successfully.
  47. Msg 156, Level 15, State 1: Incorrect syntax near the keyword 'from'.
  48. Msg 21745, Level 16, State 1, Procedure sp_MSrepl_articleview, Line 272
  49. 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.
  50. Msg 20027, Level 11, State 1, Procedure sp_MSrepl_articlecolumn, Line 152
  51. The article 'MY_TABLE_1' does not exist.
  52. Msg 20027, Level 11, State 1, Procedure sp_MSrepl_articlecolumn, Line 152
  53. The article 'MY_TABLE_1' does not exist.
  54. Msg 20027, Level 11, State 1, Procedure sp_MSrepl_articlecolumn, Line 152
  55. The article 'MY_TABLE_1' does not exist.
  56. Msg 20027, Level 11, State 1, Procedure sp_MSrepl_articlecolumn, Line 152
  57. The article 'MY_TABLE_1' does not exist.
  58. Msg 20027, Level 11, State 1, Procedure sp_MSrepl_articleview, Line 128
  59. The article 'MY_TABLE_1' does not exist.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement