May 20, 2017 at 9:58 pm
Hi,
We have two drives for data files and I've been asked to go to each db, limit the max size of primary data file so that it stops using it and then starts using a new data file with unlimited max size.
Any script to restrict the db from using primary data file ? I can use the below to add secondary data file, but what should I see so that there is no maxsize?
ALTER DATABASE dbname
ADD FILE
(
NAME = dat2,
FILENAME = 'E:\DATA\t1dat3.ndf',
SIZE = 1024,
MAXSIZE = ??,
FILEGROWTH = 1024
)
Thanks,
May 21, 2017 at 5:20 am
If you don't set maxsize, then the size is unlimited. To restrict the size of the first file, you can set a max size on the existing file.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 24, 2017 at 3:36 pm
Expand Databases; right click thedatabase and select Properties .Go to Files & change theAutogrowth/Maxsize settings to Limited
You will be able to script this Action to new query window as well.
May 25, 2017 at 9:28 am
sqlguy80 - Saturday, May 20, 2017 9:58 PMHi,
We have two drives for data files and I've been asked to go to each db, limit the max size of primary data file so that it stops using it and then starts using a new data file with unlimited max size.Any script to restrict the db from using primary data file ? I can use the below to add secondary data file, but what should I see so that there is no maxsize?
ALTER DATABASE dbname
ADD FILE
(
NAME = dat2,
FILENAME = 'E:\DATA\t1dat3.ndf',
SIZE = 1024,
MAXSIZE = ??,
FILEGROWTH = 1024
)Thanks,
Be aware that there are certain objects that always hit the primary file of the primary filegroup, so it will need some growth. Put a new file into the same filegroup and the round robin algorithm will kick in.
It will spread data between all files in the filegroup.
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply