Wednesday, September 4, 2013

Using Partition Wizard – 2008, 2008 R2 and 2012 – Enterprise version...

Using Partition Wizard – 2008, 2008 R2 and 2012 – Enterprise version
 
Using Partition Wizards, Partition can be created as shown below
Partition cannot be created using Wizards in Standard Edition as shown below
Partition can be created using Wizards in Enterprise Edition as shown below
Select a table called DimDate from Adventures work DW and right click it, Menu appears as shown in the above Screenshot, Click on Storage to expand, Create Partition appears , Click on the Create Partition to proceed the next step 
Click on Next by selecting the Column "FullDateAlternateKey" and Click Next
 
 
Once the Partition Schema Name is defined, On Clicking next, Boundary screen appears where the Boundaries of each and every partitions needs to be created. Click on the Set Boundaries button to specify the boundaries as Yearly, Quarterly, Monthly, Daily etc...
Once the RANGE is set to Yearly, Click Okay and proceed to create File Group's  as shown below

Once the FileGroups are created, Add the Files into the respective File Group. Use the Code below
DECLARE @path NVARCHAR(256), @i TINYINT=1, @sql NVARCHAR(4000);
SELECT TOP 1 @path=LEFT(physical_name,LEN(physical_name)-4)  FROM sys.database_files
WHERE name='AdventureWorksDW2012_data'
--While Statement has i <= 7 which means its applicable only for 7 File Groups
WHILE @i <= 7
BEGIN
                SET @sql=N'ALTER DATABASE AdventureDW2012 ADD FILE (name=AdventureF' + CAST(@i AS NCHAR(1))+',
                                 filename=''' +  @path + N'F'+ CAST(@i AS NCHAR(1))+'.ndf' + ''',
                                 size=128MB, filegrowth=256MB) TO FILEGROUP AdventureFG'+CAST(@i AS NCHAR(1))
                RAISERROR (@sql,0,0)
                EXEC sp_executesql @sql;
                SET @i+=1;
END
GO
In Filegroup instead of selecting the Primary File Group, Select the File Groups which we had created earlier. Add one extra File Group. Click Next to proceed.

Run the Process immediately or click on the Finish button


So the Partitions are created successfully using Wizards.

Switch IN and Switch OUT Process will be provided in the next release of Post...

Regards
Daniel JDataware and Data Mining Architect... 

No comments: