{"id":10765,"date":"2018-01-15T06:20:21","date_gmt":"2018-01-15T05:20:21","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/"},"modified":"2018-01-15T06:20:21","modified_gmt":"2018-01-15T05:20:21","slug":"moving-tables-online-on-filegroup-with-constraints-and-lob-data","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/","title":{"rendered":"Moving tables ONLINE on filegroup with constraints and LOB data"},"content":{"rendered":"<p>Let&#8217;s start\u00a0this new week by\u00a0going back to a discussion with one of my customers a couple of\u00a0days ago about moving\u00a0several tables into different filegroups. Let&#8217;s say that some of them\u00a0contained LOB data.\u00a0Let&#8217;s add to the\u00a0game another customer requirement:\u00a0moving\u00a0all of them\u00a0ONLINE to avoid impacting the data availability during the migration process. The concerned tables had schema constraints as primary key and foreign keys and non-clustered indexes as well. So a pretty common\u00a0schema we may\u00a0deal with\u00a0daily at customer shops.<\/p>\n<p>Firstly,\u00a0let&#8217;s say that the first topic of the discussion\u00a0didn\u2019t focus on moving non-clustered indexes on a different filegroup (pretty well-known from my customer) but on how to manage moving constraints online\u00a0without integrity issues. The main reason of that\u00a0came from different pointers found by my customer on the internet where we have to first drop such constraints and then to recreate them (by using TO MOVE clause) and that&#8217;s whay\u00a0he was not very confident to move such constraints without introducing integrity issues.<\/p>\n<p>Let&#8217;s illustrate this scenario with the following demonstration. I will use a<strong><em> dbo.TransactionHistory2<\/em><\/strong> table that I want to move ONLINE from the <em>primary<\/em> to the <em>FG1<\/em> filegroup. There is a primary key constraint on the <strong><em>TransactionID<\/em><\/strong> column as well as foreign key on the <strong><em>ProductID <\/em><\/strong>column that refers to <strong><em>dbo.bigProduct<\/em><\/strong> table and the <strong><em>ProductID<\/em><\/strong> column.<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">EXEC sp_helpconstraint 'dbo.bigTransactionHistory2';<\/pre>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-1-bigTransactionHistory2-PK-FK-e1515777625315.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20627\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-1-bigTransactionHistory2-PK-FK-e1515777625315.jpg\" alt=\"blog 125 - 1 - bigTransactionHistory2 PK FK\" width=\"800\" height=\"105\" \/><\/a><\/p>\n<p>Here a picture of indexes existing on the <em><strong>dbo.bigTransactionHistory2<\/strong><\/em> table:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">EXEC sp_helpindex 'dbo.bigTransactionHistory2';<\/pre>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-2-bigTransactionHistory2-indexes.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20628\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-2-bigTransactionHistory2-indexes.jpg\" alt=\"blog 125 - 2 - bigTransactionHistory2 indexes\" width=\"846\" height=\"78\" \/><\/a><\/p>\n<p>Let&#8217;s say that the <strong><em>pk_big_TranactionHistory_TransactionID <\/em><\/strong>unique clustered index is<strong><em>\u00a0<\/em><\/strong>tied to the primary key constraint.<\/p>\n<p>Let&#8217;s start by using the first approach based on the WITH MOVE clause\u00a0.<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">ALTER TABLE dbo.bigTransactionHistory2 DROP CONSTRAINT pk_bigTransactionHistory_TransactionID WITH (MOVE TO FG1, ONLINE = ON);\n\n--&gt; No constraint to avoid duplicates\n\nALTER TABLE dbo.bigTransactionHistory2 ADD CONSTRAINT pk_bigTransactionHistory_TransactionID PRIMARY KEY(TransactionDate, TransactionID)\nWITH (ONLINE = ON);<\/pre>\n<p>By looking\u00a0further at\u00a0the\u00a0script performed \u00a0we may quickly figure out that this approach may lead to introduce duplicate entries between the drop constraint\u00a0step and the move table on the FG1 filegroup and\u00a0 create constraint step.<\/p>\n<p>We\u00a0might address this issue by encapsulating the above command within a transaction. But obviously this method has cost: we have good chance to create a long\u00a0blocking scenario &#8211; depending on the amount of data &#8211; and leading temporary to data unavailability. The second drawback\u00a0concerns the\u00a0performance. Indeed, we first drop the primary key constraint meaning we are dropping the underlying clustered index structure in the background. Going this way implies to rebuild also related non-clustered indexes to update the leaf level with row ids and to rebuild them again when re-adding the primary key constraint in the second step.<\/p>\n<p>From my point of view there is a better way to go through if we want all the steps to be performed efficiently and ONLINE including the guarantee that constraints will continue to ensure checks during all the moving process.<\/p>\n<p>Firstly, let\u2019s move the primary key by using a one-step command. The same applies to the UNIQUE constraints. In fact, moving such constraint requires only to rebuild the corresponding index with the parameters DROP_EXISTING and ONLINE parameters to preserve the constraint functionality. In this case, my non-clustered indexes are not touched by the operation because we don\u2019t have to update the leaf level as the previous method.<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">CREATE UNIQUE CLUSTERED INDEX pk_bigTransactionHistory_TransactionID\nON dbo.bigTransactionHistory2 ( [TransactionDate] ASC, [TransactionID] ASC )\nWITH (ONLINE = ON, DROP_EXISTING = ON)\nON [FG1];<\/pre>\n<p>In addition, the good news is if we try to introduce a duplicate key while\u00a0the index\u00a0is rebuilding on the FG1 filegroup we will face the following error as expected:<\/p>\n<p><em><strong>Msg 2627, Level 14, State 1, Line 3<\/strong><br \/>\n<strong>Violation of PRIMARY KEY constraint &#8216;pk_bigTransactionHistory_TransactionID&#8217;.<\/strong><br \/>\n<strong>Cannot insert duplicate key in object &#8216;dbo.bigTransactionHistory2&#8217;. The duplicate key value is (Jan 1 2005 12:00AM, 1).<\/strong><\/em><\/p>\n<p>So now we may safely move the additional structures represented by the non-clustered index. We just have to execute the following command to move ONLINE the corresponding physical structure:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">CREATE INDEX [idx_bigTransactionHistory2_ProductID]\nON dbo.bigTransactionHistory2 ( ProductID ) \nWITH (DROP_EXISTING = ON, ONLINE = ON)\nON [FG1]<\/pre>\n<p>&nbsp;<\/p>\n<p>Le&#8217;ts continue with the second scenario that consisted in moving a table ONLINE on a different filegroup with LOB data. Moving such data\u00a0may be\u00a0more complex as we may expect. The good news is SQL Server 2012\u00a0has introduced\u00a0ONLINE operation\u00a0capabilities and my customer run on SQL Server 2014.<\/p>\n<p>For the demonstration let&#8217;s going back to the previous demo and let&#8217;s introduce a new [other infos] column with VARCHAR(MAX) data. Here the new definition of the <em><strong>dbo.bigTransactionHistory2<\/strong> <\/em>table:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">CREATE TABLE [dbo].[bigTransactionHistory2](\n\t[TransactionID] [bigint] NOT NULL,\n\t[ProductID] [int] NOT NULL,\n\t[TransactionDate] [datetime] NOT NULL,\n\t[Quantity] [int] NULL,\n\t[ActualCost] [money] NULL,\n\t[other infos] [varchar](max) NULL,\n CONSTRAINT [pk_bigTransactionHistory_TransactionID] PRIMARY KEY CLUSTERED \n(\n\t[TransactionID] ASC\n)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],\n) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]\nGO<\/pre>\n<p>Let&#8217;s take a look at the table&#8217;s underlying structure:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SELECT \n\tOBJECT_NAME(p.object_id) AS table_name,\n\tp.index_id,\n\tp.rows,\n\tau.type_desc AS alloc_unit_type,\n\tau.used_pages,\n\tfg.name AS fg_name\nFROM \n\tsys.partitions as p\nJOIN \n\tsys.allocation_units AS au on p.hobt_id = au.container_id\nJOIN\t\n\tsys.filegroups AS fg on fg.data_space_id = au.data_space_id\nWHERE\n\tp.object_id = OBJECT_ID('bigTransactionHistory2')\nORDER BY\n\ttable_name, index_id, alloc_unit_type<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-3-bigTransactionHistory2-with-LOB.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20672\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-3-bigTransactionHistory2-with-LOB.jpg\" alt=\"blog 125 - 3 - bigTransactionHistory2 with LOB\" width=\"625\" height=\"122\" \/><\/a><\/p>\n<p>A\u00a0new LOB_DATA\u00a0allocation unit type\u00a0is there\u00a0and indicates the table contains LOB data for all the index structures. At this stage, we may think that\u00a0going to the\u00a0previous way to move online\u00a0the unique clustered index is sufficient but it is not according the\u00a0output below:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">CREATE UNIQUE CLUSTERED INDEX pk_bigTransactionHistory_TransactionID\nON dbo.bigTransactionHistory2 ( [TransactionID] )\nWITH (ONLINE = ON, DROP_EXISTING = ON)\nON [FG1];<\/pre>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-4-bigTransactionHistory2-move-LOB-data.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20674\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-4-bigTransactionHistory2-move-LOB-data.jpg\" alt=\"blog 125 - 4 - bigTransactionHistory2 move LOB data\" width=\"625\" height=\"122\" \/><\/a><\/p>\n<p>In fact, only data in IN_ROW_DATA allocation units moved from the PRIMARY to FG1 filegroup. In this context, moving LOB data is a non-trivial operation and\u00a0I had to\u00a0use a solution\u00a0based on one proposed <a href=\"https:\/\/www.sqlskills.com\/blogs\/kimberly\/understanding-lob-data-20082008r2-2012\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>\u00a0by Kimberly L. Tripp from SQLSkills (definitely one of my favorite sources for tricky scenarios). So partitioning is the way to go.\u00a0In respect of the solution fom SQLSkills I created a temporary partition function and scheme as shown below:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SELECT MAX([TransactionID])\nFROM dbo.bigTransactionHistory2\n-- 6910883\nGO\n\n\nCREATE PARTITION FUNCTION pf_bigTransaction_history2_temp (BIGINT)\nAS RANGE RIGHT FOR VALUES (6920000)\nGO\n\nCREATE PARTITION SCHEME ps_bigTransaction_history2_temp\nAS PARTITION pf_bigTransaction_history2_temp\nTO ( [FG1], [PRIMARY] )\nGO<\/pre>\n<p>Applying the scheme to the <em><strong>dbo.bigTransactionHistory2<\/strong><\/em> table will allow us to move all data (IN_ROW_DATA and LOB_DATA) from the PRIMARY to FG1 filegroup as shown below:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">CREATE UNIQUE CLUSTERED INDEX pk_bigTransactionHistory_TransactionID\nON dbo.bigTransactionHistory2 ( [TransactionID] ASC )\nWITH (ONLINE = ON, DROP_EXISTING = ON)\nON ps_bigTransaction_history2_temp ([TransactionID])<\/pre>\n<p>Looking quickly at the\u00a0storage\u00a0configuration confirms\u00a0this time all data moved\u00a0to the right FG1.<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-5-bigTransactionHistory2-partitioning.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20677\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-5-bigTransactionHistory2-partitioning.jpg\" alt=\"blog 125 - 5 - bigTransactionHistory2 partitioning\" width=\"630\" height=\"174\" \/><\/a><\/p>\n<p>Let&#8217;s finally remove the temporary partitioning configuration\u00a0from the table (remember that all operations are performed ONLINE)<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">CREATE UNIQUE CLUSTERED INDEX pk_bigTransactionHistory_TransactionID\nON dbo.bigTransactionHistory2 ( [TransactionID] ASC )\nWITH (ONLINE = ON, DROP_EXISTING = ON)\nON [FG1]\n\n-- Remove underlying partition configuration\nDROP PARTITION SCHEME ps_bigTransaction_history2_temp;\nDROP PARTITION FUNCTION pf_bigTransaction_history2_temp;\nGO<\/pre>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-6-bigTransactionHistory2-last-config.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20678\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-6-bigTransactionHistory2-last-config.jpg\" alt=\"blog 125 - 6 - bigTransactionHistory2 last config\" width=\"625\" height=\"122\" \/><\/a><\/p>\n<p>Finally, you can apply the same method for all non-clustered indexes that contain LOB data\u00a0&#8230;<\/p>\n<p>Cheers<\/p>\n<p><span style=\"float: none;background-color: #ffffff;color: #333333;cursor: text;font-family: Georgia,'Times New Roman','Bitstream Charter',Times,serif;font-size: 16px;font-style: normal;font-variant: normal;font-weight: 400;letter-spacing: normal;text-align: left;text-decoration: none;text-indent: 0px;text-transform: none\">By David Barbarin<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s start\u00a0this new week by\u00a0going back to a discussion with one of my customers a couple of\u00a0days ago about moving\u00a0several tables into different filegroups. Let&#8217;s say that some of them\u00a0contained LOB data.\u00a0Let&#8217;s add to the\u00a0game another customer requirement:\u00a0moving\u00a0all of them\u00a0ONLINE to avoid impacting the data availability during the migration process. The concerned tables had schema [&hellip;]<\/p>\n","protected":false},"author":26,"featured_media":10766,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[1264,51],"type_dbi":[],"class_list":["post-10765","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database-administration-monitoring","tag-online-operations","tag-sql-server"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Moving tables ONLINE on filegroup with constraints and LOB data<\/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\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Moving tables ONLINE on filegroup with constraints and LOB data\" \/>\n<meta property=\"og:description\" content=\"Let&#8217;s start\u00a0this new week by\u00a0going back to a discussion with one of my customers a couple of\u00a0days ago about moving\u00a0several tables into different filegroups. Let&#8217;s say that some of them\u00a0contained LOB data.\u00a0Let&#8217;s add to the\u00a0game another customer requirement:\u00a0moving\u00a0all of them\u00a0ONLINE to avoid impacting the data availability during the migration process. The concerned tables had schema [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-15T05:20:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-1-bigTransactionHistory2-PK-FK-e1515777625315.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"105\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Microsoft Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Microsoft Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 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\\\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\\\/\"},\"author\":{\"name\":\"Microsoft Team\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/bfab48333280d616e1170e7369df90a4\"},\"headline\":\"Moving tables ONLINE on filegroup with constraints and LOB data\",\"datePublished\":\"2018-01-15T05:20:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\\\/\"},\"wordCount\":945,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/blog-125-1-bigTransactionHistory2-PK-FK-e1515777625315.jpg\",\"keywords\":[\"online operations\",\"SQL Server\"],\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\\\/\",\"name\":\"Moving tables ONLINE on filegroup with constraints and LOB data\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/blog-125-1-bigTransactionHistory2-PK-FK-e1515777625315.jpg\",\"datePublished\":\"2018-01-15T05:20:21+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/bfab48333280d616e1170e7369df90a4\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/blog-125-1-bigTransactionHistory2-PK-FK-e1515777625315.jpg\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/blog-125-1-bigTransactionHistory2-PK-FK-e1515777625315.jpg\",\"width\":800,\"height\":105},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Moving tables ONLINE on filegroup with constraints and LOB data\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"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\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/bfab48333280d616e1170e7369df90a4\",\"name\":\"Microsoft Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"caption\":\"Microsoft Team\"},\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/microsoft-team\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Moving tables ONLINE on filegroup with constraints and LOB data","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\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/","og_locale":"en_US","og_type":"article","og_title":"Moving tables ONLINE on filegroup with constraints and LOB data","og_description":"Let&#8217;s start\u00a0this new week by\u00a0going back to a discussion with one of my customers a couple of\u00a0days ago about moving\u00a0several tables into different filegroups. Let&#8217;s say that some of them\u00a0contained LOB data.\u00a0Let&#8217;s add to the\u00a0game another customer requirement:\u00a0moving\u00a0all of them\u00a0ONLINE to avoid impacting the data availability during the migration process. The concerned tables had schema [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/","og_site_name":"dbi Blog","article_published_time":"2018-01-15T05:20:21+00:00","og_image":[{"width":800,"height":105,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-1-bigTransactionHistory2-PK-FK-e1515777625315.jpg","type":"image\/jpeg"}],"author":"Microsoft Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Microsoft Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/"},"author":{"name":"Microsoft Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4"},"headline":"Moving tables ONLINE on filegroup with constraints and LOB data","datePublished":"2018-01-15T05:20:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/"},"wordCount":945,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-1-bigTransactionHistory2-PK-FK-e1515777625315.jpg","keywords":["online operations","SQL Server"],"articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/","url":"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/","name":"Moving tables ONLINE on filegroup with constraints and LOB data","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-1-bigTransactionHistory2-PK-FK-e1515777625315.jpg","datePublished":"2018-01-15T05:20:21+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-1-bigTransactionHistory2-PK-FK-e1515777625315.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog-125-1-bigTransactionHistory2-PK-FK-e1515777625315.jpg","width":800,"height":105},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/moving-tables-online-on-filegroup-with-constraints-and-lob-data\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Moving tables ONLINE on filegroup with constraints and LOB data"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","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":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4","name":"Microsoft Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","caption":"Microsoft Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/microsoft-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/10765","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\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=10765"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/10765\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/10766"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=10765"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=10765"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=10765"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=10765"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}