{"id":516,"date":"2025-07-25T09:45:55","date_gmt":"2025-07-25T00:45:55","guid":{"rendered":"https:\/\/sejiwon.com\/?p=516"},"modified":"2025-07-25T09:45:55","modified_gmt":"2025-07-25T00:45:55","slug":"mssql-agent-history-clean-up-fail%eb%82%98%eb%8a%94-%ec%9d%b4%ec%9c%a0","status":"publish","type":"post","link":"https:\/\/sejiwon.com\/?p=516","title":{"rendered":"mssql Agent history clean up fail\ub098\ub294 \uc774\uc720"},"content":{"rendered":"\n<p>MSSQL\uc5d0\uc11c <strong>SQL Server Agent history cleanup<\/strong> \uc791\uc5c5\uc774 \uc2e4\ud328\ud558\ub294 \uc774\uc720\ub294 \uc5ec\ub7ec \uac00\uc9c0\uac00 \uc788\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ub300\ud45c\uc801\uc778 \uc6d0\uc778\uacfc \ud574\uacb0 \ubc29\ubc95\uc744 \uc544\ub798\uc5d0 \uc815\ub9ac\ud588\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u2705 1. <strong>\uad8c\ud55c \ubb38\uc81c<\/strong><\/h3>\n\n\n\n<ul>\n<li>SQL Server Agent\uac00 \uc791\uc5c5\uc744 \uc218\ud589\ud560 \ub54c \ud544\uc694\ud55c \uad8c\ud55c\uc774 \uc5c6\uc73c\uba74 \uc2e4\ud328\ud569\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\uc6d0\uc778:<\/strong> <code>SQLAgentUserRole<\/code> \uad8c\ud55c \ubd80\uc871 \ub610\ub294 \uc791\uc5c5 \uc2e4\ud589 \uacc4\uc815\uc774 sysadmin\uc774 \uc544\ub2d8<\/li>\n\n\n\n<li><strong>\ud574\uacb0:<\/strong> \uc791\uc5c5\uc744 \uc2e4\ud589\ud558\ub294 \uacc4\uc815\uc774 <code>sysadmin<\/code> \uc5ed\ud560\uc778\uc9c0 \ud655\uc778\ud558\uac70\ub098, \ucd5c\uc18c\ud55c \ud544\uc694\ud55c \uad8c\ud55c\uc744 \ubd80\uc5ec\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\">\u2705 2. <strong>MSDB \ub370\uc774\ud130\ubca0\uc774\uc2a4 \uc190\uc0c1 \ub610\ub294 \ube44\uc815\uc0c1 \uc0c1\ud0dc<\/strong><\/h3>\n\n\n\n<ul>\n<li>Agent \ud788\uc2a4\ud1a0\ub9ac\ub294 <code>msdb<\/code> \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc5d0 \uc800\uc7a5\ub429\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\uc6d0\uc778:<\/strong> <code>msdb<\/code> \ub0b4 \uad00\ub828 \ud14c\uc774\ube14 (<code>sysjobhistory<\/code>, <code>sysjobs<\/code>, \ub4f1)\uc5d0 \ubb38\uc81c\uac00 \uc788\uc744 \uc218 \uc788\uc74c<\/li>\n\n\n\n<li><strong>\ud574\uacb0:<\/strong>\n<ul>\n<li><code>msdb<\/code> \uc0c1\ud0dc \ud655\uc778<\/li>\n\n\n\n<li>DBCC CHECKDB(msdb) \uc2e4\ud589\ud574\uc11c \uc624\ub958 \ud655\uc778<\/li>\n<\/ul>\n<\/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\">\u2705 3. <strong>\uc624\ub798\ub41c \ub808\ucf54\ub4dc\uac00 \ub108\ubb34 \ub9ce\uc74c<\/strong><\/h3>\n\n\n\n<ul>\n<li>\uc0ad\uc81c \ub300\uc0c1 \ud788\uc2a4\ud1a0\ub9ac \ub370\uc774\ud130\uac00 \ub108\ubb34 \ub9ce\uc544 \uc2dc\uac04 \ucd08\uacfc \ub610\ub294 \ub9ac\uc18c\uc2a4 \ubd80\uc871\uc73c\ub85c \uc2e4\ud328<\/li>\n\n\n\n<li><strong>\ud574\uacb0:<\/strong>\n<ul>\n<li>\uc8fc\uae30\uc801\uc73c\ub85c cleanup \uc218\ud589\ud558\uc5ec \ub204\uc801 \ubc29\uc9c0<\/li>\n\n\n\n<li>\uc791\uc5c5 \uc2a4\ucf00\uc904\uc744 \ub354 \uc790\uc8fc \uc2e4\ud589\ud558\uac70\ub098 \ud55c \ubc88\uc5d0 \uc0ad\uc81c\ud558\ub294 \uc591\uc744 \uc904\uc774\uae30<\/li>\n<\/ul>\n<\/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\">\u2705 4. <strong>SQL Server Agent \uad6c\uc131 \uc624\ub958<\/strong><\/h3>\n\n\n\n<ul>\n<li>SQL Server Agent \uad6c\uc131 \uc911 <code>history log cleanup<\/code> \uc791\uc5c5\uc774 \uc798\ubabb \uc124\uc815\ub418\uc5c8\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n\n\n\n<li><strong>\ud655\uc778 \ubc29\ubc95:<\/strong>\n<ul>\n<li>SQL Server Management Studio (SSMS) \u2192 SQL Server Agent \u2192 Jobs \u2192 <code>Agent History Cleanup<\/code><\/li>\n\n\n\n<li>\ud574\ub2f9 \uc791\uc5c5\uc758 \uc2a4\ud15d \uc18d\uc131\uc5d0\uc11c \uc2e4\ud589\ub418\ub294 T-SQL \ud655\uc778<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>EXEC msdb.dbo.sp_purge_jobhistory @oldest_date = 'yyyy-mm-dd'\n<\/code><\/pre>\n\n\n\n<ul>\n<li><strong>\uc624\ub958 \uba54\uc2dc\uc9c0 \uc608\uc2dc:<\/strong><br><code>\"The DELETE statement conflicted with the REFERENCE constraint\"<\/code><\/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\">\u2705 5. <strong>\uc678\ub798 \ud0a4 \uc81c\uc57d \uc870\uac74 \uc624\ub958<\/strong><\/h3>\n\n\n\n<ul>\n<li><code>sysjobhistory<\/code>\ub97c \uc0ad\uc81c\ud558\ub824\uace0 \ud560 \ub54c \uad00\ub828\ub41c \uc678\ub798 \ud0a4 \uc81c\uc57d \uc870\uac74 \ub54c\ubb38\uc5d0 \uc0ad\uc81c \uc2e4\ud328<\/li>\n\n\n\n<li><strong>\ud574\uacb0:<\/strong>\n<ul>\n<li>\ud574\ub2f9 \uc81c\uc57d \uc870\uac74 \ud655\uc778 \ud6c4, \ubb34\uacb0\uc131 \ubb38\uc81c \ud574\uacb0<\/li>\n<\/ul>\n<\/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\">\u2705 6. <strong>SQL Server \ubc84\uadf8<\/strong><\/h3>\n\n\n\n<ul>\n<li>\uc77c\ubd80 SQL Server \ubc84\uc804\uc5d0\uc11c cleanup job\uacfc \uad00\ub828\ub41c \uc54c\ub824\uc9c4 \ubc84\uadf8\uac00 \uc874\uc7ac<\/li>\n\n\n\n<li><strong>\ud574\uacb0:<\/strong>\n<ul>\n<li>\ucd5c\uc2e0 \uc11c\ube44\uc2a4 \ud329 \ub610\ub294 \ub204\uc801 \uc5c5\ub370\uc774\ud2b8 \uc801\uc6a9<\/li>\n<\/ul>\n<\/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\">\ud83d\udc49 \ud574\uacb0 \ud301 \uc694\uc57d<\/h3>\n\n\n\n<ol>\n<li>SSMS\uc5d0\uc11c \uc2e4\ud328\ud55c \uc791\uc5c5\uc758 <strong>Job History<\/strong> \ud655\uc778 (\uc624\ub958 \uba54\uc2dc\uc9c0 \ud655\uc778)<\/li>\n\n\n\n<li>SQL Server \uc5d0\ub7ec \ub85c\uadf8 \ub610\ub294 Windows \uc774\ubca4\ud2b8 \ub85c\uadf8\ub3c4 \ucc38\uace0<\/li>\n\n\n\n<li>\uc9c1\uc811 T-SQL\ub85c \ud788\uc2a4\ud1a0\ub9ac \uc815\ub9ac \ud14c\uc2a4\ud2b8<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>-- \uc608\uc2dc: 30\uc77c \uc774\uc0c1 \ub41c \ud788\uc2a4\ud1a0\ub9ac \uc0ad\uc81c\nEXEC msdb.dbo.sp_purge_jobhistory @oldest_date = DATEADD(day, -30, GETDATE());<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>MSSQL\uc5d0\uc11c SQL Server Agent history cleanup \uc791\uc5c5\uc774 \uc2e4\ud328\ud558\ub294 \uc774\uc720\ub294 \uc5ec\ub7ec \uac00\uc9c0\uac00 \uc788\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ub300\ud45c\uc801\uc778 \uc6d0\uc778\uacfc \ud574\uacb0 \ubc29\ubc95\uc744 \uc544\ub798\uc5d0 \uc815\ub9ac\ud588\uc2b5\ub2c8\ub2e4. \u2705 1. \uad8c\ud55c \ubb38\uc81c \u2705 2. MSDB \ub370\uc774\ud130\ubca0\uc774\uc2a4 \uc190\uc0c1 \ub610\ub294 \ube44\uc815\uc0c1 \uc0c1\ud0dc \u2705 3. \uc624\ub798\ub41c \ub808\ucf54\ub4dc\uac00 \ub108\ubb34 \ub9ce\uc74c \u2705 4. SQL Server Agent \uad6c\uc131 \uc624\ub958 EXEC msdb.dbo.sp_purge_jobhistory @oldest_date = &#8216;yyyy-mm-dd&#8217; \u2705 5. \uc678\ub798 \ud0a4 \uc81c\uc57d\u2026 <span class=\"read-more\"><a href=\"https:\/\/sejiwon.com\/?p=516\">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":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/posts\/516"}],"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=516"}],"version-history":[{"count":1,"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/posts\/516\/revisions"}],"predecessor-version":[{"id":518,"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/posts\/516\/revisions\/518"}],"wp:attachment":[{"href":"https:\/\/sejiwon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sejiwon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sejiwon.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}