Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

MDF vs BAK file sizes
Why are MDF and BAK file sizes a little bit different?
Why are the backups of LDF files A LOT different?

here is the script:

use master
go

declare @DBname varchar(255)
declare @MDFpath varchar(255)
declare @LDFpath varchar(255)

Declare DBNames cursor for
select name from sysdatabases

open dbnames

fetch next from dbnames
into @DBname

While @@fetch_status = 0
Begin

set @MDFpath = '\\backupserver\ext- hdd\library\SQL_DB'
 + @DBname + '.MDF.
bak'
set @LDFpath = '\\backupserver\ext- hdd\library\SQL_DB'
 + @DBname + '.LDF.
bak'

backup database @DBname
to disk = @MDFpath
with  noformat,init,skip,n
ame = @DBname;

backup log @DBname
to disk = @LDFpath;

fetch next from dbnames
into @DBname

end


close DBNames
deallocate DBNames

--
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Fo...server/200612/1


Report this thread to moderator Post Follow-up to this message
Old Post
fixitchris
12-14-06 12:12 AM


Re: MDF vs BAK file sizes
You are only including the actual data not the file in the backup. It
retains the meta data to recreate the file in total but it includes the
actual data. The data files may be much larger than the amount of data in
the files.

--
Andrew J. Kelly SQL MVP

"fixitchris" <u28526@uwe> wrote in message  news:6a9e8588834e1@u
we...
> Why are MDF and BAK file sizes a little bit different?
> Why are the backups of LDF files A LOT different?
>
> here is the script:
>
> use master
> go
>
> declare @DBname varchar(255)
> declare @MDFpath varchar(255)
> declare @LDFpath varchar(255)
>
> Declare DBNames cursor for
> select name from sysdatabases
>
> open dbnames
>
> fetch next from dbnames
> into @DBname
>
> While @@fetch_status = 0
> Begin
>
> set @MDFpath = '\\backupserver\ext- hdd\library\SQL_DB'
 + @DBname + '.MDF.
> bak'
> set @LDFpath = '\\backupserver\ext- hdd\library\SQL_DB'
 + @DBname + '.LDF.
> bak'
>
> backup database @DBname
> to disk = @MDFpath
> with  noformat,init,skip,n
ame = @DBname;
>
> backup log @DBname
> to disk = @LDFpath;
>
> fetch next from dbnames
> into @DBname
>
> end
>
>
> close DBNames
> deallocate DBNames
>
> --
> Message posted via webservertalk.com
> http://www.webservertalk.com/Uwe/Fo...server/200612/1
>



Report this thread to moderator Post Follow-up to this message
Old Post
Andrew J. Kelly
12-14-06 12:12 AM


Re: MDF vs BAK file sizes
Hello,

Primamararly we can not compare the BAK files with MDF and LDF. MDF and LDF
files are live and are used by the online database files; where as BAK files
are just the copies of MDF and LDF files which contains the utilized part of
the MDF and LDF file. Mostly to overcome the autogrowth we will give more
room to MDF and
LDF file. But in the BAK files only the data / objects utilized part of the
MDF / LDF will be taken.

Thanks
Hari

"fixitchris" <u28526@uwe> wrote in message  news:6a9e8588834e1@u
we...
> Why are MDF and BAK file sizes a little bit different?
> Why are the backups of LDF files A LOT different?
>
> here is the script:
>
> use master
> go
>
> declare @DBname varchar(255)
> declare @MDFpath varchar(255)
> declare @LDFpath varchar(255)
>
> Declare DBNames cursor for
> select name from sysdatabases
>
> open dbnames
>
> fetch next from dbnames
> into @DBname
>
> While @@fetch_status = 0
> Begin
>
> set @MDFpath = '\\backupserver\ext- hdd\library\SQL_DB'
 + @DBname + '.MDF.
> bak'
> set @LDFpath = '\\backupserver\ext- hdd\library\SQL_DB'
 + @DBname + '.LDF.
> bak'
>
> backup database @DBname
> to disk = @MDFpath
> with  noformat,init,skip,n
ame = @DBname;
>
> backup log @DBname
> to disk = @LDFpath;
>
> fetch next from dbnames
> into @DBname
>
> end
>
>
> close DBNames
> deallocate DBNames
>
> --
> Message posted via webservertalk.com
> http://www.webservertalk.com/Uwe/Fo...server/200612/1
>



Report this thread to moderator Post Follow-up to this message
Old Post
Hari Prasad
12-14-06 12:12 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 09:36 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006