HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Is there a less manual way of changing database properties for all databases in an instance?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
databasesallpropertiesmanualwaydatabaseinstancelessforchanging

Problem

I've recently audited a SharePoint server and found configurations that are against best practice.

I'm hoping there is better and quicker way than right-clicking and changing these settings manually on over 100 database.

For instance, all the databases are set to autogrow by 10MB and the log files are set to autogrow by 1%. I'd like for these to be a set number and not a percentage.

Any resources or recommendations would be greatly appreciated!

Solution

I often generate T-SQL like this:

select 'ALTER DATABASE ' + quotename(name) + ' MODIFY FILE (...)'
from sys.databases
where databaseIsMisconfigured = 1


Select the entire column, past it into a new window and F5.

Code Snippets

select 'ALTER DATABASE ' + quotename(name) + ' MODIFY FILE (...)'
from sys.databases
where databaseIsMisconfigured = 1

Context

StackExchange Database Administrators Q#104489, answer score: 4

Revisions (0)

No revisions yet.