Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Is it possible to alter the LOG file through script when creating a database? I need to set the file size, growth etc, but NOT specify where the DB is to be created. e.g.

CREATE DATABASE [NewDatabase]
GO
ALTER DATABASE [NewDatabase] 
    MODIFY FILE
    (SIZE = 10MB,
    MAXSIZE = UNLIMITED,
    FILEGROWTH = 1MB);
GO
**ALTER DATABASE [NewDatabase]
    MODIFY LOG
    (MAXSIZE = 200MB, 
    FILEGROWTH = 1MB 
    );
GO**
share|improve this question
1  
unlimited size with 1MB growth increments? Make sure you keep the number of VLFs in check. –  Remus Rusanu Mar 21 '13 at 8:50
    
Thanks, that was just a quick-typed example ;) –  BlueChippy Mar 21 '13 at 10:38
    
Why the down-vote? –  BlueChippy Apr 9 '13 at 4:29
add comment

1 Answer

up vote 3 down vote accepted

You already wrote it, you just need to specify logical file name of the log file.

ALTER DATABASE [NewDatabase]
MODIFY FILE
(NAME = 'NewDatabase_log',
SIZE = 200MB,
FILEGROWTH = 1MB)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.