I have a mirrored database in full safety mode on sql server 2008 R2 Standard Edition. I want to create a maintenance plan to rebuild and reorganize the indexes on a weekly basis. Maintenance plans are set to take full backups 3 times a day and transaction log backups every 30 minutes. The database is very active and gets lot of traffic. I tried rebuilding the indexes manually during non peak hours and that caused the log file to grow heavily on the principle as well as on the mirror.
Are there any specific steps to be followed for rebuilding indexes in a mirroring environment? I searched online but could not find any difference in the way indexes are rebuilt in mirroring and without mirroring.
Also can I just use DBCC SHRINKFILE on the principle to free the unused space in the log file without stopping the mirroring?
I would strongly discourage you from regularly shrinking the log in a mirrored situation. One day your log will grow on the primary and not have disk space to grow on mirror, primary will not be able to ship log and will be pin the log in place until it grows ad-nauseam and you'll be cursing the job that shrinked your log as you won't be able to resume the mirroring without some complicated hockey-pockey.
If the log grows, it means it needs the extra space. Eventually it will stabilize at the right size and stop growing. That size, whatever will be, is the the operational size required for your log. If anything, you should grow your log right now so it stops growing automatically.
As for the index maintenance, do you have evidence that they need rebuilding at the frequency you're proposing? There is no way to avoid reduce the log space required during index rebuild operations if the database is mirrored.
Yes - there is a big difference in rebuilding indexes on non-mirrored db and mirrored db's. The impact is higher and some things must be checked out before doing this.
Most important you should change from full-safety to high-performance for the maintenance period so that it will not wait the mirror while re-organizing the index.
The log file can be shrinked if you really need to do this but it will not take effect if there are active transactions in it not backed-up. The shrink can be done on a mirrored database in theory, but don't do it on data files because the fragmentation on indexes will grow very much.