Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Table partitioning automatic procs


Table partitioning automatic procs

Author
Message
jaiki987
jaiki987
Valued Member
Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)

Group: General Forum Members
Points: 63 Visits: 533
Hi,
I am in the process of partitioning a very large database and using the sliding window technique to archive the oldest
partitioned data and move it into an archive table. The tables are partitioned on a date column.
So far I have successfully been able to partition the main table and the archive table and have successfully been able to
switch the oldest partition out of the main table and into the new partition created in the archive table. After many repeated trial it seems to work.
But now I would like to automate the procedure by writing some stored procedures and functions that would automatically switch out the old partition out at the beginning of every month. These stored procedures would be
initiated by a SQL Server Agent job at the beginning of every month.

My question is
1. Is there a better way to work this problem other then stored procedures and jobs.
2. Are there are scripts or white papers out there that have tried to automate the sliding window proc
3. And finally, what the advantages and disadvantages of using this technique?

Thank you in advance for your help. It is very much appreciated.

Jay
PaulB-TheOneAndOnly
PaulB-TheOneAndOnly
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3095 Visits: 4639
jaiki987 (6/21/2010)1. Is there a better way to work this problem other then stored procedures and jobs.
2. Are there are scripts or white papers out there that have tried to automate the sliding window proc
3. And finally, what the advantages and disadvantages of using this technique?

1- I do like automatic processes.
2- Tons. like http://weblogs.sqlteam.com/dang/archive/2008/09/17/Automating-RANGE-RIGHT-Sliding-Window-Maintenance.aspx
3- If properly tested, monitored and documented nothing will beat it; if poorly tested, monitored and documented it may be the reason you get fired. :-D

_____________________________________
Pablo (Paul) Berzukov

Author of Understanding Database Administration available at Amazon and other bookstores.

Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
David BAFFALEUF
David BAFFALEUF
Valued Member
Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)

Group: General Forum Members
Points: 65 Visits: 712
2) My favourite is Kim Tripp's WP: http://msdn2.microsoft.com/en-us/library/ms345146.aspx
Ron Talmage has made an update for SQL 2008 here http://msdn.microsoft.com/en-us/library/dd578580.aspx

David B.

David B.
jaiki987
jaiki987
Valued Member
Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)

Group: General Forum Members
Points: 63 Visits: 533
Thanks everyone for the replies. Greatly appreciated
I have a couple of more questions on partitioning:

This is the system that I have developed and been testing.

SPLIT -- SWITCH -- MERGE

SPLIT - Create a stored procedure that selects the split date = to the first day of the month
and splits the archive table at that date.

SWITCH - Create a stored procedure to switch the oldest partition with the empty new partition that was created
using the previous procedure

MERGE - Create a stored procedure to merge the empty in the original table so as to remove that partition and

So basically a new empty partition will be created in the archive table. And the oldest partition in the live table will be switched out with the empty partition in the archive table. Then the oldest partition in the live table will be removed by MERGE(ing) the boundary.
I have done several tests and it seems to work.

Question:
1. I see alot of case studies using staging tables, but I will not be using that. The oldest data is being switched out
with a new empty partition created in the archive table
Both the archive and live table have the same table structured, indexes etc
Is a staging table necessary?
JakDBA
JakDBA
Valued Member
Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)

Group: General Forum Members
Points: 63 Visits: 400
Do you have the solution i am looking for something similar....

@JayMunnangi
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search