Solved

Restoring Split DB files to one single file

Posted on 2012-04-12
3
349 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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
sql server query 12 25
RAISERROR WITH NOWAIT 2 16
Migration from SQL server to oracle (XML input) 4 25
SQL Database Restore 2008 R2 1 12
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In this article I will describe the Backup & Restore 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.
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.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

860 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