Clean database

  • I moved data from one server to another server, this is the same db and they look identical,but db is much bigger then another. How can I check what is in db more than another?I think one db contains much more white space. Please help.Thank you

  • Not sure what you mean by "white space" in this context.

    If you want to compare the data, RedGate has a tool for that. So does ApexSQL. They both work.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • I know what 'white space' is, but how you can think it applies in this context I have no idea :crazy:

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

  • Krasavita (11/2/2009)


    I moved data from one server to another server, this is the same db and they look identical,but db is much bigger then another. How can I check what is in db more than another?I think one db contains much more white space. Please help.Thank you

    Just outta curiosity, when you say you "moved" the data. How did you accomplish this?

    Did you restore a backup, detattch-reattach, or script it all out.

    If you scripted it and ran all of the data migration as insert statements, and the db was in Full recovery, your transaction log file could have grown very large taking up much more space than it normally would need to. Or index rebuilds could have blown out your transaction log or a variety of other things might have happened.

    Can you also describe how you know one is "much bigger" than the other? Are you looking just a file sizes or something else?

    -Luke.

    edit: fixed some typos...

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • There is a script that someone ran, delete records from table and then insert records

  • yup, that would do it, if it was in full recovery mode. Everything would have been logged which would have made your transaction log huge. That's the difference...

    -Luke.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • What should I do? how can I clean it?

  • Still have not figured out what you are talking about with regard to white spce in the database. That question was asked earlier.

  • Krasavita (11/2/2009)


    What should I do? how can I clean it?

    You need to Shrink the Database.

    Use DBCC SHRINKDATABASE or the Individual Data Files, using DBCC SHRINKFILE

    Rather Use the Enterprise Manager

    Right Click on the Database -> All Tasks -> Shrink Database

    In the Dialog Box, Under the Shrink File Section click Files and you are presented the Data and Log Files to shrink.


    Bru Medishetty

    Blog -- LearnSQLWithBru

    Join on Facebook Page Facebook.comLearnSQLWithBru

    Twitter -- BruMedishetty

  • Bru Medishetty (11/2/2009)


    Krasavita (11/2/2009)


    What should I do? how can I clean it?

    You need to Shrink the Database.

    Use DBCC SHRINKDATABASE or the Individual Data Files, using DBCC SHRINKFILE

    Rather Use the Enterprise Manager

    Right Click on the Database -> All Tasks -> Shrink Database

    In the Dialog Box, Under the Shrink File Section click Files and you are presented the Data and Log Files to shrink.

    I do not recommend you do this! Using these commands can result in high fragmentation.

    http://www.sqlskills.com/BLOGS/PAUL/post/Why-you-should-not-shrink-your-data-files.aspx

  • Why does every question even indirectly touching about space, result in someone saying you need to shrink the database.

    coming back to the question. if the database is bigger, is it the log file or the mdf file that is bigger. if it is the log, then what is the recovery model for the database. understand the issues before you rush anything.

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

  • Clive Strong (11/3/2009)


    Bru Medishetty (11/2/2009)


    Krasavita (11/2/2009)


    What should I do? how can I clean it?

    You need to Shrink the Database.

    Use DBCC SHRINKDATABASE or the Individual Data Files, using DBCC SHRINKFILE

    Rather Use the Enterprise Manager

    Right Click on the Database -> All Tasks -> Shrink Database

    In the Dialog Box, Under the Shrink File Section click Files and you are presented the Data and Log Files to shrink.

    I do not recommend you do this! Using these commands can result in high fragmentation.

    http://www.sqlskills.com/BLOGS/PAUL/post/Why-you-should-not-shrink-your-data-files.aspx

    I am completely aware of the impact of frequent Shrinking of Database Files, but here I was suggesting it since the Point of the User is to get back the Space used by the Database.

    From what has been posted by the user, it was clear that they Someone ran a script which copied data and deleted and copied data and so on....

    There is no mention of any information if the user wants to move the Data again in the near future, so assuming that this is one time process and the user wanted to see that the Database Size to be equal (or near to equal) to the original one, I suggested to shrink.

    If the User does not shrink this Database and also doesn't need to move any data further, the Database is just using the Disk space which would be used by another Database on that disk, if the Shrinking is done.

    We cannot assume, IF's and But and so on, so it is up to the User to decide what's their next move and decide to carry on. And that is with reference to the user's post

    What should I do? how can I clean it?


    Bru Medishetty

    Blog -- LearnSQLWithBru

    Join on Facebook Page Facebook.comLearnSQLWithBru

    Twitter -- BruMedishetty

  • However, it would also help if the OP would elaborate as to what the problem or issue is. Several questions have been asked seeking clarification which has not been forth coming.

  • That's true Lynn, I have not seen any clarification from the Poster what they are seeking and we sit in the middle to decide what's best for them without knowing more details.


    Bru Medishetty

    Blog -- LearnSQLWithBru

    Join on Facebook Page Facebook.comLearnSQLWithBru

    Twitter -- BruMedishetty

  • Whic actually means we aren't in a position to know what is best for them. We have asked for clarification and now we need to sit back and wait.

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

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