Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Recreate a table with partitions

Posted on 2012-03-12
7
Medium Priority
?
193 Views
Last Modified: 2012-03-15
Hello!

i have a table X with dependencies to other tables,views and the works ( 325 million rows approx.)

cannot use export import as i have to delete the orig.table.
switch partition is not a option "I THINK?"

what do i do?

I MUST USE read only FILEGROUPS on this table. WHY? because of faster backup and the data will never change. ( create partitions for a quarter ( 4 months). most of the queries runs against this table (cannot create a historic DB) and other issues from the departments.
0
Comment
Question by:shanj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 40

Expert Comment

by:lcohan
ID: 37714802
"
i have a table X with dependencies to other tables,views and the works ( 325 million rows approx.)

cannot use export import as i have to delete the orig.table.
switch partition is not a option "I THINK?"

what do i do?

"


Sorry but in my opinion is not clear what do you really need to do therefor could you let us know what the real task is?
Do you need to transfer that table into another server/database/table then drop it??
0
 

Author Comment

by:shanj
ID: 37715338
I would like to create a partition on this table. with about 24 filgroups.
each file group will represent a quater year.( 4 months)
Further more after each quarter  i would like to make these filegroups into read only filegroups. ( i will be taking partial backups?)
0
 
LVL 40

Expert Comment

by:lcohan
ID: 37716268
"I would like to create a partition on this table. with about 24 filgroups."
I suggest create a new table as above and populate it from the old one than drop the old one but of course do all these in a test environment even if you don't have the 325 million rows in test env.

"each file group will represent a quater year.( 4 months)"
Then why not
1 table with 3 partitions?
    1 old and inactive,
    1 current and active,
    1 future to have it ready for > currentdate + next quarter (4months)
1 archive table with same structure to hold your historical data and where you could switch out/attach obsolete(old and inactive) partitions from above table.

BTW - 1 quarter in my opinion = 3 months (not 4) so you will have a full year sliding window in the active partitioned table with 4 (right boundary) partitions.



"Further more after each quarter  i would like to make these filegroups into read only filegroups. ( i will be taking partial backups?)"

Above scenario works as well for "partial backups" if you consider each partition on its own physical filegroup and backup the one(s) at will.
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 

Author Comment

by:shanj
ID: 37720067
I suggest create a new table as above and populate it from the old one than drop the old one ...

My problem is my old table has a lot of dependencies.?
0
 
LVL 40

Expert Comment

by:lcohan
ID: 37720087
I think if you create a new partitioned table and keep using the existing one as a read only history/archive you don't need to worry about dependencies however the new one must be obviously added to all the code using old one.
0
 

Author Comment

by:shanj
ID: 37720981
OK, this is a solution. i See it. not sure if the developers + users will accept this, they have to change a lot of rapports ( buisness Objects) and have 2 copies of the same report?
0
 
LVL 40

Accepted Solution

by:
lcohan earned 2000 total points
ID: 37721714
Another way to deal with what you just said would be to add this new partitioned table for active portion of data, rename the old one to original_table_name_history or something then create a VIEW  with identical name as old table and give exactly same permisions. I used this scenario pretty often when adding/changing object names were a pain from app develpment - maintenance point of view and it worked. Only thing is you may need to have your app down while renaming the SQL objects but other than that the scenario should work and this way the process is disconneted from the front end.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question