Solved

Restoring Split DB files to one single file

Posted on 2012-04-12
3
344 Views
Last Modified: 2012-04-17
I have a situation where someone added files to SQL server and created table partitions to use those files.  

My big question is, because we're moving the database to a non-enterprise level server, can this be reversed?  Can I un-partition the tables and bring the database back to a single mdf and ldf?  

Thanks in Advance!!!
0
Comment
Question by:naisnet
  • 2
3 Comments
 
LVL 17

Assisted Solution

by:Barry Cunney
Barry Cunney earned 250 total points
Comment Utility
I have not done this before but I am thinking that partition switching may be an option.
You could swicth each partion in turn out of the partitioned table to a non partitioned table

ALTER TABLE dbo.f_sales SWITCH PARTITION 1 TO dbo.sales_new
ALTER TABLE dbo.f_sales SWITCH PARTITION 2 TO dbo.sales_new
....
.....
0
 
LVL 2

Accepted Solution

by:
naisnet earned 0 total points
Comment Utility
1. DROP INDEX CIDX_X on X /* drop the clustered */
2. CREATE CLUSTERED INDEX CIDX_X1 ON X(col1) ON [PRIMARY]

/* Create another clustered index on the table to free it from the partitioning scheme; Here, the "ON [primary]" part is key to removing the partition scheme from the table ! */

3. DROP PARTITION SCHEME PS1
4. DROP PARTITION FUNCTION PF1
5. DROP INDEX CIDX_X1 ON X

/* drop the dummy clustered index you created, as it was only created to free the table from the partitioning scheme */
0
 
LVL 2

Author Closing Comment

by:naisnet
Comment Utility
Found the solution while searching
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now