{"id":28457,"date":"2023-10-06T10:43:02","date_gmt":"2023-10-06T08:43:02","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/?p=28457"},"modified":"2023-10-06T10:43:02","modified_gmt":"2023-10-06T08:43:02","slug":"sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/","title":{"rendered":"SQL Server: How to shrink the T-log file for a lot of old user-databases"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Recently I have the case that a customer has a lot of databases not more used but need to be accessible at any time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this case, we had a lot of T-log with the size when there are used and now we can really shrink and have some place on the disk.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I don\u2019t precise but it\u2019s very important to the customer to have free space and not every time extend the disk.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some words about the environment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The instance has&nbsp; 139 user-databases with the year in the database name and all databases are in recovery model simple.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If I exclude the year, the instance has 122 user-databases where I need to run a T-Log file shrink\u2026<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Select count(*) from sys.databases where database_id&gt;4\nSelect count(*) from sys.databases where database_id&gt;4 and DB_NAME(database_id) not like '%2023%' \n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"977\" height=\"388\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink01.png\" alt=\"\" class=\"wp-image-28458\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink01.png 977w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink01-300x119.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink01-768x305.png 768w\" sizes=\"auto, (max-width: 977px) 100vw, 977px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">To create the query for the shrink, I use the sys_master_files view and select only the Type \u2018Log\u2019 (value=1):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>select * from sys.master_files where type=1 and database_id &gt;4 and DB_NAME(database_id) not like '%2023%'<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"378\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink02-1024x378.png\" alt=\"\" class=\"wp-image-28459\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink02-1024x378.png 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink02-300x111.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink02-768x284.png 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink02-1536x568.png 1536w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink02.png 1789w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In my case, I will also only the T-Log file bigger than 128MB. The size is in size &nbsp;8-KB pages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I need to do a little calculation to have MB \u00a0with 8-KB pages*size\/1024:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>select count(*) from sys.master_files where type=1 and database_id &gt;4 and DB_NAME(database_id) not like '%2023%' and (8*size\/1024) &gt; 128<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"409\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink03-1024x409.png\" alt=\"\" class=\"wp-image-28461\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink03-1024x409.png 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink03-300x120.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink03-768x307.png 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink03.png 1285w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As you can see, I have now only 63 T-Log file for this shrink but it\u2019s a lot and I need to script it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To do the shrink, I use the usual command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>USE &#091;xxx2012xxx];\nDBCC SHRINKFILE (N'xxx2012xx_log' , 128);\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">I inject this query in my select to have the query to generate my script for all databases:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>select 'USE &#091;'+DB_NAME(database_id)+'];DBCC SHRINKFILE (N'''+name+''', 128);' from sys.master_files where type=1 and database_id &gt;4 and DB_NAME(database_id) not like '%2023%' and (8*size\/1024) &gt; 128\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"316\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink04-1024x316.png\" alt=\"\" class=\"wp-image-28462\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink04-1024x316.png 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink04-300x93.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink04-768x237.png 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink04-1536x474.png 1536w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink04.png 1706w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After taking the script in a new query, I run it and as result I win the double free space on the Log disk.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"974\" height=\"757\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink05.png\" alt=\"\" class=\"wp-image-28463\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink05.png 974w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink05-300x233.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink05-768x597.png 768w\" sizes=\"auto, (max-width: 974px) 100vw, 974px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">My customer is happy, finally we win 12GB on the disk&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I finish this blog with this advice: <strong><mark class=\"has-inline-color has-luminous-vivid-orange-color\">don\u2019t do it without knowing how the databases work<\/mark><\/strong><mark class=\"has-inline-color has-luminous-vivid-orange-color\">s<\/mark>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">My case was with a lot of \u201cold\u201d databases, no more used and in recovery model simple.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One point will be to add the sys.databases and take only databases in recovery model simple&#8230;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Don&#8217;t hesitate to give me your feedback about the script. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I have the case that a customer has a lot of databases not more used but need to be accessible at any time. In this case, we had a lot of T-log with the size when there are used and now we can really shrink and have some place on the disk. I don\u2019t&hellip;&nbsp;<\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","neve_meta_reading_time":"","_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[4133,99],"tags":[49],"class_list":["post-28457","post","type-post","status-publish","format-standard","category-database","category-sql-server","tag-microsoft"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.9 (Yoast SEO v29.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>SQL Server: How to shrink the T-log file for a lot of old user-databases - dbi services Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server: How to shrink the T-log file for a lot of old user-databases\" \/>\n<meta property=\"og:description\" content=\"Recently I have the case that a customer has a lot of databases not more used but need to be accessible at any time. In this case, we had a lot of T-log with the size when there are used and now we can really shrink and have some place on the disk. I don\u2019t&hellip;&nbsp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi services Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/dbiservices\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-06T08:43:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink01.png\" \/>\n\t<meta property=\"og:image:width\" content=\"977\" \/>\n\t<meta property=\"og:image:height\" content=\"388\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"St\u00e9phane Haby\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:site\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"St\u00e9phane Haby\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\\\/\"},\"author\":{\"name\":\"St\u00e9phane Haby\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/7980252d7d7a521e285e7c66114cf82a\"},\"headline\":\"SQL Server: How to shrink the T-log file for a lot of old user-databases\",\"datePublished\":\"2023-10-06T08:43:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\\\/\"},\"wordCount\":338,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/shrink01.png\",\"keywords\":[\"Microsoft\"],\"articleSection\":[\"Database\",\"SQL Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\\\/\",\"name\":\"SQL Server: How to shrink the T-log file for a lot of old user-databases - dbi services Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/shrink01.png\",\"datePublished\":\"2023-10-06T08:43:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/shrink01.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/shrink01.png\",\"width\":977,\"height\":388},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server: How to shrink the T-log file for a lot of old user-databases\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi services Blog\",\"description\":\"#BeSharing\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\",\"name\":\"dbi services\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"width\":512,\"height\":512,\"caption\":\"dbi services\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/dbiservices\\\/\",\"https:\\\/\\\/x.com\\\/dbiservices\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/dbi-services\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/dbiservices\"],\"description\":\"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.\",\"email\":\"info@dbi-services.com\",\"telephone\":\"+41 32 422 96 00\",\"legalName\":\"dbi services SA\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/7980252d7d7a521e285e7c66114cf82a\",\"name\":\"St\u00e9phane Haby\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/STH_web-min-scaled.jpg\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/STH_web-min-scaled.jpg\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/STH_web-min-scaled.jpg\",\"caption\":\"St\u00e9phane Haby\"},\"description\":\"St\u00e9phane Haby has more than 20 years of experience in Microsoft solutions, specializing in the installation, migration, best practices, and performance analysis of Microsoft SQL Server, as well as Microsoft Business Intelligence solutions (SharePoint, Office) and .NET development for the banking sector. A former Microsoft Most Valuable Professional (MVP) and early adopter of Microsoft Team System in France, he has authored several technical articles. He holds Microsoft Certified Solutions Associate (MCSA) and Expert (MCSE) for SQL Server, MCTS, MCITP for SQL Server 2008, and ITIL V3 Foundation certifications. His industry experience covers chemicals and pharma, banking, and financial services.\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/stephane-haby\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL Server: How to shrink the T-log file for a lot of old user-databases - dbi services Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server: How to shrink the T-log file for a lot of old user-databases","og_description":"Recently I have the case that a customer has a lot of databases not more used but need to be accessible at any time. In this case, we had a lot of T-log with the size when there are used and now we can really shrink and have some place on the disk. I don\u2019t&hellip;&nbsp;","og_url":"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/","og_site_name":"dbi services Blog","article_publisher":"https:\/\/www.facebook.com\/dbiservices\/","article_published_time":"2023-10-06T08:43:02+00:00","og_image":[{"width":977,"height":388,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink01.png","type":"image\/png"}],"author":"St\u00e9phane Haby","twitter_card":"summary_large_image","twitter_creator":"@dbiservices","twitter_site":"@dbiservices","twitter_misc":{"Written by":"St\u00e9phane Haby","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/"},"author":{"name":"St\u00e9phane Haby","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/7980252d7d7a521e285e7c66114cf82a"},"headline":"SQL Server: How to shrink the T-log file for a lot of old user-databases","datePublished":"2023-10-06T08:43:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/"},"wordCount":338,"commentCount":0,"publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink01.png","keywords":["Microsoft"],"articleSection":["Database","SQL Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/","url":"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/","name":"SQL Server: How to shrink the T-log file for a lot of old user-databases - dbi services Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink01.png","datePublished":"2023-10-06T08:43:02+00:00","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink01.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/10\/shrink01.png","width":977,"height":388},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-how-to-shrink-the-t-log-file-for-a-lot-of-old-user-databases\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SQL Server: How to shrink the T-log file for a lot of old user-databases"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi services Blog","description":"#BeSharing","publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.dbi-services.com\/#organization","name":"dbi services","url":"https:\/\/www.dbi-services.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","width":512,"height":512,"caption":"dbi services"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/dbiservices\/","https:\/\/x.com\/dbiservices","https:\/\/www.linkedin.com\/company\/dbi-services\/","https:\/\/www.youtube.com\/user\/dbiservices"],"description":"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.","email":"info@dbi-services.com","telephone":"+41 32 422 96 00","legalName":"dbi services SA"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/7980252d7d7a521e285e7c66114cf82a","name":"St\u00e9phane Haby","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/08\/STH_web-min-scaled.jpg","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/08\/STH_web-min-scaled.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/08\/STH_web-min-scaled.jpg","caption":"St\u00e9phane Haby"},"description":"St\u00e9phane Haby has more than 20 years of experience in Microsoft solutions, specializing in the installation, migration, best practices, and performance analysis of Microsoft SQL Server, as well as Microsoft Business Intelligence solutions (SharePoint, Office) and .NET development for the banking sector. A former Microsoft Most Valuable Professional (MVP) and early adopter of Microsoft Team System in France, he has authored several technical articles. He holds Microsoft Certified Solutions Associate (MCSA) and Expert (MCSE) for SQL Server, MCTS, MCITP for SQL Server 2008, and ITIL V3 Foundation certifications. His industry experience covers chemicals and pharma, banking, and financial services.","url":"https:\/\/www.dbi-services.com\/blog\/author\/stephane-haby\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/28457","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=28457"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/28457\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=28457"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=28457"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=28457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}