Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 High Availability (2005)
 sql mirroring + table reindex

Author  Topic 

cz
Starting Member

19 Posts

Posted - 2010-09-08 : 14:22:10
Hi,

I have primary SQLA and secondary SQLB through data mirroring. Since table reindexing(online) will take a few hours and slow down SQLA, I would like to switch over to SQLB, perform reindexing on SQLA and switch back to SQLA. Is this possible? How do I re-sync the SQLB and SQLA after reindexing?

Thanks

cz
Starting Member

19 Posts

Posted - 2010-09-08 : 14:37:12
And be aware that this is a 24x7 environment.
Thanks
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-08 : 14:46:07
That is not possible as the mirrored database is completely unavailable.

Consider running update stats daily and reindex infrequently, such as once a week during a slow day. And only reindex those that need it, such as those with over 50% fragmentation. Make sure to use ONLINE=ON if you've got Enterprise edition.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

cz
Starting Member

19 Posts

Posted - 2010-09-08 : 15:49:59
Thanks tkizer.

So it is impossible with data mirroring, I guess log shipping wont work either, but how about replication :

1) do table reindexing or other maintenance on subscriber
2) promote it to publisher
3) previous publisher becomes subscriber

Your feedback is much appreciated.


Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-08 : 15:52:36
That's correct that it's not possible with log shipping either.

It would be possible with replication, however you'd have to use two-way replication or merge replication which is not a good idea just to solve this reindexing issue.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-08 : 15:56:04
How big is your database? And what edition of SQL are you using?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

cz
Starting Member

19 Posts

Posted - 2010-09-08 : 16:03:37
SQL 2005 Ent. We have about 40 databases with 1.2T in total, and 2 SANS with Fiber connection.

We can upgrade to 2008 Ent if needed.

Thx
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-08 : 16:05:32
Then you shouldn't need to move production to another server. Use a custom script that can do the reindexing based upon the best options, like mine: http://weblogs.sqlteam.com/tarad/archive/2009/11/03/DefragmentingRebuilding-Indexes-in-SQL-Server-2005-and-2008Again.aspx



Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

cz
Starting Member

19 Posts

Posted - 2010-09-08 : 16:19:48

Not only for the table reindexing, we could also use this for other maintenance tasks, which may take long time. So we would like to have a second server which we can run tasks on and also can bring in sync with production.

I like the bidirectional replication idea. I don't need load balancing at this point, so only one way replication is active at any time, is this correct?

Thx
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-08 : 16:27:10
I don't know, that would be up to you. It will be very complex to implement.

What other maintenance tasks are you referring to?

I have a 1TB database that gets 3000 transactions per second. I don't have any need to do my maintenance tasks on a second server except for DBCC CHECKDB. For the DBCC CHECKDB part, we do backup/restore to a different server and then run DBCC CHECKDB there, as is the best practice.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

cz
Starting Member

19 Posts

Posted - 2010-09-08 : 16:41:20
Thanks Tara for your valuable points!!!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-08 : 16:56:43
You're welcome, glad to help.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2010-09-08 : 19:41:06
just FYI: replication will not replicate reindex scripts.. replication will only replicate transactions - insert/update/delete/stored procs etc.



Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-08 : 19:52:34
Right, but I don't think the intention is to "replication" the reindex changes. But rather the intention is to use a system not bogged down by the reindex job. With Enterprise edition, a custom script, and a slowish period, the OP really shouldn't be concerned.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2010-09-09 : 12:18:43
The OP seems to think that he can run maintenance on subscriber while the publisher is serving production users, and then switch direction to the subscriber and continue the workload..

what I was trying to alert was, if he is doing maintenance on subscriber while the production was taking on load, the transactions are going to queue up in the distribution db since distrib wont be able to apply them on the subscriber until the maintenance is done.. this will increase the latency.. when the maintenance is done, depending on the amount of transactions generated it can be a while before subscriber catches up with publisher. At this point, if he wants to redirect production users to subscriber they need modify the connection string in the application server which means downtime..



Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-09 : 12:58:26
Agreed about the downtime, that's why I'm trying to steer him away from this. I can't imagine that his system is busy enough to warrant this setup. My system is extremely busy, and we have no need to do this. I have a feeling that the OP is running unneeded maintenance each day.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2010-09-09 : 13:46:04
agree... my recommendation would be to schedule a downtime each week and do the maintenance during that window.. the business needs to know/understand this maintenance is important for efficient workload during the week..

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-09 : 13:50:01
I don't think a downtime is needed. We don't ever take down our systems just to run maintenance, unless the maintenance is different than what I'm thinking (update stats, alter index, ...). We just ensure our maintenance occurs at the slowest periods of the day/week.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2010-09-10 : 20:32:32
I meant reindexing.. online indexing is a great option... but not everyone uses it...

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-10 : 23:18:51
That's why a custom script like mine works so well as it decides if ONLINE=ON can be used for each index to be rebuilt. It uses it wherever possible.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -