Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Resize data file manually to prevent downtime

By acampoma,

This script will resize the data file of a passed in database name and filename by 10%. It can run in 3 modes.Resize, INFO, HELP. RESIZE is passed into parameter @Mode when we know the database name and file we wish to resize. INFO is passed in when we only know the database name and we wish to find out the data file names. HELP is passed in when we have no idea what to do. I run this in my job agent every night to prevent SQL from doing it automatically every time the data file fills up. The reason for this is that this automatic resize can happen at any time (including peak hours) and it could slow down performance.
Instructions and parameter definitions are in the stored proc comments.
Keep in mind this uses custom errors for error trapping. You should create these errors before doing this:.Just run the following SQL. EXEC sp_addmessage 55001, 16, 'Validate - Source: [''%s''] Operation: [''%s''] Description: [''%s'']' , NULL, true, REPLACE

Total article views: 619 | Views in the last 30 days: 3
Related Articles

Resize TLog when restoring database...

Resize TLog to restore database...


Connecting to Database ERROR

Database Error


resize header depending on the context

resize header depending on the content


Database Access Error

Database Access Error


Database Integrity Error

Database Integrity Error


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones