Hi Ibrahim,
Regarding your second question about space increase per week, it's a good idea to keep records about space used weekly in a table and then, query this table to get the info. that you want.
Step 1:
=======
You can begin with a table like the following:
create table db_spc_usg
(database_name varchar(40) not null,
record_date datetime not null,
total_size int not null,
used_size int not null
)
Step 2:
=======
You need to create the following procedure and run it weekly to get info. about space used in all databases and store it in "db_spc_usg" table:
create procedure get_space as
declare @current_date datetime
select @current_date = getdate()
insert into db_spc_usg
(
database_name,
scan_date,
total_size,
used_size
)
select
db_name(dbid),
@current_date,
sum(size)/512 ,
(sum(size) - sum(unreservedpgs))/512
from master..sysusages
group by dbid
Step 3:
=======
You have two options:
Simplest way is to select directly from db_spc_usg and check the used space vs. time:
Ex. select * from db_spc_usg where database_name = your_db
OR,
You can build another stored procedure to calculate the weekly increase.(Tell me if you need help writing this procedure.)
Note: This method gets you the total size and used space including data and log segments, it can be enhanced to get detailed segment allocation.