|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Yesterday @ 11:49 AM
Points: 7,
Visits: 224
|
|
HI,
I want to estimate the transaction log size before taking backup not the used space
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 7:18 AM
Points: 33,112,
Visits: 27,038
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Yesterday @ 11:49 AM
Points: 7,
Visits: 224
|
|
| i need the size of the backup file it will create
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:07 PM
Points: 6,826,
Visits: 11,951
|
|
CREATE TABLE #LOGSPACE ( DB SYSNAME, LogSize FLOAT, SpaceUsed FLOAT, Stat BIT );
INSERT INTO #LOGSPACE ( DB, LogSize, SpaceUsed, Stat ) EXEC ( 'DBCC SQLPERF (LOGSPACE)' );
SELECT DB, LogSize, SpaceUsed, LogSize * (SpaceUsed / 100.0) AS SpaceUsedMB, -- approximate log backup size Stat FROM #LOGSPACE; The SpaceUsedMB could be low if you ever switch the DB into the Bulk Logged Recovery Model and perform any minimally logged operations.
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 10:11 AM
Points: 5,242,
Visits: 11,262
|
|
opc.three (9/25/2012) The SpaceUsedMB could be low if you ever switch the DB into the Bulk Logged Recovery Model and perform any minimally logged operations. Yes, but bear in mind that log backups could potentially be quite large
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs"
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:07 PM
Points: 6,826,
Visits: 11,951
|
|
Perry Whittle (9/25/2012)
opc.three (9/25/2012) The SpaceUsedMB could be low if you ever switch the DB into the Bulk Logged Recovery Model and perform any minimally logged operations.Yes, but bear in mind that log backups could potentially be quite large You're misunderstanding what I said. The number from the query (SpaceUsedMB) could be lower than the actual backup size if bulk logged was used, i.e. log space used would only count the extents, not the actual data which would come from the data file.
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 7:18 AM
Points: 33,112,
Visits: 27,038
|
|
What I'd like to know is.... why does someone need to know what size the backup is? SQL Server figures that out and if there's not enough space for the backup, it'll throw an error before the backup actually starts.
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:07 PM
Points: 6,826,
Visits: 11,951
|
|
Jeff Moden (9/25/2012) What I'd like to know is.... why does someone need to know what size the backup is? SQL Server figures that out and if there's not enough space for the backup, it'll throw an error before the backup actually starts. Capacity planning?
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 7:18 AM
Points: 33,112,
Visits: 27,038
|
|
opc.three (9/25/2012)
Jeff Moden (9/25/2012) What I'd like to know is.... why does someone need to know what size the backup is? SQL Server figures that out and if there's not enough space for the backup, it'll throw an error before the backup actually starts.Capacity planning?
Maybe but I still don't see why even that would be a problem. If the database exists well enough to have a log file to take a guess at, then just do a log backup and see how big it is. It's something that should be occuring anyway.
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 10:11 AM
Points: 5,242,
Visits: 11,262
|
|
opc.three (9/25/2012)
CREATE TABLE #LOGSPACE ( DB SYSNAME, LogSize FLOAT, SpaceUsed FLOAT, Stat BIT );
INSERT INTO #LOGSPACE ( DB, LogSize, SpaceUsed, Stat ) EXEC ( 'DBCC SQLPERF (LOGSPACE)' );
SELECT DB, LogSize, SpaceUsed, LogSize * (SpaceUsed / 100.0) AS SpaceUsedMB, -- approximate log backup size Stat FROM #LOGSPACE; Also that's a rather convoluted way of getting space used, I prefer
Use yourdb GO Select name, size / 128, fileproperty(name, 'spaceused') / 128 From sys.database_files Where type = 1 -- tlog files only
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs"
|
|
|
|