We are currently in the process of designing a Consolidated System (data for multiple organizations stored in one database server) using SQL Server 2005. One of the design goal is to refresh individual company data from Production to "User Acceptance Server" without affecting other companies.
So, we thought of implementing this via Partitioning by Org. We need the "Proof of concept" that this can be done with a simple example. Since our DBA's are also new to SQL 2005, we are working together in achieving the goal. Ok, here is what we are trying to achieve:
1. Create a Database (Test1) with two file Groups (FileGroup1, FileGroup2) with two files in each file group.
2. Create two tables on this database, one on each FileGroup
Table 1 on FileGroup1, Table 2 on FileGroup2.
3. Populate data on these tables.
4. Create an exact copy of this database with the above architecture and call it Test2.
5. Populate Test2, with a different set of data.
6. Backup FileGroup2 on Test2 and restore it to Test1 database.
What we did:
1. I did the Full Database Backup of Test2 via SQL Management Studio. Also the log file with:I did the Full Database Backup of Test2 via SQL Management Studio. Also the log file using :
BACKUP LOG PGM TO DISK='D:\Test2_Log.bak' WITH NORECOVERY
2. Restore the database filegroup using:
RESTORE DATABASE Test1
FILEGROUP = 'FileGroup2'
FROM DISK ='D:\Test2.bak' WITH
MOVE 'FileName2_A' TO 'G:\Data\File2_A.ndf',
MOVE 'FileName2_B' TO 'G:\Data\File2_B.ndf'
3. . RESTORE LOG PGM
FROM DISK = 'D:\Test2_Log.bak'
WITH RECOVERY
After restoring the backup filegroup to Test1 database, I'm not able to query the table that resides in the filegroup that was restored. Error returned is:
Msg 8653, Level 16, State 1, Line 2
The query processor is unable to produce a plan for the table or view 'Junk2' because the table resides in a filegroup which is not online.
We know, we are missing some pieces while creating the backup or restoring that is causing this problem. If somebody can point it out, or provide us a "Working Example"...
Thanks for your help.