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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

closed as off-topic by Paul White Oct 4 '15 at 11:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – Paul White
If this question can be reworded to fit the rules in the help center, please edit the question.

2  
unlimited size with 1MB growth increments? Make sure you keep the number of VLFs in check. – Remus Rusanu Mar 21 '13 at 8:50
up vote 5 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

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