Temp DB

  • Hi All,

    How To check initial size of a DB, when we created it ?

    for ex: If we create a Database with initial size as 1GB datafile and 256MB log file, now it grows to 10GB data file. Is there any mechanism to find out the initial size of that datafile when we actually created it ?

    Thank You.

    Regards,
    Raghavender Chavva

  • Is that with a user db or just TEMPDB?

    If you only mean TEMDB, the initial size as shown by the Files tab in db properties represents the inital startup value (ie what it will reset to when sql restarts).

    HTH 🙂

    Adam Zacks-------------------------------------------Be Nice, Or Leave

  • If you are relying on default sizes (not altering them) when you create the databases, all you have to do is look at the size of the Model db files. All databases will be using, at a minimum, the same file sizes that Model is currently set at. TempDB starts at that size also.

    But if you alter the sizes when you create your user dbs, then that won't help. And if you haven't restarted SQL Server in a long time, then TempDB has probably grown a lot since those original days.

    What will you do with this info? That might assist us with finding a better answer.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • If you are only requesting this info for tempdb, then the initial size will reset every time you restart SQL Server. Can we get more info on what you are trying to accomplish?

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • A new User databases size will be the same as the Model database. To get details of the files, their locations and sizes on any database, including tempdb, you could run:

    sp_helpfile

    Jim

    Jim Murphy
    http://www.sqlwatchmen.com
    @SQLMurph

  • I got this question in a interview.

    So we cannot get the size of database when we created it if we provide other than model database size ?

    Thank You.

    Regards,
    Raghavender Chavva

  • Tempdb doesn't just use model.

    have a look at:

    select *

    from sys.master_files

    where database_id = 2

    :w00t:

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • ALZDBA (3/27/2011)


    Tempdb doesn't just use model.

    :w00t:

    Ummmm.... not quite right. From the first sentence you find when you lookup "Model Database" in BOL...

    The model database is used as the template for [font="Arial Black"]all [/font]databases created on an instance of SQL Server. [font="Arial Black"]Because tempdb is created every time SQL Server is started, the model database must always exist on a SQL Server system.[/font]

    --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.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (3/27/2011)


    ALZDBA (3/27/2011)


    Tempdb doesn't just use model.

    :w00t:

    Ummmm.... not quite right. From the first sentence you find when you lookup "Model Database" in BOL...

    The model database is used as the template for [font="Arial Black"]all [/font]databases created on an instance of SQL Server. [font="Arial Black"]Because tempdb is created every time SQL Server is started, the model database must always exist on a SQL Server system.[/font]

    Hence the composition of my reply.

    the keyword ( is the positioned ) "just".

    I didn't say it doesn't use model db, I said it doesn't just use model.

    Which is not the same as "it just doesn't use model".

    /*

    Startup size of tempdb

    */

    select *

    from sys.master_files

    where database_id = 2

    order by file_id ;

    /*

    Current size of tempdb

    */

    select *

    from tempdb.sys.database_files

    order by file_id ;

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Also, even though tempdb is recreated each time SQL Server starts, unlike a brand new user database, the new tempdb file settings, including it's size is taken from the existing tempdb configuration, while many other tempdb settings are taken from Model.

    Jim

    Jim Murphy
    http://www.sqlwatchmen.com
    @SQLMurph

  • ALZDBA (3/27/2011)


    I didn't say it doesn't use model db, I said it doesn't just use model.

    Which is not the same as "it just doesn't use model".

    Ah... my bad. Sorry, Johan.

    --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.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (3/27/2011)


    ALZDBA (3/27/2011)


    I didn't say it doesn't use model db, I said it doesn't just use model.

    Which is not the same as "it just doesn't use model".

    Ah... my bad. Sorry, Johan.

    No problem, Jeff.

    I must learn to write it out using unambiguous sentences.

    As you know, that may not be that obvious at the time you're writing it down.:unsure:

    And my translation to English may just be inappropriate with regards to what I'm trying to explain.

    e.g. things said in Dutch in a certain way, maybe aren't constructed in English in the way I translated them.

    It is good you pointed to the bol ref.

    By doing so, OP got extra info with regards to his quest and we worked away the ambiguity.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • [Jim].[dba].[Murphy] (3/27/2011)


    Also, even though tempdb is recreated each time SQL Server starts, unlike a brand new user database, the new tempdb file settings, including it's size is taken from the existing tempdb configuration, while many other tempdb settings are taken from Model.

    Not that I'm doubting you, but I've never heard of this. Could you point me to the exact reference? (A link or BOL search phrase)

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Brandie Tarvin (3/28/2011)


    [Jim].[dba].[Murphy] (3/27/2011)


    Also, even though tempdb is recreated each time SQL Server starts, unlike a brand new user database, the new tempdb file settings, including it's size is taken from the existing tempdb configuration, while many other tempdb settings are taken from Model.

    Not that I'm doubting you, but I've never heard of this. Could you point me to the exact reference? (A link or BOL search phrase)

    A quick proof of concept is the multiple ndf file setup that we do in tempdb for certain environments. If that was lost, and it simply copied model, it wouldn't persist between reboots. It rebuilds to the original growth settings you give it.

    I can't seem to find any good articles or BOL items on it though offhand.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • In between, this is other question on TempDB only:

    If we add multiple datafiles to tempdb database we need to keep all datafiles of same size.

    Can any body tell me what is the exact reason for this ?

    Is this implies only for TempDB or other user databases also ?

    Thank You.

    Regards,
    Raghavender Chavva

Viewing 15 posts - 1 through 15 (of 18 total)

You must be logged in to reply to this topic. Login to reply