Database Creation Tips

Bandi
Posted by Bandi under Sql Server category on | Points: 40 | Views : 214
Any DBA has to come across database creation. Usually, the GUI helps us to create database with default/required configurations.

What if anyone needs the CREATE DATABASE script for creating database for Production/QA environment. DBA should have good practices to create a database.

Simply, we can create database by having below code,
CREATE DATABASE DatabaseName
GO


But if you want to specify the Max and Min DB size at the time of creation, then you should be aware of the default/min db size and the AUTOGROWTH to ON...

CREATE DATABASE [DatabaseName]
GO
ALTER DATABASE DatabaseName MODIFY FILE
( NAME = N'DatabaseName' , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
GO
ALTER DATABASE DatabaseName MODIFY FILE
( NAME = N'DatabaseName_log' , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO



NOTE: Here, we do not the physical path of Database files...

Comments or Responses

Login to post response