<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>KodeeXII.Net &#187; configuring transactional replication</title>
	<atom:link href="http://kodeexii.net/tag/configuring-transactional-replication/feed" rel="self" type="application/rss+xml" />
	<link>http://kodeexii.net</link>
	<description>Hadee Roslan’s Ramblings on Technology, Mindset and Methodology to Build A Successful Online Business.</description>
	<lastBuildDate>Tue, 29 Nov 2011 10:47:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<atom:link rel='hub' href='http://kodeexii.net/?pushpress=hub'/>
<cloud domain='kodeexii.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
	<!-- google_ad_section_end --><!-- google_ad_section_start -->	<item>
		<title>Setting Up SQL Server 2005 Transactional Replication Without A Snapshot</title>
		<link>http://kodeexii.net/transactional-replication-without-snapshot.html</link>
		<comments>http://kodeexii.net/transactional-replication-without-snapshot.html#comments</comments>
		<pubDate>Tue, 20 Jan 2009 07:30:43 +0000</pubDate>
		<dc:creator>kodeexii</dc:creator>
				<category><![CDATA[Computer Technology]]></category>
		<category><![CDATA[configuring transactional replication]]></category>
		<category><![CDATA[set up transactional replication]]></category>
		<category><![CDATA[setup transaction replication]]></category>
		<category><![CDATA[transactional replication in sql server 2005]]></category>
		<category><![CDATA[transactional replication subscriber]]></category>
		<category><![CDATA[transactional replication without snapshot]]></category>

		<guid isPermaLink="false">http://kodeexii.net/blog/?p=703</guid>
		<description><![CDATA[By default, SQL Server 2005 Replication requires that an initial snapshot of the publishing database be created before a subscription is synchronized. For large databases, snapshot creation could take long hours and render the database unusable for quite a while. Is there a way to configure transactional replication without having an initial snapshot? Well, after googling and reading the many resources online, there indeed is a way. Interested? Read on..]]></description>
			<content:encoded><![CDATA[<p>Have you ever tried setting up a SQL Server Transactional Replication before? I had a chance to explore this the other day at a customer site. Setting up the publisher and subscriber bit was simple and easy by default. Thanks to the handy Wizard interface. However, we faced a tiny bit of a problem when using the wizard.</p>
<p>Yes, under normal circumstances, setting up a transactional replication with the wizard is really easy and dandy. The thing is, probably only a small percentage of live production databases fit in as normal.</p>
<p>I had a problem with the initial snapshot creation when setting up the transactional replication. This is using SQL Server 2005. The initial snapshot creation took ages to complete. Even after running it overnight, for 8 hours, it did not complete. The thing is, while the snapshot agent was running, the database was not accessible to other users. Is there a way to make the snapshot run under low priority? </p>
<p>Since I had to allow users access to the database, I had to stop the snapshot job. Will it start from scratch if restarted or will it continue from where it stopped? I tested and it seemed to start from scratch once again. Another 8+ hours? I don&#8217;t think so. Thus, I set out to find a way to create a transactional replication without a snapshot.</p>
<p>After <a  target="_blank" title="Search for Transactional Replication Without Snapshot" href="http://www.google.com.my/search?hl=en&#038;q=transactional+replication+without+snapshot&#038;btnG=Search&#038;meta=">googling for &#8220;transactional replication without  snapshot&#8221;</a> for a bit, I found <a  target="_blank" title="SQLServer Central Article by Andy Warren - Init From Backup" href="http://www.sqlservercentral.com/articles/Replication/61767/">the perfect solution to my problem</a>. I found that by using the <a  target="_blank" title="Microsoft TechNet Reference on sp_addsubscription" href="http://technet.microsoft.com/en-us/library/ms181702.aspx">stored procedure called sp_addsubscription()</a>, I can initialize a subscription without the need to create a snapshot of the publishing database. sp_addsubscription() allows me to initiate a subscription with the most recent backup of the publishing database.</p>
<p>No snapshot means no 8+ hours of waiting. I&#8217;ve got to try this out, I said to myself. So I did. I first tested it out in my test environment. It worked and thus, without hesitation, I proceeded to put it up into the production environment.</p>
<div id="attachment_708" class="wp-caption alignright" style="width: 160px"><a  href="http://kodeexii.net/blog/wp-content/uploads/2009/01/sql2005-publisher-snapshot.jpg" class="thickbox no_icon" rel="gallery-703" title="SQL2005 Publication Wizard Snapshot Agent"><img class="size-thumbnail wp-image-708" title="SQL2005 Publication Wizard Snapshot Agent" src="http://kodeexii.net/blog/wp-content/uploads/2009/01/sql2005-publisher-snapshot-150x150.jpg" alt="SQL2005 Publication Wizard Snapshot Agent" width="150" height="150" /></a><p class="wp-caption-text">SQL2005 Publication Wizard Snapshot Agent</p></div>
<p>How did I do it? Following are the steps to create a <a  target="_blank" title="Database Forums - SQL Server 2005 Transactional Replication without initial snapshot?!" href="http://www.mydatabasesupport.com/forums/ms-sqlserver/426321-sql-server-2005-transactional-replication-without-initial-snapshot.html">SQL Server 2005 Transactional Replication without an initial snapshot. </a></p>
<p>1. Create a new publication using the New Publication Wizard. Yes, you can still use the wizard to create the publication. Just fill in the fields and settings as required according to your environment. However, when you reach the SnapShot Agent dialog, leave all the checkboxes unchecked. You didn&#8217;t want a snapshot remember? That&#8217;s the only thing to note while going through the New Publication Wizard dialogs. </p>
<p>2. Upon completion of the New Publication Wizard, open the property dialog to your publication. You now need to modify a property setting on the publication. You need to set the publication to allow initialization from backup files. Yeah, that&#8217;s all there is to it. Just set this setting to True. It really would have been even more dandier if this could be performed within the New Publication Wizard though.</p>
<div id="attachment_709" class="wp-caption alignright" style="width: 160px"><a  href="http://kodeexii.net/blog/wp-content/uploads/2009/01/sql2005-publication-properties.jpg" class="thickbox no_icon" rel="gallery-703" title="SQL2005 Publication Properties"><img class="size-thumbnail wp-image-709" title="SQL2005 Publication Properties" src="http://kodeexii.net/blog/wp-content/uploads/2009/01/sql2005-publication-properties-150x150.jpg" alt="SQL2005 Publication Properties" width="150" height="150" /></a><p class="wp-caption-text">SQL2005 Publication Properties</p></div>
<p>3. Perform a full backup of your database. You need to run this backup from SQL Server itself, not any other third party backup tools. Backup the database to a directory accessible by the SQL Server, such as &#8220;&lt;SQLServer Directory&gt;\Backup\Database.bak&#8221;.</p>
<p>4. Restore the backup into the desired subscriber sql server instance. Don&#8217;t know how to restore from a SQL backup? Google it up. Really, it&#8217;s simple. Just run restore from the SQL Management Studio and point the wizard to the backup file. Of course you should copy the backup file into the server first.</p>
<p>5. Run the following stored procedure in the SQL Server Management Studio Query Window.<br />
<code><br />
sp_addsubscription <br />
@publication ='YourPublicationName', --your pub name here<br />
@subscriber='SubscriberServer\DBInstance', --subscriber server name<br />
@destination_db='SubscriberDatabase',<br />
@sync_type = 'initialize with backup',<br />
@backupdevicetype = 'disk',<br />
@backupdevicename = 'c:\&lt;SomeDirectory&gt;\Database.bak'<br />
go<br />
</code></p>
<p>When I ran the script above in my production environment, I encountered an error with regards to some Distribution Cleanup Job being active. After stopping and disabling the said Distribution Cleanup Job and rerunning the above stored procedure, I can see the new subscription listed under the publication. </p>
<p>Hence, my subscription was successfully created and initiated without the need of an initial snapshot that would take 8+ hours to complete.</p>
<p>The entire process from New Publication Wizard to completion of the stored procedure took roughly about 2 hours plus. The bulk of the time was spent waiting for  the following jobs to complete:</p>
<ol>
<li>backup publication database</li>
<li>copy backup to subscriber server</li>
<li>restoring subscriber database</li>
</ol>
<p>The transactional replication is now happily running between the two servers. Of course, the above process creates only a basic full database transactional replication. If your requirements are a litte bit more complicated, you might want to take a look at the options you can configure in the sp_addsubscription stored procedure.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting Up SQL Server 2005 Transactional Replication Without A Snapshot on KodeeXII.Net',url: 'http://kodeexii.net/transactional-replication-without-snapshot.html',contentID: 'post',code: 'Hade2895',suggestTags: 'configuring transactional replication,set up transactional replication,setup transaction replication,transactional replication in sql server 2005,transactional replication subscriber,transactional replication without snapshot',providerName: 'KodeeXII.Net',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://kodeexii.net/wp/wp-content/plugins/wp-evernote-site-memory/img/smallclip.png" class="evernoteSiteMemoryButton" /></a>
				<p class="evernoteSiteMemoryDescription">
					<strong>Evernote</strong> lets you save all the interesting things you see online into a single place. Access all those saved pages from your computer, phone or the web.  <a  href="https://www.evernote.com/Registration.action" title="Sign up for Evernote" target="_blank">Sign up now</a> or <a  href="https://www.evernote.com/about/learn_more/" title="Learn more about Evernote" target="_blank">learn more</a>. It's free!
				</p>
				
				<div class="evernoteSiteMemoryClear">&nbsp;</div>
			</div>]]></content:encoded>
			<wfw:commentRss>http://kodeexii.net/transactional-replication-without-snapshot.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	<!-- google_ad_section_end --></channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 74/88 queries in 1.885 seconds using disk: basic
Object Caching 948/965 objects using disk: basic

Served from: kodeexii.net @ 2012-02-11 13:31:28 -->
