Friday 6 March 2020

MS SQL Server Create database command with auto growth



Use master
go

CREATE DATABASE [auto_growth]
 CONTAINMENT = NONE
 ON  PRIMARY
( NAME = N'auto_growth',
FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL14.SMRPLM\MSSQL\DATA\auto_growth.mdf' ,
SIZE = 3072KB ,      --<< initial size of data file 3mb     
FILEGROWTH = 1024KB )  --<< growth by 1mg

 LOG ON
( NAME = N'auto_log',
FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL14.SMRPLM\MSSQL\DATA\auto_growth_log.ldf' ,
SIZE = 1024KB ,    --<< initial size of log file 1mb
FILEGROWTH = 10%)  --<< growth by 10%
GO

DBCC LogInfo;

No comments:

Post a Comment