Solved

Restoring Split DB files to one single file

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Some sers suddenly getting error popup msg 28 89
Linked Server Issue with SQL2012 3 26
SQL view 2 27
How to use three values with DATEDIFF 3 25
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…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
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.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

777 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