/*============================================================================
  File:     GrowthSetup.sql

  Summary:  Create some frequent growths

  SQL Server Versions: 2005 onwards
------------------------------------------------------------------------------
  Written by Paul S. Randal, SQLskills.com

  (c) 2011, SQLskills.com. All rights reserved.

  For more scripts and sample code, check out 
    http://www.SQLskills.com

  You may alter this code for your own *non-commercial* purposes. You may
  republish altered code as long as you include this copyright and give due
  credit, but you must obtain prior permission before blogging this code.
  
  THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF 
  ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED 
  TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  PARTICULAR PURPOSE.
============================================================================*/

-- Let's create some page splits to watch

USE [master];
GO

IF DATABASEPROPERTYEX (N'Growths', N'Version') > 0
BEGIN
	ALTER DATABASE [Growths] SET SINGLE_USER
		WITH ROLLBACK IMMEDIATE;
	DROP DATABASE [Growths];
END
GO

CREATE DATABASE [Growths] ON PRIMARY (
    NAME = N'Growths_data',
    FILENAME = N'E:\SQLData\Growths_data.mdf')
LOG ON (
    NAME = N'Growths_log',
    FILENAME = N'E:\SQLData\Growths_log.ldf',
    SIZE = 5MB,
    FILEGROWTH = 1MB),(
    NAME = N'Growths_log2',
    FILENAME = N'E:\SQLData\Growths_log2.ldf',
    SIZE = 5MB,
    FILEGROWTH = 1MB);
GO

ALTER DATABASE [Growths] SET RECOVERY SIMPLE;
GO

USE [Growths];
GO

CREATE TABLE [GrowthsTable] (
	[c1] UNIQUEIDENTIFIER DEFAULT NEWID () ROWGUIDCOL,
	[c2] DATETIME DEFAULT GETDATE (),
	[c3] CHAR (400) DEFAULT 'a');
CREATE CLUSTERED INDEX [GrowthsTable_CL] ON
	[GrowthsTable] ([c1]);
GO

-- Now start 200 threads....

-- And look at the stats, waiting tasks, latches

-- LOG_MANAGER, FGCB_ADD_REMOVE, 



