Tuesday, March 20, 2012

calculate the size of a database and backup it.

Hi all,
please show me the way how to calculate the size of a database in SQL 2000. Whith this size we have already calculated, how much space need to make a backup file for this database.
thanks.Easiest way is through Enterprise manager - via the View - TaskPad options. This will show you size of data file(s) and log file(s).

Backup size will be the sum of these sizes approx.

You can also get it from the sysfiles table.|||Originally posted by thanhtung2003
Hi all,
please show me the way how to calculate the size of a database in SQL 2000. Whith this size we have already calculated, how much space need to make a backup file for this database.

thanks.
If you want to find out programaticaly use sp_spaceused|||Originally posted by smasanam
If you want to find out programaticaly use sp_spaceused

Hi,
please, tell me how to use it ?|||Please consult the Microsoft Transact-SQL Reference, specifically 'System Stored Procedures'|||create table #DbSize (name nvarchar(30),
rows char(11),
reserved varchar(18),
data varchar(18),
index_size varchar(18),
unused varchar(18))

exec <your database name>..sp_msforeachtable @.command1 = 'insert into #DbSize exec dbs..sp_spaceused [?]'

select sum(cast(replace(Reserved, 'KB','')as int)) From #DbSize

drop table #DbSize

No comments:

Post a Comment