<?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>database replication &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/database-replication/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Mon, 04 Jul 2016 18:36:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>SQL Server: Database Replication Interview Questions and Answers (Day-7)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-replication-interview-questions-and-answers-monitor-secure-replication-compressed-snapshot-sp_replcounters-day-7/</link>
					<comments>https://www.dbrnd.com/2016/07/sql-server-database-replication-interview-questions-and-answers-monitor-secure-replication-compressed-snapshot-sp_replcounters-day-7/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 04 Jul 2016 18:34:51 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[compressed snapshot]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database replication]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[monitor replication]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[secure replication]]></category>
		<category><![CDATA[sp_replcounters]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3283</guid>

					<description><![CDATA[What should be your steps and consideration to monitor the SQL Server Replication? Set the agent profiles, schedules, properties, and notifications for replication agents. View and troubleshoot agent activity, including verifying when agents last ran, monitoring agent activity, and analyzing replication performance. Receive notification through a replication alert when an event occurs on a replication [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-monitor-secure-replication-compressed-snapshot-sp_replcounters-day-7%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-7%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-monitor-secure-replication-compressed-snapshot-sp_replcounters-day-7%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-7%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-monitor-secure-replication-compressed-snapshot-sp_replcounters-day-7%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-7%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-monitor-secure-replication-compressed-snapshot-sp_replcounters-day-7%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-7%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-monitor-secure-replication-compressed-snapshot-sp_replcounters-day-7%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-7%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-monitor-secure-replication-compressed-snapshot-sp_replcounters-day-7%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-7%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-monitor-secure-replication-compressed-snapshot-sp_replcounters-day-7%2F&#038;title=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-7%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-replication-interview-questions-and-answers-monitor-secure-replication-compressed-snapshot-sp_replcounters-day-7/" data-a2a-title="SQL Server: Database Replication Interview Questions and Answers (Day-7)"></a></p><p><strong>What should be your steps and consideration to monitor the SQL Server Replication?</strong></p>
<ul>
<li>Set the agent profiles, schedules, properties, and notifications for replication agents.</li>
<li>View and troubleshoot agent activity, including verifying when agents last ran, monitoring agent activity, and analyzing replication performance.</li>
<li>Receive notification through a replication alert when an event occurs on a replication agent.</li>
<li>Validate subscriptions to ensure that data values are the same at the Publisher and at Subscribers.</li>
<li>Reinitialize one or all subscriptions to a publication as needed.</li>
<li>Manage replication agents from a central location.</li>
</ul>
<p><strong>Have you ever used Replication Monitor component of SQL Server Enterprise Manager?</strong></p>
<blockquote><p>Yes: for viewing the status of replication agents and troubleshooting potential problems at the Distributor. Replication Monitor shows up as a node in SQL Server Enterprise Manager under the server that is enabled as a Distributor when the user is a member of the sysadmin fixed server role.</p></blockquote>
<p><strong>What do you know about the Heterogeneous Database Replication and have you ever tried to replicate data from SQL Server to non-SQL Server subscribers?</strong></p>
<blockquote><p>Yes, Heterogeneous data source means data source other than SQL Server.</p>
<p>SQL Server supports publishing of data using ODBC or OLEDB driver.</p>
<p>It also supports publishing data from Oracle to SQL Server and publishing data from SQL Server to non-SQL Server Subscribers.</p></blockquote>
<p><strong>Does activity need to be stopped on a database when it is published?</strong></p>
<blockquote><p>No. Activity can continue on a database while a publication is being created. Be aware that producing a snapshot can be resource-intensive, so it is best to generate snapshots during periods of lower activity on the database (by default a snapshot is generated when you complete the New Publication Wizard).</p></blockquote>
<p><strong>What happens if the Snapshot Agent has not completed when the Distribution or Merge Agent starts?</strong></p>
<blockquote><p>It will not cause an error if the Distribution Agent or Merge Agent runs at the same time as the Snapshot Agent.</p></blockquote>
<p><strong>Should I script my replication configuration?</strong></p>
<blockquote><p>Yes. Scripting the replication configuration is a key part of any disaster recovery plan for a replication topology.</p></blockquote>
<p><strong>How do I replicate data over the Internet?</strong></p>
<blockquote><p>Replicate data over the Internet using:</p>
<p>A Virtual Private Network (VPN). For more information, see Publish Data over the Internet Using VPN.</p>
<p>The Web synchronization option for merge replication. For more information, see Web Synchronization for Merge Replication.</p></blockquote>
<p><strong>Does replication work over low bandwidth connections? Does it use compression?</strong></p>
<blockquote><p>Yes, replication does work over low bandwidth connections. For connections over TCP/IP, it uses the compression provided by the protocol but does not provide additional compression. For Web synchronization connections over HTTPS, it uses the compression provided by the protocol and also additional compression of the XML files used to replicate changes.</p></blockquote>
<p><strong>In Transactional replication, If a table in database ‘A’(Publisher) is dropped, will the table get dropped in ‘B’(Subscriber)?</strong></p>
<blockquote><p>You cannot drop a table that is replicated. You have to first drop the article.</p></blockquote>
<p><strong>In Transactional Replication, If we drop a column in a table in database ‘A’, what will happen to the column in the same table in database ‘B’?</strong></p>
<blockquote><p>Issuing ALTER TABLE … DROP COLUMN at the Publisher, will result in the command being replicated to the Subscriber.</p></blockquote>
<p><strong>How can I prevent the snapshot agent failing with ‘Server execution failed’?</strong></p>
<blockquote><p>The value of:</p>
<p>“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent\Subsystems\Snapshot”</p>
<p>should be changed to:</p>
<p>C:\Program Files\Microsoft SQL Server\MSSQL\BINN\SQLREPSS.DLL,C:\Program Files\Microsoft SQL Server\80\COM\SNAPSHOT.EXE,ReplStart,ReplEvent,ReplStop,120</p></blockquote>
<p><strong>What is the effect of running a bulk insert command on a replicated database?</strong></p>
<blockquote><p>For transactional replication, bulk inserts are tracked and replicated like other inserts. For merge replication, you must ensure that change tracking metadata is updated properly.</p></blockquote>
<p><strong>What Options we use to secure Replication Data?</strong></p>
<blockquote><p>Ensure that SQL Browser is running and TCP/IP is enabled. Enforce TDE (Transparent Data Encryption) so that every data bit is encrypted.</p></blockquote>
<p><strong>Why you should consider Compressed Snapshots?</strong></p>
<blockquote><p>Compressing snapshot files in the alternate snapshot folder can reduce snapshot disk storage requirements and, in some cases, improve the performance of transferring snapshot files across the network when they are used for replication over the Internet. However, compressing the snapshot requires additional processing by the Snapshot Agent when generating the snapshot files, and by the merge agent when applying the snapshot files.</p></blockquote>
<p><strong>What are the different stored procedure to manage tracer tokens?</strong></p>
<ul>
<li>sp_posttracertoken (used to push a token into a publication).</li>
<li>sp_helptracertokens (returns a row for each tracer token that has been inserted at a publisher for a given publication).</li>
<li>sp_helptracertokenhistory (returns latency information for a given token id value retrieved from either of the procedures above).</li>
<li>sp_deletetracertokenhistory (removes token records from the system meta tables).</li>
</ul>
<p><strong>How could you replicate data between different schemas?</strong></p>
<blockquote><p>When we setup replication we don&#8217;t change a lot of the default values. One of the default configuration values is Replication Schema which is set to Destination Object Owner ( Subscriber Articles Owner) will be same as of Source Object Owner.</p>
<p>If we have Publication articles configured under the ABC schema then by default the Subscriber schema will also be ABC. By adjusting the subscriber schema, we can create the tables on the subscriber under a different schema without impacting the existing tables.</p></blockquote>
<p><strong>Would you please explain the output of sp_replcounters?</strong></p>
<ul>
<li>Database &#8211; publisher database</li>
<li>Replicated transactions &#8211; Number of transactions in the log awaiting delivery to the distribution database</li>
<li>Replication rate trans/sec &#8211; Average number of transactions per second delivered to the distribution database</li>
<li>Replication latency &#8211; Average time, in seconds, that transactions were in the log before being distributed</li>
<li>Replbeginlsn &#8211; Log sequence number (LSN) of the current truncation point in the log</li>
<li>Replendlsn &#8211; LSN of the next commit record awaiting delivery to the distribution database</li>
</ul>
<p><strong>What should I do if my system is running out of memory when too many agents synchronize?</strong></p>
<blockquote><p>You can limit the number of concurrent synchronizations; in merge this is done on the GUI or by setting the @max_concurrent_merge property of sp_addmergepublication. For other agents you’ll need to make the necessary edits to the registry.</p></blockquote>
<p><strong>What options are there to delete rows on the publisher and not on the subscriber?</strong></p>
<blockquote><p>One option is to replicate stored procedure execution instead of the actual DELETE command.  You can create two different versions of the stored procedures one on the publisher that does the delete and the other on the subscriber that does not do the delete.</p>
<p>Another option is to not replicate DELETE commands.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/07/sql-server-database-replication-interview-questions-and-answers-monitor-secure-replication-compressed-snapshot-sp_replcounters-day-7/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: Database Replication Interview Questions and Answers (Day-6)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-replication-interview-questions-and-answers-drop-replicated-performance-local-global-subscriber-day-6/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 03 Jul 2016 20:09:51 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database replication]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[global subscriber]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[local subscriber]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[replication performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[truncate replication]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3277</guid>

					<description><![CDATA[How do I drop a table that is being replicated? First drop the article from the publication using sp_droparticle, sp_dropmergearticle, or the Publication Properties &#8211; &#60;Publication&#62; dialog box, and then drop it from the database using DROP &#60;Object&#62;. How do I remove a table from a publication? Remove a table from the publication using sp_droparticle, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-drop-replicated-performance-local-global-subscriber-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-6%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-drop-replicated-performance-local-global-subscriber-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-6%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-drop-replicated-performance-local-global-subscriber-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-6%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-drop-replicated-performance-local-global-subscriber-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-6%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-drop-replicated-performance-local-global-subscriber-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-6%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-drop-replicated-performance-local-global-subscriber-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-6%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-drop-replicated-performance-local-global-subscriber-day-6%2F&#038;title=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-6%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-replication-interview-questions-and-answers-drop-replicated-performance-local-global-subscriber-day-6/" data-a2a-title="SQL Server: Database Replication Interview Questions and Answers (Day-6)"></a></p><p><strong>How do I drop a table that is being replicated?</strong></p>
<blockquote><p>First drop the article from the publication using sp_droparticle, sp_dropmergearticle, or the Publication Properties &#8211; &lt;Publication&gt; dialog box, and then drop it from the database using DROP &lt;Object&gt;.</p></blockquote>
<p><strong>How do I remove a table from a publication?</strong></p>
<blockquote><p>Remove a table from the publication using sp_droparticle, sp_dropmergearticle, or the Publication Properties &#8211; &lt;Publication&gt; dialog box.</p></blockquote>
<p><strong>Does replication work in conjunction with clustering?</strong></p>
<blockquote><p>Yes. No special considerations are required because all data is stored on one set of disks on the cluster.</p></blockquote>
<p><strong>Why can’t I run TRUNCATE TABLE on a published table?</strong></p>
<blockquote><p>TRUNCATE TABLE is a non-logged operation that does not fire triggers. It is not permitted because replication cannot track the changes caused by the operation: transactional replication tracks changes through the transaction log; merge replication tracks changes through triggers on published tables.</p></blockquote>
<p><strong>Does replication resume if a connection is dropped or do we need to reinitialize the replication?</strong></p>
<blockquote><p>Yes. Replication processing resumes at the point at which it left off if a connection is dropped. If you are using merge replication over an unreliable network, consider using logical records, which ensures related changes are processed as a unit.</p></blockquote>
<p><strong>What options are available to delete rows on the publisher and not on the subscriber?</strong></p>
<blockquote><p>One option is to replicate stored procedure execution instead of the actual DELETE command.  You can create two different versions of the stored procedures one on the publisher that does the delete and the other on the subscriber that does not do the delete.</p>
<p>Another option is to not replicate DELETE commands.</p></blockquote>
<p><strong>What should be our ultimate steps for Enhancing Replication Performance?</strong></p>
<ul>
<li>Setting a minimum amount of memory.</li>
<li>Using a separate disk drive for the transaction log for all databases involved in replication.</li>
<li>Consider adding memory to servers used in replication.</li>
<li>Using multiprocessor computers.</li>
<li>Setting a fixed size for the distribution database.</li>
<li>Publishing only the amount of data required.</li>
<li>Running the Snapshot Agent only when necessary and at off-peak times.</li>
<li>Placing the snapshot folder on a drive not used to store database or log files.</li>
<li>Using a single snapshot folder per publication.</li>
<li>Consider using compressed snapshot files.</li>
<li>Reducing the distribution frequency when replicating to numerous Subscribers.</li>
<li>Consider use of pull or anonymous subscriptions.</li>
<li>Reduce the verbose level of replication agents to &#8216;0&#8217; except during initial testing, monitoring, or debugging.</li>
<li>Run agents continuously instead of on very frequent schedules.</li>
<li>Consider using the –UseInprocLoader agent property.</li>
</ul>
<p><strong>Why backup of Publisher, Distributor and Subscriber is very important?</strong></p>
<blockquote><p>Publication databases are the primary, or central source, of data in a replication topology; therefore, even the most basic recovery plan should include regular backups at the Publisher. Back up the publication database and then make transaction log backups and/or differential database backups.</p>
<p>Backing up the Distributor involves backing up the distribution database, the msdb database, and the master system database. This allows you to recover from almost any type of failure without having to re-create publications or reconfigure replication.</p>
<p>Backing up the Distributor preserves the snapshot of the publication as well as the history, error, and replication agent information for your application.</p>
<p>Backing up the Subscriber involves backing up the subscription database and, optionally, the msdb and master system databases. The msdb and master databases need to be backed up only if it is a Subscriber that uses pull subscriptions and only if there is a need to be able to restore after a total system loss.</p></blockquote>
<p><strong>How can grants on the subscription database be configured to match grants on the publication database?</strong></p>
<ul>
<li>Execute GRANT statements at the subscription database directly.</li>
<li>Use a post-snapshot script to execute the statements.</li>
<li>Use the stored procedure sp_addscriptexec to execute the statements.</li>
</ul>
<p><strong>What happens to permissions granted in a subscription database if a subscription is reinitialized?</strong></p>
<blockquote><p>By default, objects at the Subscriber are dropped and recreated when a subscription is reinitialized, which causes all granted permissions for those objects to be dropped.</p></blockquote>
<p><strong>What is a Local Subscriber?</strong></p>
<blockquote><p>A local subscriber is one that is defined with a priority setting used in conflict resolution. The priority setting is from 1 to 99.</p></blockquote>
<p><strong>What is a Global Subscriber?</strong></p>
<blockquote><p>A global subscriber has no priority and uses the distributor as the proxy for determining priority for conflict resolution.</p></blockquote>
<p><strong>I am running out of disk space for one of my SQL Server replicated databases. I would like to move the database files of my publication database, which is part of transactional replication, to a drive on the same server, which is has more free space.</strong></p>
<p><strong>What are the different options to do this task?</strong></p>
<blockquote><p><strong>Option 1:</strong> sp_detach_db</p>
<p>Before using this option, we need to disable the publishing option using the sp_replicationdboption stored procedure.</p>
<p>if this stored procedure does not work, we need to use the sp_removedbreplication stored procedure, which removes all the replication objects in the database.</p>
<p>After that, we can use sp_detach_db option.</p>
<p><strong>Option 2:</strong> ALTER DATABASE MODIFY FILE</p>
<p>Using this option we can modify the file path, but before that we have to make database offline and after changing the new path we have to make database online.</p></blockquote>
<p><strong>We are using replicated Subscriber databases for reporting and other purposes in our environment. As such, we have differing index needs based on the user activity on the publisher tables vs. the subscriber tables.</strong></p>
<p><strong>Unfortunately, whenever we reinitialize replication, we have missing indexes on the tables. Since the index needs are different between the publisher and subscriber, I do not also want to replicate all indexes from the publisher using the schema options that I wrote previously. How can I address these issues?</strong></p>
<blockquote><p>SQL Server Replication has a feature at the snapshot level called &#8220;Run additional scripts&#8221; which can be setup before and/or after the snapshot is refreshed. These options provide an opportunity to address our differing index needs between the publisher and subscriber.</p>
<p><a href="https://www.mssqltips.com/sqlservertip/2116/maintain-custom-indexes-on-replication-subscriber-tables-via-pre-and-post-scripts/" target="_blank">For more details, You can visit this article.</a></p></blockquote>
<p><strong>T-SQL script to read Replication error log.</strong></p><pre class="crayon-plain-tag">EXEC sys.sp_readerrorlog 0,1,'Replication','-'</pre><p>
<strong>We set up replication initially by using the GUI and accepting all defaults and now due to growth we need to change our default replication snapshot folder location to another drive since the current location is a local disk and cannot be expanded to accommodate our growth.</strong></p>
<p><strong>How it is possible?</strong></p>
<p><a href="https://www.mssqltips.com/sqlservertip/2785/changing-sql-servers-default-snapshot-folder-for-replication/" target="_blank">For more details, You can visit this article. </a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Database Replication Interview Questions and Answers (Day-5)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-replication-interview-questions-and-answers-immediate-sync-tracer-token-row-filter-article-publication-day-5/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 02 Jul 2016 21:01:11 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[article]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database replication]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[immediate sync]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[parameterized row filter]]></category>
		<category><![CDATA[publication]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[tracer tokens]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3274</guid>

					<description><![CDATA[What is the role of the Immediate Sync option for SQL Server Replication? You can see that the immediate_sync option set to TRUE is useful especially if you have the requirement of adding new subscriptions during the course of the retention period. You can also see that the data in the distribution database replication tables [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-immediate-sync-tracer-token-row-filter-article-publication-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-5%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-immediate-sync-tracer-token-row-filter-article-publication-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-5%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-immediate-sync-tracer-token-row-filter-article-publication-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-5%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-immediate-sync-tracer-token-row-filter-article-publication-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-5%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-immediate-sync-tracer-token-row-filter-article-publication-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-5%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-immediate-sync-tracer-token-row-filter-article-publication-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-5%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-immediate-sync-tracer-token-row-filter-article-publication-day-5%2F&#038;title=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-5%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-replication-interview-questions-and-answers-immediate-sync-tracer-token-row-filter-article-publication-day-5/" data-a2a-title="SQL Server: Database Replication Interview Questions and Answers (Day-5)"></a></p><p><strong>What is the role of the Immediate Sync option for SQL Server Replication?</strong></p>
<blockquote><p>You can see that the immediate_sync option set to TRUE is useful especially if you have the requirement of adding new subscriptions during the course of the retention period. You can also see that the data in the distribution database replication tables gets maintained even though the data is already replicated from the publisher to the subscriber.</p></blockquote>
<p><strong>We have two instances SERV1 and SERV2 with publication database db1 on SERV1 and subscriber database db1 on SERV2. Now we need to move the subscriber from SERV2 to SERV3 without dropping the existing subscription and creating a new subscription on the new server.</strong></p>
<p><strong>How it is possible?</strong></p>
<ul>
<li>Create a full SQL Server database backup on existing Subscriber.</li>
<li>Copy SQL Server backup and restore on new Subscriber with KEEP_REPLICATION option.</li>
<li>Update replication tables on SQL Server Publisher database.</li>
<li>Update the SQL Server replication tables on new Subscriber database.</li>
<li>Update SQL Server replication tables on Distribution database.</li>
<li>Modify the SQL Server Agent Job.</li>
<li>Re-enable Synchronizing for the SQL Server Publication.</li>
</ul>
<p><strong>What is Parameterized Row Filters option of Merge Replication?</strong></p>
<ul>
<li>Parameterized row filters allow different partitions of data to be sent to different Subscribers without requiring multiple publications to be created.</li>
<li>A parameterized row filter uses a WHERE clause to select the appropriate data to be published.</li>
<li>you specify one or both of the following system functions: SUSER_SNAME() and HOST_NAME().</li>
</ul>
<p><strong>What is a tracer tokens?</strong></p>
<blockquote><p>Tracer tokens were introduced with Sql Server 2005 transactional replication as a way to monitor the latency of delivering transactions from the publisher to the distributor and from the distributor to the subscriber(s).</p>
<p>A tracer token is basically a small piece of data that is inserted into the transaction log for the given publication just as if it were data for a standard database transaction and is treated basically the same way as well.</p></blockquote>
<p><strong>What is Article?</strong></p>
<blockquote><p>An article identifies a database object that is included in a publication. A publication can contain different types of articles, including tables, views, stored procedures, and other objects. When tables are published as articles, filters can be used to restrict the columns and rows of the data sent to Subscribers.</p></blockquote>
<p><strong>What is Publication?</strong></p>
<blockquote><p>A publication is a collection of one or more articles from one database. The grouping of multiple articles into a publication makes it easier to specify a logically related set of database objects and data that are replicated as a unit.</p></blockquote>
<p><strong>What is the use sp_replcounters?</strong></p>
<blockquote><p>Returns replication statistics about latency, throughput, and transaction count for each published database. This stored procedure is executed at the Publisher on any database.</p></blockquote>
<p><strong>What do you know about the trace token feature of Transaction Replication?</strong></p>
<blockquote><p>Transactional replication provides the tracer token feature, which provides a convenient way to measure latency in transactional replication topologies and to validate the connections between the Publisher, Distributor and Subscribers.</p></blockquote>
<p><strong>What permissions are needed to a user to monitor replication.</strong></p>
<blockquote><p>The replmonitor database role in the distribution database. These users can monitor replication, but cannot change any replication properties.</p></blockquote>
<p><strong>Does replicated database dependent on any recovery model?</strong></p>
<blockquote><p>Replication is not dependent on any particular recovery model. A database can participate in replication whether it is in simple, bulk-logged, or full.</p></blockquote>
<p><strong>Does replication encrypt data?</strong></p>
<blockquote><p>No. Replication does not encrypt data that is stored in the database or transferred over the network.</p></blockquote>
<p><strong>How we can generate Replication Script using SSMS?</strong></p>
<ul>
<li>To script multiple objects from Management Studio</li>
<li>Connect to the Distributor, Publisher, or Subscriber in Management Studio, and then expand the server node.</li>
<li>Right-click the Replication folder, and then click Generate Scripts.</li>
<li>Specify options in the Generate SQL Script dialog box.</li>
<li>Click Script to File.</li>
<li>Enter a file name in the Script File Location dialog box, and then click Save. A status message is displayed.</li>
<li>Click OK, and then click Close.</li>
</ul>
<p><strong>Why does replication add a column to replicated tables?</strong></p>
<blockquote><p>To track changes, merge replication and transactional replication with queued updating subscriptions must be able to uniquely identify every row in every published table.</p></blockquote>
<p><strong>Have you ever used sp_repltrans stored procedure to find out data latency between publisher and subscriber in Transaction Replication?</strong></p>
<blockquote><p>Yes:</p>
<p>To check if replication is fine, we could run sp_repltrans on the publisher database. This displays the undistributed commands present in the publisher database. If your log reader agent is scheduled to run continuously and if this command returns no rows, replication is fine on the publisher side.</p>
<p>However, if your log reader agent is scheduled to run at intervals and there are changes that need to be sent to the distribution database, you would see rows returned when you execute this procedure which shows the LSNs of the transactions.</p></blockquote>
<p><strong>I have transactional replication configured in my production environment. The business team has requested that I do not replicate delete operations on certain articles. </strong></p>
<p><strong>How you can achieve this?</strong></p>
<blockquote><p>In SSMS go to Replication -&gt; Local Publications and right click on your publication and select Properties.  In the Publication Properties window click on &#8216;Articles&#8217; and select the relevant article.  Go to &#8220;Article Properties&#8221; and select &#8220;Set Properties of Highlighted Table Article&#8221;.</p>
<p>In the article properties window, change the &#8220;DELETE delivery format&#8221; to &#8220;Do not replicate DELETE statements&#8221;.</p></blockquote>
<p><strong>Can a publication support push and pull at one time?</strong></p>
<blockquote><p>Yes, A publication can simultaneously support both push and pull subscriptions; however, any given subscriber is restricted to either a push or pull subscription.</p></blockquote>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Database Replication Interview Questions and Answers (Day-4)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-replication-interview-questions-and-answers-manage-identity-value-require-objects-replicated-day-4/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 01 Jul 2016 05:08:01 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database replication]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[manage identities values]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[require objects for replication]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3271</guid>

					<description><![CDATA[Why we require to manage IDENTITY column and Why data cannot replicate because of IDENTITY column. In replication topologies, where a publication contains an identity column and new rows can be inserted at Subscribers, additional configuration may be necessary to ensure that no duplicate identity values or constraint violations occur. If successful, two different rows [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-manage-identity-value-require-objects-replicated-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-manage-identity-value-require-objects-replicated-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-manage-identity-value-require-objects-replicated-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-manage-identity-value-require-objects-replicated-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-manage-identity-value-require-objects-replicated-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-manage-identity-value-require-objects-replicated-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-replication-interview-questions-and-answers-manage-identity-value-require-objects-replicated-day-4%2F&#038;title=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-4%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-replication-interview-questions-and-answers-manage-identity-value-require-objects-replicated-day-4/" data-a2a-title="SQL Server: Database Replication Interview Questions and Answers (Day-4)"></a></p><p><strong>Why we require to manage IDENTITY column and Why data cannot replicate because of IDENTITY column.</strong></p>
<blockquote><p>In replication topologies, where a publication contains an identity column and new rows can be inserted at Subscribers, additional configuration may be necessary to ensure that no duplicate identity values or constraint violations occur.</p>
<p>If successful, two different rows with a same identity value will exist on each replica. As a result,  each published article will contain multiple rows with the same identity values. If the identity column was defined as a primary key, or with a unique constraint, the data will not replicate.</p></blockquote>
<p><strong>Can we skip IDENTITY in the Replication?</strong></p>
<blockquote><p>Yes, we can use NOT FOR REPLICATION. The &#8220;Not For Replication&#8221; setting for identity columns allows replication to pass the ID value from the publisher to the subscriber without the subscriber creating a new ID.  Since identity columns will always generate a new number when records are inserted, this setting allows you to ensure the values on both your publisher and subscribers stay in synch.</p></blockquote>
<p><strong>How we should manage the IDENTITY column in Replicaton?</strong></p>
<blockquote><p>The simplest way to use automatic identity range handling, we must first enable the feature at the time the publication is created, assign a set of initial Publisher and Subscriber identity range values, and then assign a threshold value that determines when a new identity range is created.</p>
<p>Another one is, Using a primary key other than the identity column (for example, a composite key or a rowguid column), if an identity column is not necessary. This strategy eliminates the overhead of managing identity columns on the replicated data.</p></blockquote>
<p><strong>How to enable Replication Monior?</strong></p>
<blockquote><p>In Enterprise Manager, right-click on a SQL Server, and click Properties.</p>
<p>On the Replication tab, select Show Replication Monitor Group. Optionally, you can also select to add this server as a Distributor in the Replication Monitor Group.</p></blockquote>
<p><strong>Why is primary key needed in Transactional replication?</strong></p>
<blockquote><p>The reason is in the subscriber, rows are updated/deleted one-by-one using primary key.</p></blockquote>
<p><strong>Which all database objects can be included in replication?</strong></p>
<ul>
<li>Tables</li>
<li>Partitioned Tables</li>
<li>Stored Procedures – Definition (Transact-SQL and CLR)</li>
<li>Stored Procedures – Execution (Transact-SQL and CLR)</li>
<li>Views</li>
<li>Indexed Views</li>
<li>Indexed Views as Tables</li>
<li>User-Defined Types (CLR)</li>
<li>User-Defined Functions (Transact-SQL and CLR)</li>
<li>Alias Data Types</li>
<li>Full text indexes</li>
<li>Schema Objects</li>
</ul>
<p><strong>Can we rename a database used in Publication or subscription</strong></p>
<blockquote><p>No: we would need to drop the publications, rename the database and re-configure replication all over again.</p></blockquote>
<p><strong>Have you tried to replicate Database User Login information?</strong></p>
<blockquote><p>No: directly it is not possible, We require to create a DTS\SSIS package to transfer logins and passwords from a Publisher to one or more Subscribers.</p></blockquote>
<p><strong>Are tables locked during snapshot generation?</strong></p>
<ul>
<li>The length of time that the locks are taken depends on the type of replication used:</li>
<li>For merge publications, the Snapshot Agent does not take any locks.</li>
<li>For transactional publications, by default the Snapshot Agent takes locks only during the initial phase of snapshot generation.</li>
<li>For snapshot publications the Snapshot Agent takes locks during the entire snapshot generation process.</li>
</ul>
<p><strong>How do I manage constraints on published tables?</strong></p>
<blockquote><p>The NOT FOR REPLICATION option is specified by default for foreign key constraints and check constraints, it skips by the Replication Agent operations.</p></blockquote>
<p><strong>Can multiple publications use the same distribution database?</strong></p>
<blockquote><p>Yes. There are no restrictions on the number or types of publications that can use the same distribution database.</p>
<p>If you have multiple publications, you can configure multiple distribution databases at the Distributor to ensure that the data flowing through each distribution database is from a single publication.</p></blockquote>
<p><strong>How do I add or change indexes on publication and subscription databases?</strong></p>
<blockquote><p>Indexes can be added at the Publisher or Subscribers with no special considerations for replication.</p></blockquote>
<p><strong>How do I move or rename files for databases involved in replication?</strong></p>
<blockquote><p>A moving or renaming database files required detaching and reattaching the database. Because a replicated database cannot be detached, replication had to be removed from these databases first.</p></blockquote>
<p><strong>Data is not being delivered to Subscribers, what can be the possible reasons?</strong></p>
<ul>
<li>The table is filtered, and there are no changes to deliver to a given Subscriber.</li>
<li>One or more agents are not running or are failing with an error.</li>
<li>Data is deleted by a trigger, or a trigger includes a ROLLBACK statement.</li>
<li>A transactional subscription was initialized without a snapshot, and changes have occurred on the Publisher since the publication was created.</li>
<li>Replication of stored procedure execution for a transactional publication produces different results at the Subscriber.</li>
<li>The INSERT stored procedure used by a transactional article includes a condition that is not met.</li>
<li>Data is deleted by a user, a replication script, or another application.</li>
</ul>
<p><strong>T-SQL script to check status of Replication Distribution Agents.</strong><br />
<pre class="crayon-plain-tag">SELECT 
    a.name PublicationName
    , a.publication Publication
    , ditosu.comments AS MessageText
    , ditosu.[time] CommandDate
    , ditosu.xact_seqno xact_seqno
FROM MSdistribution_agents a
    INNER JOIN MSpublications p ON a.publisher_db = p.publisher_db
        AND a.publication = p.publication
    INNER JOIN MSdistribution_history ditosu ON ditosu.agent_id = a.id
ORDER BY ditosu.[time] DESC</pre>
<strong>T-SQL script to find Replication errors.</strong><br />
<pre class="crayon-plain-tag">SELECT 
	[error_text]
	,[time]	
FROM distribution..MSrepl_errors
ORDER BY [time] DESC</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Database Replication Interview Questions and Answers (Day-3)</title>
		<link>https://www.dbrnd.com/2016/06/sql-server-database-replication-interview-questions-and-answers-replication-configuration-push-pull-subscription-filters-day-3/</link>
					<comments>https://www.dbrnd.com/2016/06/sql-server-database-replication-interview-questions-and-answers-replication-configuration-push-pull-subscription-filters-day-3/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 30 Jun 2016 19:19:24 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database replication]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[push & pull subscription]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[replication configuration]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3268</guid>

					<description><![CDATA[What should be your general steps to Implementing any type of Replication? Configuring Replication: Identify the Publisher, Distributor, and Subscribers in your topology. Publishing Data and Database Objects: Create the publication and define the data and database object articles in the publication, and apply any necessary filters to data that will be published. Subscribing to [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-replication-configuration-push-pull-subscription-filters-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-3%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-replication-configuration-push-pull-subscription-filters-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-3%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-replication-configuration-push-pull-subscription-filters-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-3%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-replication-configuration-push-pull-subscription-filters-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-3%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-replication-configuration-push-pull-subscription-filters-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-3%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-replication-configuration-push-pull-subscription-filters-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-3%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-replication-configuration-push-pull-subscription-filters-day-3%2F&#038;title=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-3%29" data-a2a-url="https://www.dbrnd.com/2016/06/sql-server-database-replication-interview-questions-and-answers-replication-configuration-push-pull-subscription-filters-day-3/" data-a2a-title="SQL Server: Database Replication Interview Questions and Answers (Day-3)"></a></p><p><strong>What should be your general steps to Implementing any type of Replication?</strong></p>
<ul>
<li>Configuring Replication: Identify the Publisher, Distributor, and Subscribers in your topology.</li>
<li>Publishing Data and Database Objects: Create the publication and define the data and database object articles in the publication, and apply any necessary filters to data that will be published.</li>
<li>Subscribing to Publications: Create push, pull, or anonymous subscriptions to indicate what publications need to be propagated to individual Subscribers and when.</li>
<li>Generating the Initial Snapshot: Indicate where to save snapshot files, whether they are compressed, and scripts to run before or after applying the initial snapshot.</li>
<li>Applying the Initial Snapshot: Apply the snapshot automatically by synchronizing the subscription using the Distribution Agent or the Merge Agent.</li>
<li>Synchronizing Data: Synchronizing data occurs when the Snapshot Agent, Distribution Agent, or Merge Agent runs and updates are propagated between Publisher and Subscribers.</li>
</ul>
<p><strong>What are your general steps to configure a Replication?</strong></p>
<ul>
<li>Identifying a Distributor.</li>
<li>Creating a distribution database on the Distributor.</li>
<li>Enabling Publishers that will use the Distributor.</li>
<li>Enabling publication databases.</li>
<li>Enabling Subscribers that will receive published data.</li>
</ul>
<p><strong>What is called a Subscription Process?</strong></p>
<blockquote><p>A subscription is the request for data or database objects to be published to a specific Subscriber. A Subscriber can have several subscriptions to different publications.</p>
<p>A subscription defines what publication will be replicated, where and when. A subscription can be created either at the Publisher or at the Subscriber.</p></blockquote>
<p><strong>What is a Push Subscription?</strong></p>
<blockquote><p>With a push subscription, the Publisher propagates changes to a Subscriber without a request from the Subscriber. Changes can be pushed to Subscribers on demand, continuously, or on a scheduled basis. By default, the Distribution Agent or Merge Agent runs at the Distributor.</p>
<p>Because a Subscriber must explicitly be enabled at the Publisher to receive a push subscription, push subscriptions are known as named subscriptions.</p></blockquote>
<p><strong>What is a Pull Subscription?</strong></p>
<blockquote><p>With a pull subscription, the Subscriber requests changes made at the Publisher. Pull subscriptions allow the user to determine when the data changes are synchronized. By default, the Distribution Agent or the Merge Agent runs at the Subscriber.</p>
<p>Because a Subscriber must explicitly be enabled at the Publisher to receive a push subscription, pull subscriptions are known as named subscriptions.</p></blockquote>
<p><strong>What is an Anonymous Subscription?</strong></p>
<blockquote><p>An anonymous subscription is a type of pull subscription. Detailed information about the subscription and the Subscriber is not stored at the Publisher when using an anonymous subscription.</p></blockquote>
<p><strong>When we should use Push Subscription?</strong></p>
<ul>
<li>Data will typically be synchronized on demand or on a frequently recurring schedule.</li>
<li>Publications require near real-time movement of data without polling.</li>
<li>The higher processor overhead at a Publisher using a local Distributor does not affect performance.</li>
<li>You need easier administration from a centralized location (the Distributor).</li>
</ul>
<p><strong>When we should use Pulll Subscription?</strong></p>
<ul>
<li>Administration of the subscription will take place at the Subscriber.</li>
<li>The publication has a large number of Subscribers, and when it would be too resource-intensive to run all the agents at one site or all at the Distributor.</li>
<li>Subscribers are autonomous, disconnected, and/or mobile. Subscribers will determine when they will connect to the Publisher/Distributor and synchronize changes.</li>
</ul>
<p><strong>When we should use Anonymous Subscriptions?</strong></p>
<ul>
<li>Applications have a very large number of Subscribers.</li>
<li>You do not want the overhead of maintaining extra information at the Publisher or Distributor.</li>
<li>If Subscribers use the Internet to access publications.</li>
</ul>
<p><strong>Can we apply filters on a table to be published?</strong></p>
<blockquote><p>Yes, we can apply different filters on a table which is going to publish.</p>
<p>Different types of filter likes, Row filters, Column filter, Dynamic filter, Static filter, Join filter.</p></blockquote>
<p><strong>Can you modify the data of Subscriber?</strong></p>
<blockquote><p>Yes, With snapshot replication or transactional replication, replicated data is by default read only; however, you have the ability to modify replicated data at the Subscriber by using updatable subscriptions.</p></blockquote>
<p><strong>What do you know about Immediate Updating?</strong></p>
<blockquote><p>Immediate updating allows snapshot replication and transactional replication Subscribers to update the replicated data at the Subscriber and send those changes back to the Publisher and to other Subscribers.</p></blockquote>
<p><strong>What do you know about Queued Updating?</strong></p>
<blockquote><p>Queued updating allows snapshot replication and transactional replication Subscribers to modify published data without requiring an active network connection to the Publisher.</p>
<p>When you create a publication with the queued updating option enabled and a Subscriber performs INSERT, UPDATE, or DELETE statements on published data, the changes are stored in a queue. The queued transactions are applied asynchronously at the Publisher when network connectivity is restored.</p></blockquote>
<p><strong>Can we use Data Transformation Service (DTS Package) for publishing a data?</strong></p>
<blockquote><p>Yes, we can create a DTS package for replication either using the replication wizards or programmatically, such as using Microsoft Visual Basic.</p></blockquote>
<p><strong>What do you know about Alternate Synchronizing Partner?</strong></p>
<blockquote><p>Subscribers to merge publications can synchronize with servers other than the Publisher at which the subscription originated. Synchronizing with alternate partners provides the ability for a Subscriber to synchronize data even if the primary Publisher is unavailable.</p>
<p>This feature is also useful when mobile Subscribers have access to a faster or more reliable network connection with an alternate synchronization partner.</p></blockquote>
<p><strong>What is error 20598 for DELETEs?</strong></p>
<ul>
<li>A error 20598 is due to a missing row on the subscriber and there are two scenarios that can cause this error:</li>
<li>An UPDATE command cannot be replicated, because there is no record that matches the update condition on the subscriber.</li>
<li>A DELETE command cannot be replicated, because there is no record that matches the delete condition on the subscriber.</li>
</ul>
<p><strong>How to fix error 20598 for DELETEs?</strong></p>
<ul>
<li>On the subscriber, insert a dummy record with the exact primary key value of the deleted row. This PK value can be retrieved using sp_browsereplcmds.</li>
<li>The other option is to modify the sp_MSDel_&lt;schema&gt;&lt;table_name&gt; to comment out the error emitting codes when @@rowcount = 0.</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/06/sql-server-database-replication-interview-questions-and-answers-replication-configuration-push-pull-subscription-filters-day-3/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: Database Replication Interview Questions and Answers (Day-2)</title>
		<link>https://www.dbrnd.com/2016/06/sql-server-database-replication-interview-questions-and-answers-xact_abort-prerequisites-merge-snapshot-replication-day-2/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 29 Jun 2016 20:04:06 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database replication]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[merge replication]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[snapshot replication]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[xact_abort]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3265</guid>

					<description><![CDATA[What is the use of XACT_ABORT Parameter? XACT_ABORT ON ensures that any errors encountered during execution at the Publisher cause the entire execution to be rolled back, avoiding the Distribution Agent failure. If XACT_ABORT is set to OFF, and an error occurs during execution of the procedure at the Publisher, the same error will occur [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-xact_abort-prerequisites-merge-snapshot-replication-day-2%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-2%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-xact_abort-prerequisites-merge-snapshot-replication-day-2%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-2%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-xact_abort-prerequisites-merge-snapshot-replication-day-2%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-2%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-xact_abort-prerequisites-merge-snapshot-replication-day-2%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-2%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-xact_abort-prerequisites-merge-snapshot-replication-day-2%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-2%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-xact_abort-prerequisites-merge-snapshot-replication-day-2%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-2%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-xact_abort-prerequisites-merge-snapshot-replication-day-2%2F&#038;title=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-2%29" data-a2a-url="https://www.dbrnd.com/2016/06/sql-server-database-replication-interview-questions-and-answers-xact_abort-prerequisites-merge-snapshot-replication-day-2/" data-a2a-title="SQL Server: Database Replication Interview Questions and Answers (Day-2)"></a></p><p><strong>What is the use of XACT_ABORT Parameter?</strong></p>
<blockquote><p>XACT_ABORT ON ensures that any errors encountered during execution at the Publisher cause the entire execution to be rolled back, avoiding the Distribution Agent failure.</p>
<p>If XACT_ABORT is set to OFF, and an error occurs during execution of the procedure at the Publisher, the same error will occur at the Subscriber, causing the Distribution Agent to fail.</p></blockquote>
<p><strong>What is a Merge Replication?</strong></p>
<blockquote><p>Merge replication, like transactional replication, typically starts with a snapshot of the publication database objects and data. Subsequent data changes and schema modifications made at the Publisher and Subscribers are tracked with triggers. The Subscriber synchronizes with the Publisher when connected to the network and exchanges all rows that have changed between the Publisher and Subscriber since the last time synchronization occurred.</p>
<p>Merge replication allows various sites to work autonomously and later merge updates into a single, uniform result. Because updates are made at more than one node, the same data may have been updated by the Publisher and by more than one Subscriber.</p></blockquote>
<p><strong>In which situations, Merge Replication is suitable?</strong></p>
<ul>
<li>Multiple Subscribers might update the same data at various times and propagate those changes to the Publisher and to other Subscribers.</li>
<li>Subscribers need to receive data, make changes offline, and later synchronize changes with the Publisher and other Subscribers.</li>
<li>Each Subscriber requires a different partition of data.</li>
<li>Conflicts might occur and, when they do, you need the ability to detect and resolve them.</li>
<li>The application requires net data change rather than access to intermediate data states.</li>
</ul>
<p><strong>What should be your best practice for tracking Merge Replication?</strong></p>
<blockquote><p>To track changes, merge replication must be able to uniquely identify every row in every published table. To accomplish this merge replication adds the column rowguid to every table.</p></blockquote>
<p><strong>What is a Snapshot Replication?</strong></p>
<blockquote><p>Snapshot replication distributes data exactly as it appears at a specific moment in time and does not monitor for updates to the data. When synchronization occurs, the entire snapshot is generated and sent to Subscribers.</p>
<p>Snapshot replication can be used by itself, but the snapshot process is also commonly used to provide the initial set of data and database objects for transactional and merge publications.</p></blockquote>
<p><strong>How Snapshot replication is differ than other type of replication and In which situation, it is recommended?</strong></p>
<blockquote><p>Data is mostly static and does not change often. When it does change, it makes more sense to publish an entirely new copy to Subscribers.</p>
<p>It is acceptable to have copies of data that are out of date for a period of time.</p>
<p>Replicating small volumes of data in which an entire refresh of the data is reasonable.</p>
<p>Snapshot replication is mostly appropriate when you need to distribute a read-only copy of data, but it also provides the option to update data at the Subscriber.</p>
<p>Snapshot replication has a lower continuous overhead on the Publisher than transactional replication, because incremental changes are not tracked. However, if the dataset set being replicated is very large, it will require substantial resources to generate and apply the snapshot. Consider the size of the entire data set and the frequency of changes to the data when evaluating whether to utilize snapshot replication.</p></blockquote>
<p><strong>Would you please explain basic, how Snapshot works?</strong></p>
<blockquote><p>Snapshots can be generated and applied either immediately after the subscription is created or according to a schedule set at the time the publication is created. The Snapshot Agent prepares snapshot files containing the schema and data of published tables and database objects, stores the files in the snapshot folder for the Publisher, and records tracking information in the distribution database on the Distributor.</p>
<p>You specify a default snapshot folder when you configure a Distributor, but you can specify an alternate location for a publication instead of or in addition to the default.</p></blockquote>
<p><strong>What do you require to plan before setup a Snapshot Replication?</strong></p>
<ul>
<li>Transferring and storing snapshot files:</li>
<li>You have the option of storing snapshot files in a location other than or in addition to the default location, which is often located on the Distributor. Alternate locations can be on another server, on a network drive, or on removable media.</li>
<li>Scheduling snapshots:</li>
<li>To plan the optimum schedule for running the Snapshot Agent, estimate the length of time it takes the Snapshot Agent to complete the snapshot. Because the snapshot is created using bcp, perform a test bulk copy of your data set and time how long it takes to complete. If your data set is very large, perform the bulk copy on a sample of the data set and extrapolate the lapse time to the entire data set.</li>
</ul>
<p><strong>Before Transaction Replication, what should be your planning?</strong></p>
<ul>
<li>Transaction log space.</li>
<li>Disk space for the distribution database.</li>
<li>Primary keys for each table to be published.</li>
<li>Immediate updating and queued updating.</li>
<li>Transforming replicated data.</li>
<li>text and image data types in transactional replication.</li>
<li>Identity ranges.</li>
<li>Constraints and NOT FOR REPLICATION.</li>
</ul>
<p><strong>Before Merge Replication, what should be your planning?</strong></p>
<ul>
<li>Timestamp columns.</li>
<li>Identity ranges.</li>
<li>Data integrity.</li>
<li>Primary keys.</li>
<li>Synchronizing with alternate synchronization partners.</li>
<li>Row-level tracking and column-level tracking.</li>
<li>Triggers and business rules.</li>
<li>text and image data types in merge replication.</li>
<li>Conflict resolution.</li>
<li>Occassional maintenance for online/offline applications</li>
</ul>
<p><strong>Before planning to Replication, What should be your consideration?</strong></p>
<ul>
<li>Whether replicated data needs to be updated, and by whom.</li>
<li>Your data distribution needs regarding consistency, autonomy, and latency.</li>
<li>The replication environment, including business users, technical infrastructure, network and security, and data characteristics.</li>
<li>Types of replication and replication options.</li>
<li>Replication topologies and how they align with the types of replication.</li>
</ul>
<p><strong>Why you should use a separate disk drive for all databases which are involved in Replication?</strong></p>
<blockquote><p>This applies to the publication database, the distribution database, and the subscription database. You can decrease the time it takes to write transactions by storing the log files on a disk drive different than the one used to store the database. You can mirror that drive, using  a Redundant Array of Inexpensive Disks (RAID)-1, if you require fault tolerance.</p>
<p>Use RAID 0 or 0+1 (depending on your need for fault tolerance) for other database files. This is a good practice regardless of whether or not replication is being used.</p></blockquote>
<p><strong>Can you tell me some of the common replication DMV&#8217;s and their use?</strong></p>
<ul>
<li>sys.dm_repl_articles &#8211; Contains information about each article being published. It returns data from the database being published and returns a row for each object being published in each article.</li>
<li>sys.dm_repl_schemas &#8211; Contains information about each table and column being published. It returns data from the database being published and returns one row for each column in each object being published</li>
<li>sys.dm_repl_traninfo &#8211; Contains information about each transaction in a transactional replication.</li>
</ul>
<p><strong>I have transactional replication configured in my production environment with multiple subscribers.  The business team has requested that one of the subscriptions be reinitialized, because they think there is some missing data.</strong></p>
<p><strong>What are the different option to reinitialized subscriptions?</strong></p>
<blockquote><p><strong>Option 1:</strong> Using SQL Server Management Studio (SSMS).</p>
<p>In SSMS go to Replication -&gt; Local Publications -&gt; Locate your publication and expand it.</p>
<p>To do this, right click that subscription and select the &#8216;reinitialize&#8217; option.</p></blockquote>
<blockquote><p><strong>Option 2:</strong> Using Replication Monitor</p>
<p>In SSMS go to Replication -&gt; right click on replication and select &#8216;Launch Replication Monitor&#8217;.</p>
<p>On the left pane, under &#8216;My publishers&#8217;, click on the publisher node and expand to get a list of the subscriptions.</p>
<p>In the &#8216;All Subscriptions&#8217; tab, you need to select the appropriate subscription and click on &#8216;Reinitialize Subscription&#8217;.</p></blockquote>
<p><strong>How you can solve Error: Could not find stored procedure error and how to recover.</strong></p>
<p><strong>How you can recreate the missing stored procedures?</strong></p>
<blockquote><p>We can use sp_scriptpublicationcustomprocs system stored procedure which has been available since SQL Server 2000 Service Pack 1.</p>
<p>The only parameter for the sp_scriptpublicationcustomprocs is the publication name and this stored procedure must be executed on the published database.</p><pre class="crayon-plain-tag">EXEC sp_scriptpublicationcustomprocs @publication='Publication_Name';</pre><p>
The output from this stored procedure will be the creation code of INSERT, UPDATE, and DELETE stored procedures for each article that belongs to the &#8216;Publication_Name&#8217; publication.</p></blockquote>
<p><strong>T-SQL script to check status of Replication.</strong><br />
<pre class="crayon-plain-tag">SELECT 
    publisher
    , publisher_db
    , publication
    , agent_name
    , last_distsync
    , CASE
        WHEN status = 1 THEN 'Started'
        WHEN status = 2 THEN 'Succeeded'
        WHEN status = 3 THEN 'In progress'
        WHEN status = 4 THEN 'Idle'
        WHEN status = 5 THEN 'Retrying'
        WHEN status = 6 THEN 'Failed'
    END AS StatedStates    
FROM distribution..MSreplication_monitordata</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Database Replication Interview Questions and Answers (Day-1)</title>
		<link>https://www.dbrnd.com/2016/06/sql-server-database-replication-interview-questions-and-answers-publisher-distributor-subscriber-snapshot-merge-transaction-replication-day-1/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 28 Jun 2016 20:44:28 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database replication]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[distribution agent]]></category>
		<category><![CDATA[distributor]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[log-reader agent]]></category>
		<category><![CDATA[merge agent]]></category>
		<category><![CDATA[merge replication]]></category>
		<category><![CDATA[publisher]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[snapshot agent]]></category>
		<category><![CDATA[snapshot replication]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[subscriber]]></category>
		<category><![CDATA[transaction replication]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3261</guid>

					<description><![CDATA[What is Replication in SQL Server? As per the msdn help, Replication is a set of technologies for copying and distributing data and database objects from one database to another and then synchronizing between databases to maintain consistency. Using replication, you can distribute data to different locations. Database replication is the frequent electronic copying data [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-publisher-distributor-subscriber-snapshot-merge-transaction-replication-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-1%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-publisher-distributor-subscriber-snapshot-merge-transaction-replication-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-1%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-publisher-distributor-subscriber-snapshot-merge-transaction-replication-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-1%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-publisher-distributor-subscriber-snapshot-merge-transaction-replication-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-1%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-publisher-distributor-subscriber-snapshot-merge-transaction-replication-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-1%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-publisher-distributor-subscriber-snapshot-merge-transaction-replication-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-1%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-replication-interview-questions-and-answers-publisher-distributor-subscriber-snapshot-merge-transaction-replication-day-1%2F&#038;title=SQL%20Server%3A%20Database%20Replication%20Interview%20Questions%20and%20Answers%20%28Day-1%29" data-a2a-url="https://www.dbrnd.com/2016/06/sql-server-database-replication-interview-questions-and-answers-publisher-distributor-subscriber-snapshot-merge-transaction-replication-day-1/" data-a2a-title="SQL Server: Database Replication Interview Questions and Answers (Day-1)"></a></p><p><strong>What is Replication in SQL Server?</strong></p>
<blockquote><p>As per the msdn help,</p>
<p>Replication is a set of technologies for copying and distributing data and database objects from one database to another and then synchronizing between databases to maintain consistency. Using replication, you can distribute data to different locations.</p>
<p>Database replication is the frequent electronic copying data from a database in one computer or server to a database in another so that all users share the same level of information. The result is a distributed database in which users can access data relevant to their tasks without interfering with the work of others.</p></blockquote>
<p><strong>What is Publishers?</strong></p>
<blockquote><p>The Publisher is a server that makes data available for replication to other servers. In addition to being the server where you specify which data is to be replicated, the Publisher also detects which data has changed and maintains information about all publications at that site.</p></blockquote>
<p><strong>What is Distributors?</strong></p>
<blockquote><p>Distributor is a bridge between publisher and subscriber. Distributor gathers all the published data and holds it until it sends it across to all subscriber. So as it is a bridge who sits in between publisher and subscriber, it supports multiple publisher and subscriber concept.</p></blockquote>
<p><strong>What is Subscribers?</strong></p>
<blockquote><p>Subscribers are servers that receive replicated data and it is the end source or the final destination to which data has to be transmitted.</p></blockquote>
<p><strong>What is a Snapshot Agent?</strong></p>
<blockquote><p>The Snapshot Agent is used with all types of replication. It prepares the schema and the initial bulk copy files of published tables and other objects, stores the snapshot files, and records information about synchronization in the distribution database. The Snapshot Agent runs at the Distributor.</p></blockquote>
<p><strong>What is a Log Reader Agent?</strong></p>
<blockquote><p>The Log Reader Agent is used with transactional replication. It moves transactions marked for replication from the transaction log on the Publisher to the distribution database. Each database published using transactional replication has its own Log Reader Agent that runs on the Distributor and connects to the Publisher (the Distributor can be on the same computer as the Publisher).</p></blockquote>
<p><strong>What is a Distribution Agent?</strong></p>
<blockquote><p>The Distribution Agent is used with snapshot replication and transactional replication. It applies the initial snapshot to the Subscriber and moves transactions held in the distribution database to Subscribers. The Distribution Agent runs at either the Distributor for push subscriptions or at the Subscriber for pull subscriptions.</p></blockquote>
<p><strong>What is a Merge Agent?</strong></p>
<blockquote><p>The Merge Agent is used with merge replication. It applies the initial snapshot to the Subscriber and moves and reconciles incremental data changes that occur. Each merge subscription has its own Merge Agent that connects to both the Publisher and the Subscriber and updates both. The Merge Agent runs at either the Distributor for push subscriptions or the Subscriber for pull subscriptions.</p></blockquote>
<p><strong>What is a Queue Reader Agent?</strong></p>
<blockquote><p>The Queue Reader Agent is used with transactional replication with the queued updating option. The agent runs at the Distributor and moves changes made at the Subscriber back to the Publisher. Unlike the Distribution Agent and the Merge Agent, only one instance of the Queue Reader Agent exists to service all Publishers and publications for a given distribution database.</p></blockquote>
<p><strong>What are the different types of Replication available in SQL Server?</strong></p>
<ul>
<li>Transactional Replication</li>
<li>Merge Replication</li>
<li>Snapshot Replication</li>
</ul>
<p><strong>What is the Transactional Replication?</strong></p>
<blockquote><p>SQL Server Transactional replication is typically used in server-to-server scenarios that require high throughput, including improving scalability and availability, data warehousing and reporting, integrating data from multiple sites, integrating heterogeneous data, and offloading batch processing.</p>
<p>Transactional replication typically starts with a snapshot of the publication database objects and data. As soon as the initial snapshot is taken, subsequent data changes and schema modifications made at the Publisher are usually delivered to the Subscriber as they occur (in near real time).</p>
<p>The data changes are applied to the Subscriber in the same order and within the same transaction boundaries as they occurred at the Publisher; therefore, within a publication, transactional consistency is guaranteed.</p></blockquote>
<p><strong>In which, situation Transactional Replication is suitable?</strong></p>
<ul>
<li>You want incremental changes to be propagated to Subscribers as they occur.</li>
<li>The application requires low latency between the time changes are made at the Publisher and the changes arrive at the Subscriber.</li>
<li>The application requires access to intermediate data states. For example, if a row changes five times, transactional replication allows an application to respond to each change (such as firing a trigger), not simply the net data change to the row.</li>
<li>The Publisher has a very high volume of insert, update, and delete activity.</li>
<li>The Publisher or Subscriber is a non-SQL Server database, such as Oracle.</li>
</ul>
<p><strong>How Transactional Replication works?</strong></p>
<blockquote><p>Transactional replication is implemented by the SQL Server Snapshot Agent, Log Reader Agent, and Distribution Agent. The Snapshot Agent prepares snapshot files containing schema and data of published tables and database objects, stores the files in the snapshot folder, and records synchronization jobs in the distribution database on the Distributor.</p>
<p>The Log Reader Agent monitors the transaction log of each database configured for transactional replication and copies the transactions marked for replication from the transaction log into the distribution database, which acts as a reliable store-and-forward queue. The Distribution Agent copies the initial snapshot files from the snapshot folder and the transactions held in the distribution database tables to Subscribers.</p>
<p>Incremental changes made at the Publisher flow to Subscribers according to the schedule of the Distribution Agent, which can run continuously for minimal latency, or at scheduled intervals.</p></blockquote>
<p><strong>What do you know about the peer-to-peer transaction publication topology?</strong></p>
<ul>
<li>Each location has identical data and acts as both a Publisher and Subscriber.</li>
<li>The same row can be changed only at one location at a time.</li>
<li>This topology is best suited for server environments requiring high availability and read scalability.</li>
</ul>
<p><strong>What do you know about the Bidirectional Transactional Replication?</strong></p>
<blockquote><p>Bidirectional transactional replication is a specific transactional replication topology that allows two servers to exchange changes with each other: each server publishes data and then subscribes to a publication with the same data from the other server.</p></blockquote>
<p><strong>Is it possible to publish the execution of Stored Procedure?</strong></p>
<blockquote><p>If you have one or more stored procedures that execute at the Publisher and affect published tables, consider including those stored procedures in your publication as stored procedure execution articles. The definition of the procedure (the CREATE PROCEDURE statement) is replicated to the Subscriber when the subscription is initialized; when the procedure is executed at the Publisher, replication executes the corresponding procedure at the Subscriber.</p>
<p>The stored procedure definition at the Publisher is propagated to each Subscriber. However, you can also modify the stored procedure at the Subscriber. This is useful if you want different logic to be executed at the Publisher and Subscriber.</p></blockquote>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
