Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
Administering
»
Move a clustered index from one filegroup to...
Move a clustered index from one filegroup to another on a production database
Rate Topic
Display Mode
Topic Options
Author
Message
DesmoShane
DesmoShane
Posted Tuesday, November 06, 2012 2:55 PM
SSC Rookie
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 3:46 PM
Points: 35,
Visits: 321
I would like to move a clustered index from one filegroup to another on a production database without causing any disruption for users and was wondering if this is the recommended process for doing this
sql version is 2008 R2 Enterprise
The table has non clustered indexes in a different filegroup so the clustered index is the only data in this filegroup. The options i think should work are are in the attached script
USE [Database_Name]
GO
CREATE CLUSTERED INDEX [Clustered_Index_Name] ON [dbo].[Table_Name]
(
[Column_1_Name] ASC,
[Column_2_Name] ASC,
[Column_3_Name] ASC,
[Column_4_Name] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = ON, ONLINE = ON, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY]
GO
Can someone advise if doing this (apart from cpu\memory usage) will cause any unexpected issues with the user experience on the database that this is being run on and if i am aproaching this in a recommended or best practice fashion
will the resulting non-clustered indexes will they be rebuilt automaticaly and be an online operation
Post #1381722
sanket kokane
sanket kokane
Posted Tuesday, November 06, 2012 10:43 PM
Old Hand
Group: General Forum Members
Last Login: 2 days ago @ 5:04 AM
Points: 323,
Visits: 966
DesmoShane (11/6/2012)
I would like to move a clustered index from one filegroup to another on a production database without causing any disruption for users and was wondering if this is the recommended process for doing this
sql version is 2008 R2 Enterprise
The table has non clustered indexes in a different filegroup so the clustered index is the only data in this filegroup. The options i think should work are are in the attached script
USE [Database_Name]
GO
CREATE CLUSTERED INDEX [Clustered_Index_Name] ON [dbo].[Table_Name]
(
[Column_1_Name] ASC,
[Column_2_Name] ASC,
[Column_3_Name] ASC,
[Column_4_Name] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = ON, ONLINE = ON, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY]
GO
Can someone advise if doing this (apart from cpu\memory usage) will cause any unexpected issues with the user experience on the database that this is being run on and if i am aproaching this in a recommended or best practice fashion
will the resulting non-clustered indexes will they be rebuilt automaticaly and be an online operation
why you need to move clustered indexes to new filegroup ?
Moving clustered indexes to another filegroup is nothing but you are moving entire table to the new filegroup.
-----------------------------------------------------------------------------
संकेत कोकणे
Post #1381793
Bhuvnesh
Bhuvnesh
Posted Wednesday, November 07, 2012 3:46 AM
SSCrazy
Group: General Forum Members
Last Login: Tuesday, March 26, 2013 8:41 AM
Points: 2,562,
Visits: 3,451
you can also opt
SORT_IN_TEMPDB = ON
to divert the IO load to tempdb too
-------Bhuvnesh----------
While 1 = 1 (Learning SQL....)
Click to get fast response of your post
Post #1381889
Bhuvnesh
Bhuvnesh
Posted Wednesday, November 07, 2012 3:52 AM
SSCrazy
Group: General Forum Members
Last Login: Tuesday, March 26, 2013 8:41 AM
Points: 2,562,
Visits: 3,451
DesmoShane (11/6/2012)
will the resulting non-clustered indexes will they be rebuilt automaticaly and be an online operation
YEs. any change to the cluster keys forces all the non-clustered indexes to be rebuilt after the new clustered index has been created. but try to perform this on off-peak hours
-------Bhuvnesh----------
While 1 = 1 (Learning SQL....)
Click to get fast response of your post
Post #1381891
sanket kokane
sanket kokane
Posted Wednesday, November 07, 2012 4:24 AM
Old Hand
Group: General Forum Members
Last Login: 2 days ago @ 5:04 AM
Points: 323,
Visits: 966
Bhuvnesh (11/7/2012)
DesmoShane (11/6/2012)
will the resulting non-clustered indexes will they be rebuilt automaticaly and be an online operation
YEs. any change to the cluster keys forces all the non-clustered indexes to be rebuilt after the new clustered index has been created. but try to perform this on off-peak hours
I don't thinks so.
look at the Paul's blog ... Myth No.3
http://www.sqlskills.com/blogs/paul/post/Search-Engine-QA-19-Misconceptions-around-index-rebuilds-%28allocation-BULK_LOGGED-mode-locking%29.aspx
-----------------------------------------------------------------------------
संकेत कोकणे
Post #1381905
Bhuvnesh
Bhuvnesh
Posted Wednesday, November 07, 2012 4:44 AM
SSCrazy
Group: General Forum Members
Last Login: Tuesday, March 26, 2013 8:41 AM
Points: 2,562,
Visits: 3,451
sanket kokane (11/7/2012)
Bhuvnesh (11/7/2012)
DesmoShane (11/6/2012)
will the resulting non-clustered indexes will they be rebuilt automaticaly and be an online operation
YEs. any change to the cluster keys forces all the non-clustered indexes to be rebuilt after the new clustered index has been created. but try to perform this on off-peak hours
I don't thinks so.
look at the Paul's blog ... Myth No.3
http://www.sqlskills.com/blogs/paul/post/Search-Engine-QA-19-Misconceptions-around-index-rebuilds-%28allocation-BULK_LOGGED-mode-locking%29.aspx
thanks
-------Bhuvnesh----------
While 1 = 1 (Learning SQL....)
Click to get fast response of your post
Post #1381911
DesmoShane
DesmoShane
Posted Wednesday, November 07, 2012 12:02 PM
SSC Rookie
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 3:46 PM
Points: 35,
Visits: 321
thanks for your help :) so it looks like it shouldn't rebuild all the non-clustered indexes (sql 2008 r2) and as per always would pay to do this "out of hours if possible"
Post #1382115
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.