Solved

Restoring Split DB files to one single file

Posted on 2012-04-12
3
352 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
[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
  • 2
3 Comments
 
LVL 17

Assisted Solution

by:Barry Cunney
Barry Cunney earned 250 total points
ID: 37837949
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
ID: 37838197
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
ID: 37854932
Found the solution while searching
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

730 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