MaxSize
This parameter specifies the maximum size to which the file
can grow. You can specify sizes in megabytes—the default
value—or kilobytes.
If you do not specify a size, the file grows until the disk is
full.
FileGrowth
This parameter specifies the growth increment of the file.
The FILEGROWTH setting for a file cannot exceed the
MAXSIZE setting. A value of 0 indicates no growth.
The value can be specified in megabytes—the default—in
kilobytes, or as a percentage (%).
The default value if FILEGROWTH is not specified is 10
percent, and the minimum value is 64 KB (one extent).
The specified size is rounded to the nearest 64 KB. in three
ways: in megabytes, in kilobytes, or as a percentage. The
percentage only applies to file growth, not maximum size.
Retrieving Database Information
Northwind Database
sys...
sys... ...
...
sys...
sys... Orders
Orders
sysusers OrdHistYear2
OrdHistYear2
sysusers Customers
Customers
sysobjects
sysobjects Products OrdHistYear1
OrdHistYear1
Products
OrdHist1.ndf
OrdHist1.ndf
Northwind.mdf
Northwind.mdf OrdHist2.ndf
OrdHist2.ndf Northwind.Idf
Northwind.Idf
ALTER
ALTER DATABASE
DATABASE Sample
Sample
ADD
ADD FILE
FILE
(( NAME
NAME == SampleData2,
SampleData2,
FILENAME
FILENAME ='c:\Program
='c:\Program Files\..\..\
Files\..\..\
Data\Sample2.ndf',
Data\Sample2.ndf',
SIZE
SIZE == 15MB,
15MB,
MAXSIZE
MAXSIZE == 20MB
20MB ))
GO
GO
Renaming a Database
DROP
DROP DATABASE
DATABASE Northwind,
Northwind, pubs
pubs
Database
Tables, Extent
Indexes 1 2 3 5 6 7 8 (8 contiguous
8-KB pages)
Data 4 Page (8 KB)
SQL Server stores, reads, and writes data in 8-KB
blocks of contiguous disk space called Pages.
All pages are stored in extents. An extent is eight
contiguous pages, or 64 KB.
This means that a database can store 128 pages per
megabyte.
1 MB = 1024 KiloBytes
1024 KB / 8 KB (Page) = 128 Pages per MB
1024 KB / 64 Kb (Extent) = 16 Extents per MB
Pages
Types of Extents
SQL Server uses two types of extents:
Mixed Extents
Extents that contain pages from two or more objects are
called Mixed Extents.
Every table starts as a mixed extent. Database
use mixed extents primarily for pages that
track space and contain small objects.
Mixed
Extent
Extents
Uniform Extents
Extents that have all eight pages allocated to a single object
are called uniform extents. They are used when tables or
indexes need more than 64 KB of space.
Uniform
Extents
Check Your Understanding.
Q.1. What are the types of files to store
a Database in SQL Server. ?
Q.2. The Primary data file has a _______ extension. ?
Q.3. The Secondary data file has a __________ extension.
Q.4. The Transaction log file has a ________ extension.
Q.5. What is the Command to create a Database in
SQL Server. ?
Q.6. What are the the Parameters used to create
a Database in SQL Server. ?
Q.7. What is the difference between Name and
Filename. ?
Q.8. What is the difference between Size and
Maxsize. ?
Q.9. What is the SQL Statement to delete a
database. ?
Q.10. What is FileGroup and what is its Purpose. ?
Q.11. What is the Command to rename
a database?
Q.12. What is the difference between Mixed and
Uniform extents .
Winners don’t do
different things
they do things
differently.
Thank You.