Showing posts with label size. Show all posts
Showing posts with label size. Show all posts

Wednesday, March 7, 2012

Schedule mail of DB sizes

Wonder if anyone can help me out here.

I'm trying to set up a job to run overnight that mails me the size of all the databases on SQL Server.

The way I'm getting the size of the db's is by running the following in SQL Query Analyzer...

EXEC sp_MSforeachdb @.command1="print '?' select cast(name as varchar(32)), round(size * 8 / 1.024,3) from ?..sysfiles"

Can anyone suggest a way that I can export the results of this to a text file that can then be mailed to me as part of a scheduled job.

Or can anyone suggest a better/easier way of doing this??

Thanks in advance. :)exec master..xp_sendmail @.recipients = 'recipients '
,@.message = 'message'
,@.query = select cast(name as varchar(128)) "LogicalFileName", (size * 8 / 1024) "Size in MB" from master..sysaltfiles'|||... I'm afraid I've not explained myself properly :(

SQL Mail is not set up on this server, so I need a file creating which I can then ftp to a location from which it can be mailed.

And I'm afraid it's not as simple as setting up SQL Mail, it has to be sent from a different box.

Any suggestions?

Thanks|||Look into isql or osql to execute the query and store results in a file|||Create an DTS package, two data sources, one as your SQL Serv db, one as "Output Text", then create a "transfer" task between the SQL serv and the text file. Edit the transfer task and set the source as "execute sql" and than select the "exec ... " string you are using now.

Then schedule your DTS package as you like it...|||no need for dts here .. simple osql or isql will do the task.|||Thanks Enigma.

Just looking into osql now and that seems to do the trick.

Saturday, February 25, 2012

schedule database growth for midnight.

Hi Everybody
My MSSQL 2000 8.00.818 database stores large amounts of binary data
and can be gigabytes in size. When the databases automatically grow,
they can take a while. This causes web pages which are waiting for
results from queries, to fail. Growth has been set to 1% to decrease
grow time. But I want to know if it is possible to set a schedule to
run at night, to make sure there is at least 10% free space. Can this
be done?
Why don't you just increase the database size by a LOT once, anticipating
long-term growth, instead of trying to predict reactionary growth?
"geist3" <jcockrell@.gmail.com> wrote in message
news:1184679861.142847.322970@.z28g2000prd.googlegr oups.com...
> Hi Everybody
> My MSSQL 2000 8.00.818 database stores large amounts of binary data
> and can be gigabytes in size. When the databases automatically grow,
> they can take a while. This causes web pages which are waiting for
> results from queries, to fail. Growth has been set to 1% to decrease
> grow time. But I want to know if it is possible to set a schedule to
> run at night, to make sure there is at least 10% free space. Can this
> be done?
>
|||I agree 100% with Aaron in that you should make it as large as you think it
needs to be for quite some time. In any case you can schedule growth by
using a standard SQL Agent job and ALTER DATABASE command. And don't set the
auto growth to a %. Use a fixed amount in MB or GB that you know can grow in
well under the timeout period. A percentage is useless as the size gets
larger each time the db grows and you no longer have control in how long
each one takes.
Andrew J. Kelly SQL MVP
"geist3" <jcockrell@.gmail.com> wrote in message
news:1184679861.142847.322970@.z28g2000prd.googlegr oups.com...
> Hi Everybody
> My MSSQL 2000 8.00.818 database stores large amounts of binary data
> and can be gigabytes in size. When the databases automatically grow,
> they can take a while. This causes web pages which are waiting for
> results from queries, to fail. Growth has been set to 1% to decrease
> grow time. But I want to know if it is possible to set a schedule to
> run at night, to make sure there is at least 10% free space. Can this
> be done?
>
|||Put me down for third on the "be proactive" side. Just make the darn
database HUGE once. This will also avoid disk file fragmentation and lead
to better performance in the long run, as well as providing free space so
that index maintenance can lay data back down in sequential order - again
improving performance.
TheSQLGuru
President
Indicium Resources, Inc.
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:ORghqCIyHHA.4276@.TK2MSFTNGP05.phx.gbl...
>I agree 100% with Aaron in that you should make it as large as you think it
>needs to be for quite some time. In any case you can schedule growth by
>using a standard SQL Agent job and ALTER DATABASE command. And don't set
>the auto growth to a %. Use a fixed amount in MB or GB that you know can
>grow in well under the timeout period. A percentage is useless as the size
>gets larger each time the db grows and you no longer have control in how
>long each one takes.
> --
> Andrew J. Kelly SQL MVP
> "geist3" <jcockrell@.gmail.com> wrote in message
> news:1184679861.142847.322970@.z28g2000prd.googlegr oups.com...
>

schedule database growth for midnight.

Hi Everybody
My MSSQL 2000 8.00.818 database stores large amounts of binary data
and can be gigabytes in size. When the databases automatically grow,
they can take a while. This causes web pages which are waiting for
results from queries, to fail. Growth has been set to 1% to decrease
grow time. But I want to know if it is possible to set a schedule to
run at night, to make sure there is at least 10% free space. Can this
be done?Why don't you just increase the database size by a LOT once, anticipating
long-term growth, instead of trying to predict reactionary growth?
"geist3" <jcockrell@.gmail.com> wrote in message
news:1184679861.142847.322970@.z28g2000prd.googlegroups.com...
> Hi Everybody
> My MSSQL 2000 8.00.818 database stores large amounts of binary data
> and can be gigabytes in size. When the databases automatically grow,
> they can take a while. This causes web pages which are waiting for
> results from queries, to fail. Growth has been set to 1% to decrease
> grow time. But I want to know if it is possible to set a schedule to
> run at night, to make sure there is at least 10% free space. Can this
> be done?
>|||I agree 100% with Aaron in that you should make it as large as you think it
needs to be for quite some time. In any case you can schedule growth by
using a standard SQL Agent job and ALTER DATABASE command. And don't set the
auto growth to a %. Use a fixed amount in MB or GB that you know can grow in
well under the timeout period. A percentage is useless as the size gets
larger each time the db grows and you no longer have control in how long
each one takes.
Andrew J. Kelly SQL MVP
"geist3" <jcockrell@.gmail.com> wrote in message
news:1184679861.142847.322970@.z28g2000prd.googlegroups.com...
> Hi Everybody
> My MSSQL 2000 8.00.818 database stores large amounts of binary data
> and can be gigabytes in size. When the databases automatically grow,
> they can take a while. This causes web pages which are waiting for
> results from queries, to fail. Growth has been set to 1% to decrease
> grow time. But I want to know if it is possible to set a schedule to
> run at night, to make sure there is at least 10% free space. Can this
> be done?
>|||Put me down for third on the "be proactive" side. Just make the darn
database HUGE once. This will also avoid disk file fragmentation and lead
to better performance in the long run, as well as providing free space so
that index maintenance can lay data back down in sequential order - again
improving performance.
TheSQLGuru
President
Indicium Resources, Inc.
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:ORghqCIyHHA.4276@.TK2MSFTNGP05.phx.gbl...
>I agree 100% with Aaron in that you should make it as large as you think it
>needs to be for quite some time. In any case you can schedule growth by
>using a standard SQL Agent job and ALTER DATABASE command. And don't set
>the auto growth to a %. Use a fixed amount in MB or GB that you know can
>grow in well under the timeout period. A percentage is useless as the size
>gets larger each time the db grows and you no longer have control in how
>long each one takes.
> --
> Andrew J. Kelly SQL MVP
> "geist3" <jcockrell@.gmail.com> wrote in message
> news:1184679861.142847.322970@.z28g2000prd.googlegroups.com...
>

schedule database growth for midnight.

Hi Everybody
My MSSQL 2000 8.00.818 database stores large amounts of binary data
and can be gigabytes in size. When the databases automatically grow,
they can take a while. This causes web pages which are waiting for
results from queries, to fail. Growth has been set to 1% to decrease
grow time. But I want to know if it is possible to set a schedule to
run at night, to make sure there is at least 10% free space. Can this
be done?Why don't you just increase the database size by a LOT once, anticipating
long-term growth, instead of trying to predict reactionary growth?
"geist3" <jcockrell@.gmail.com> wrote in message
news:1184679861.142847.322970@.z28g2000prd.googlegroups.com...
> Hi Everybody
> My MSSQL 2000 8.00.818 database stores large amounts of binary data
> and can be gigabytes in size. When the databases automatically grow,
> they can take a while. This causes web pages which are waiting for
> results from queries, to fail. Growth has been set to 1% to decrease
> grow time. But I want to know if it is possible to set a schedule to
> run at night, to make sure there is at least 10% free space. Can this
> be done?
>|||I agree 100% with Aaron in that you should make it as large as you think it
needs to be for quite some time. In any case you can schedule growth by
using a standard SQL Agent job and ALTER DATABASE command. And don't set the
auto growth to a %. Use a fixed amount in MB or GB that you know can grow in
well under the timeout period. A percentage is useless as the size gets
larger each time the db grows and you no longer have control in how long
each one takes.
--
Andrew J. Kelly SQL MVP
"geist3" <jcockrell@.gmail.com> wrote in message
news:1184679861.142847.322970@.z28g2000prd.googlegroups.com...
> Hi Everybody
> My MSSQL 2000 8.00.818 database stores large amounts of binary data
> and can be gigabytes in size. When the databases automatically grow,
> they can take a while. This causes web pages which are waiting for
> results from queries, to fail. Growth has been set to 1% to decrease
> grow time. But I want to know if it is possible to set a schedule to
> run at night, to make sure there is at least 10% free space. Can this
> be done?
>|||Put me down for third on the "be proactive" side. Just make the darn
database HUGE once. This will also avoid disk file fragmentation and lead
to better performance in the long run, as well as providing free space so
that index maintenance can lay data back down in sequential order - again
improving performance.
--
TheSQLGuru
President
Indicium Resources, Inc.
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:ORghqCIyHHA.4276@.TK2MSFTNGP05.phx.gbl...
>I agree 100% with Aaron in that you should make it as large as you think it
>needs to be for quite some time. In any case you can schedule growth by
>using a standard SQL Agent job and ALTER DATABASE command. And don't set
>the auto growth to a %. Use a fixed amount in MB or GB that you know can
>grow in well under the timeout period. A percentage is useless as the size
>gets larger each time the db grows and you no longer have control in how
>long each one takes.
> --
> Andrew J. Kelly SQL MVP
> "geist3" <jcockrell@.gmail.com> wrote in message
> news:1184679861.142847.322970@.z28g2000prd.googlegroups.com...
>> Hi Everybody
>> My MSSQL 2000 8.00.818 database stores large amounts of binary data
>> and can be gigabytes in size. When the databases automatically grow,
>> they can take a while. This causes web pages which are waiting for
>> results from queries, to fail. Growth has been set to 1% to decrease
>> grow time. But I want to know if it is possible to set a schedule to
>> run at night, to make sure there is at least 10% free space. Can this
>> be done?
>