{"id":519,"date":"2025-07-28T09:20:43","date_gmt":"2025-07-28T00:20:43","guid":{"rendered":"https:\/\/sejiwon.com\/?p=519"},"modified":"2025-07-28T09:20:43","modified_gmt":"2025-07-28T00:20:43","slug":"mssql-distribution-cleanup-%ec%97%90%eb%9f%ac%eb%82%98%eb%8a%94-%ec%9d%b4%ec%9c%a0","status":"publish","type":"post","link":"https:\/\/sejiwon.com\/?p=519","title":{"rendered":"MSSQL Distribution CleanUp \uc5d0\ub7ec\ub098\ub294 \uc774\uc720"},"content":{"rendered":"\n<p>MSSQL\uc5d0\uc11c <strong>Distribution CleanUp Job<\/strong>\uc774 \uc5d0\ub7ec\uac00 \ub098\ub294 \uc774\uc720\ub294 \uc5ec\ub7ec \uac00\uc9c0\uac00 \uc788\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \uc791\uc5c5\uc740 <strong>Transactional Replication<\/strong>\uc5d0\uc11c \uc624\ub798\ub41c \ud2b8\ub79c\uc7ad\uc158\uc744 \uc815\ub9ac(clean up)\ud558\ub294 \uc911\uc694\ud55c \uc5ed\ud560\uc744 \ud569\ub2c8\ub2e4. \uc5d0\ub7ec\uac00 \ubc1c\uc0dd\ud558\ub294 \uc8fc\uc694 \uc6d0\uc778\uc744 \uc544\ub798\uc5d0 \uc815\ub9ac\ud574 \ub4dc\ub9b4\uac8c\uc694.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 \uc8fc\uc694 \uc5d0\ub7ec \uc6d0\uc778<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. <strong>\uc5d0\uc774\uc804\ud2b8 \uad8c\ud55c \ubd80\uc871<\/strong><\/h3>\n\n\n\n<ul>\n<li><code>Distribution Cleanup: distribution<\/code> \uc791\uc5c5\uc740 \ud2b9\uc815 SQL Server Agent \uacc4\uc815 \ub610\ub294 \ud504\ub85c\uc2dc\uc800 \uc2e4\ud589 \uacc4\uc815\uc5d0 \uc801\uc808\ud55c \uad8c\ud55c\uc774 \uc5c6\uc73c\uba74 \uc2e4\ud328\ud569\ub2c8\ub2e4.<\/li>\n\n\n\n<li>\uc608: \uc5d0\ub7ec \uba54\uc2dc\uc9c0\uc5d0 <code>The process could not execute 'sp_MSdelete_dodelete'<\/code> \ub610\ub294 \uad8c\ud55c \uac70\ubd80 \uc624\ub958\uac00 \ub098\uc62c \uc218 \uc788\uc74c.<\/li>\n<\/ul>\n\n\n\n<p>\ud83d\udee0\ufe0f \ud574\uacb0 \ubc29\ubc95:<\/p>\n\n\n\n<ul>\n<li>Agent\uac00 \uc0ac\uc6a9\ud558\ub294 \uacc4\uc815\uc774 <code>distribution<\/code> \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc5d0\uc11c \uc801\uc808\ud55c \uad8c\ud55c\uc744 \uac00\uc9c0\uace0 \uc788\ub294\uc9c0 \ud655\uc778\ud558\uc138\uc694 (\ubcf4\ud1b5 <code>db_owner<\/code> \uad8c\ud55c \ud544\uc694).<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">2. <strong>\ub300\ub7c9\uc758 \ubbf8\ucc98\ub9ac\ub41c \ud2b8\ub79c\uc7ad\uc158<\/strong><\/h3>\n\n\n\n<ul>\n<li>Distribution DB\uc5d0 \uc313\uc778 \ud2b8\ub79c\uc7ad\uc158\uc774 \ub108\ubb34 \ub9ce\uc544\uc11c cleanup \uc791\uc5c5\uc774 timeout\ub418\uac70\ub098 \uc2e4\ud328\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p>\ud83d\udee0\ufe0f \ud574\uacb0 \ubc29\ubc95:<\/p>\n\n\n\n<ul>\n<li><code>sp_browsereplcmds<\/code> \ub610\ub294 <code>sp_replcmds<\/code> \uac19\uc740 \uc2dc\uc2a4\ud15c \ud504\ub85c\uc2dc\uc800\ub85c \ud050 \uc0c1\ud0dc \ud655\uc778.<\/li>\n\n\n\n<li>\uad6c\ub3c5\uc790(subscriber)\uc5d0\uc11c \ub9ac\ud50c\ub9ac\ucf00\uc774\uc158 \uc5d0\uc774\uc804\ud2b8\uac00 \uc798 \uc791\ub3d9\ud558\ub294\uc9c0 \ud655\uc778.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">3. <strong>\ud14c\uc774\ube14 \ub77d \ub610\ub294 \ube14\ub85c\ud0b9<\/strong><\/h3>\n\n\n\n<ul>\n<li>\uc815\ub9ac \ub300\uc0c1\uc774 \ub418\ub294 \ud14c\uc774\ube14(<code>MSrepl_commands<\/code>, <code>MSrepl_transactions<\/code>)\uc5d0 \ub77d\uc774 \uac78\ub824 \uc788\uac70\ub098 \ub2e4\ub978 \ud504\ub85c\uc138\uc2a4\uc640 \ucda9\ub3cc \uc911\uc77c \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p>\ud83d\udee0\ufe0f \ud574\uacb0 \ubc29\ubc95:<\/p>\n\n\n\n<ul>\n<li><code>sp_who2<\/code>, <code>sys.dm_tran_locks<\/code>, <code>sys.dm_exec_requests<\/code> \ub4f1\uc744 \ud1b5\ud574 \ube14\ub85c\ud0b9 \uc5ec\ubd80 \ud655\uc778.<\/li>\n\n\n\n<li>\ubb38\uc81c \ub418\ub294 \uc138\uc158 \uac15\uc81c \uc885\ub8cc \ud6c4 \ub2e4\uc2dc \uc2dc\ub3c4.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">4. <strong>\uc5d0\uc774\uc804\ud2b8 \uc791\uc5c5\uc774 \uc911\ub2e8\ub418\uac70\ub098 \uc190\uc0c1\ub428<\/strong><\/h3>\n\n\n\n<ul>\n<li>SQL Agent Job \uc790\uccb4\uac00 \uc911\uc9c0\ub418\uac70\ub098 \uc798\ubabb \uad6c\uc131\ub418\uc5b4 \uc788\uc73c\uba74 \uc2e4\ud328\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<p>\ud83d\udee0\ufe0f \ud574\uacb0 \ubc29\ubc95:<\/p>\n\n\n\n<ul>\n<li>SSMS &gt; SQL Server Agent &gt; Jobs &gt; <code>Distribution clean up: distribution<\/code> \uc791\uc5c5\uc758 \ub85c\uadf8\ub97c \ud655\uc778.<\/li>\n\n\n\n<li>\ubb38\uc81c\uac00 \uc788\uc73c\uba74 \uc7ac\uc0dd\uc131\ud558\uac70\ub098 Job step\uc744 \uc7ac\uad6c\uc131\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">5. <strong>\ub514\uc2a4\ud06c \uacf5\uac04 \ubd80\uc871 \ub610\ub294 DB \uc190\uc0c1<\/strong><\/h3>\n\n\n\n<ul>\n<li>Distribution DB\uc758 \ub514\uc2a4\ud06c \uacf5\uac04\uc774 \ubd80\uc871\ud558\uac70\ub098 \ud14c\uc774\ube14\/\uc778\ub371\uc2a4\uac00 \uc190\uc0c1\ub41c \uacbd\uc6b0.<\/li>\n<\/ul>\n\n\n\n<p>\ud83d\udee0\ufe0f \ud574\uacb0 \ubc29\ubc95:<\/p>\n\n\n\n<ul>\n<li>DBCC CHECKDB \uc2e4\ud589\ud574\uc11c \uc190\uc0c1 \uc5ec\ubd80 \ud655\uc778.<\/li>\n\n\n\n<li>\ub514\uc2a4\ud06c \uacf5\uac04 \ud655\ubcf4.<\/li>\n\n\n\n<li>\ud544\uc694\uc2dc \ubc31\uc5c5 \ud6c4 Distribution DB \uc7ac\uad6c\ucd95.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\uddea \ud655\uc778\uc6a9 \ucffc\ub9ac<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Distribution DB \ud2b8\ub79c\uc7ad\uc158 \uc0c1\ud0dc \ud655\uc778:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>USE distribution;\nGO\nSELECT COUNT(*) AS PendingCommands\nFROM MSrepl_commands;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\uc5d0\uc774\uc804\ud2b8 \uc5d0\ub7ec \ub85c\uadf8 \ud655\uc778:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>EXEC msdb.dbo.sp_help_jobhistory \n    @job_name = 'Distribution clean up: distribution';\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udccc \uad8c\uc7a5 \uc870\uce58 \uc21c\uc11c<\/h2>\n\n\n\n<ol>\n<li>\uc5d0\ub7ec \ub85c\uadf8 \ubd84\uc11d (SQL Agent \u2192 Job History)<\/li>\n\n\n\n<li>Distribution DB \uc0c1\ud0dc \uc810\uac80 (\ud2b8\ub79c\uc7ad\uc158, \uacf5\uac04, \uad8c\ud55c)<\/li>\n\n\n\n<li>\uad00\ub828 \uc5d0\uc774\uc804\ud2b8 \uc2e4\ud589 \uc0c1\ud0dc \uc810\uac80<\/li>\n\n\n\n<li>\ud544\uc694 \uc2dc \ub9ac\ud50c\ub9ac\ucf00\uc774\uc158 \uc7ac\uad6c\uc131 \uac80\ud1a0<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>MSSQL\uc5d0\uc11c Distribution CleanUp Job\uc774 \uc5d0\ub7ec\uac00 \ub098\ub294 \uc774\uc720\ub294 \uc5ec\ub7ec \uac00\uc9c0\uac00 \uc788\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \uc791\uc5c5\uc740 Transactional Replication\uc5d0\uc11c \uc624\ub798\ub41c \ud2b8\ub79c\uc7ad\uc158\uc744 \uc815\ub9ac(clean up)\ud558\ub294 \uc911\uc694\ud55c \uc5ed\ud560\uc744 \ud569\ub2c8\ub2e4. \uc5d0\ub7ec\uac00 \ubc1c\uc0dd\ud558\ub294 \uc8fc\uc694 \uc6d0\uc778\uc744 \uc544\ub798\uc5d0 \uc815\ub9ac\ud574 \ub4dc\ub9b4\uac8c\uc694. \u2705 \uc8fc\uc694 \uc5d0\ub7ec \uc6d0\uc778 1. \uc5d0\uc774\uc804\ud2b8 \uad8c\ud55c \ubd80\uc871 \ud83d\udee0\ufe0f \ud574\uacb0 \ubc29\ubc95: 2. \ub300\ub7c9\uc758 \ubbf8\ucc98\ub9ac\ub41c \ud2b8\ub79c\uc7ad\uc158 \ud83d\udee0\ufe0f \ud574\uacb0 \ubc29\ubc95: 3. \ud14c\uc774\ube14 \ub77d \ub610\ub294 \ube14\ub85c\ud0b9 \ud83d\udee0\ufe0f \ud574\uacb0\u2026 <span class=\"read-more\"><a href=\"https:\/\/sejiwon.com\/?p=519\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[],"_links":{"self":[{"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/posts\/519"}],"collection":[{"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sejiwon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=519"}],"version-history":[{"count":1,"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/posts\/519\/revisions"}],"predecessor-version":[{"id":521,"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/posts\/519\/revisions\/521"}],"wp:attachment":[{"href":"https:\/\/sejiwon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sejiwon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sejiwon.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}