patternMinor
Is there a less manual way of changing database properties for all databases in an instance?
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!
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 the entire column, past it into a new window and F5.
select 'ALTER DATABASE ' + quotename(name) + ' MODIFY FILE (...)'
from sys.databases
where databaseIsMisconfigured = 1Select 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 = 1Context
StackExchange Database Administrators Q#104489, answer score: 4
Revisions (0)
No revisions yet.