Database size and backups

I have deleted a large number of records from a database which accounted for much of the space being used as it was not needed at this time. When I take a backup of the database will the size of the db I then restore from this backup be reduced or should
I shrink the database first. Didn't want to have to perform a shrink operation if not necessary as I've seen posts that it affects performance.
Thanks
Robert

If you have deleted chunks of data and take the backup the size of the backup will be reduced. However if you want to release the unused space from the running database(with out backup and restore), you could do a shrink
Have a look at this link
http://dba.stackexchange.com/questions/28360/sql-server-database-size-didnt-decrease-after-deleting-large-number-of-rows
from
the above link
I've blogged about this where I admonished folks to "Don't
touch that shrink button!" but sometimes... Sometimes you need to. 
Satheesh
My Blog |
How to ask questions in technical forum

Similar Messages

  • Find Backup Size And Backup Window

    Hi Guys,
    Can any one give script to find backup size and backup window (total time taken to conduct backup).
    I am using Oracle 10gR2 on sun solaris 5.8
    Backup-RMAN Full backup every day.
    Regards

    Hi,
    backup size
    what do you mean by backup size .. ??
    User show all to list out the configuration details;
    Thanks
    Pavan Kumar N
    Message was edited by:
    Pavan Kumar

  • Get DataBase Size and Compare it

    Hello Folks
    I'm trying to get SQL 2008 R2 database size and compare it with this code:
    $DBSize = Invoke-SQLCmd -Query "sp_databases" -Username "user" -Password "pwd" `
    -ServerInstance "localhost" | where-object {$_.database_name -eq "ABC"} | select database_size
    If(($DBSize | Out-String) -ge "5242880"){
    # Some action #
    But that don't return nothing... Some help !?
    Jimcesse
    Principal: http://sysadmin-cr.com/
    Alterno: http://blogs.itpro.es/jimcesse

    Hi,
    I have no way to test this, but try adding -ExpandProperty to select.
    Also, I suggest getting rid of Out-String and using numbers instead.
    EDIT: Also, you may need to use a loop to check each returned size if the query is returning more than one database size.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Database size and Storage Metrics are mismatching

    Hi,
    When I look at the storage metrics for one of our SharePoint Web Application root site collection it shows the top sized site as 28.2% of parent and the size as 21178.5 MB. When we calculate the total size of the site collection from
    that it should 74994 MB. But when I see the size of the content database ( this is the only site collection in this content database) it shows 185661.5 MB as the size and 26852.5 MB as the space available. When I run the report (Disk Usage By Top Tables)
    on that database it brings the list with dbo.AllDocStreams table at the top (Data - 80333 MB) followed by dbo.AuditData (Data - 48305 MB) followed by dbo.AllUserData (Data - 8593 MB).
    3 years back we migrated this SharePoint Web Application from 2007 to 2010.
    I saw that the recycle bin has only 30 day worth data. 
    How can we reduce the size of the database according to what it shows in the storage metrics? Appreciate any help.
    Thanks.
    rani

    so... your database has:
    80gb in files (includes version history)
    50gb in audit data
    8.5gb of list data
    plus ~27gb of free space for growth between backups
    total of ~165gb (which is close enough to the 185661.5 that you listed)
    you need to split up the site collection, and then spread the site collections across multiple databases.
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

  • Mismatch between the Content Database size and the total of each site collection' storage used.

    Hi All,
    Environment:  SharePoint 2010 with SP2.
    Issue: One of the Content databases size in our farm shows 200 GB as used. There are 25 site collections in the DB and we counted
    the total storage used of all site collections in that Content DB and is not more than 40 GB. (used "enumsites" command and counted the each sitecollections storage used).
    What actions/troubleshooting were done?
    Ran one script which will find the actual size of site collection and how much space used in the disk. But didn’t find major difference in the report.
    Checked “Deleted from end user recycle bin “in all the site collections and no major storage is noticed.
    Planning to Detach the problematic Content DB and attach ,will check whether any major effect is there
    Why the Content DB shows 200 GB as used when the total storage used of all site collections is just 40 GB.
    Appreciate suggestions from any one.
    Best Regards,
    Pavan Kumar Sapara.
    s p kumar

    Hi,
    Thanks for your reply.
    As there is only 20 MB of unallocated space for the above said DB, SQL DB team informed that they cannot perform the DB shrink at this moment.
    So we are thinking to Offload all the site collections to other new DB and then will Drop the problematic database. In this way we can overcome the
    issue.
    Answer for your queries.
    Are the mismatched sizes causing an issue? Are you short on diskspace for DB storage or SQL backups?
    No, there is no issue with the mismatched sizes. We are not on short on disk space. We just worried why it occupies that much size(200 GB) when
    the total storage used of all site collections in that DB is 40 GB.
    Best Regards,
    Pavan Kumar Sapara.
    s p kumar

  • How to remove Database Files and Backup from ASM

    Hi All,
    Oracle Database 11.2.0.3
    OEL 5.7
    We have a host for restore purposes.
    We execute monthly or quarterly restore operations to verify that I am able to restore a subset of the data in the given amount of time or to other purposes.
    I have a automated script to Clone the Database, but to Clone Database we need remove the old database from ASM before start this operation. I want remove only Database files and keep the configuration (such as oratab/network/ocr and so on).
    Question: There is a easy way to remove these files without connect on ASM or by using DBCA?
    Appreciate any helps.

    user12028775 wrote:
    Hi All,
    Oracle Database 11.2.0.3
    OEL 5.7
    We have a host for restore purposes.
    We execute monthly or quarterly restore operations to verify that I am able to restore a subset of the data in the given amount of time or to other purposes.
    I have a automated script to Clone the Database, but to Clone Database we need remove the old database from ASM before start this operation. I want remove only Database files and keep the configuration (such as oratab/network/ocr and so on).
    Question: There is a easy way to remove these files without connect on ASM or by using DBCA?
    Yes... there is a easy way. Use command DROP DATABASE.
    Use the DROP DATABASE command to delete the target database and, if RMAN is connected to a recovery catalog, unregister it. RMAN removes all datafiles, online redo logs, and control files belonging to the target database. By default, RMAN prompts for confirmation.
    Put this command on your script before clone your database:
    RMAN> CONNECT TARGET SYS@test1
    RMAN> STARTUP FORCE MOUNT
    RMAN> SQL 'ALTER SYSTEM ENABLE RESTRICTED SESSION';
    RMAN> DROP DATABASE INCLUDING BACKUPS NOPROMPT;Regards,
    Levi Pereira

  • Disk size and backups

    Hello
    I wander what is required disk size on hana when migrating from e.g Oracle to Hana?
    E.g under oracle I have 1Tb database (and something more if I backup also at OS level)
    What will I have under Hana ? How much to backup?
    Thank you a lot
    Jan

    Dear Jan,
    The first thing we need to perform before migrating from AnyDb to HANA is memory sizing. SAP provides specific notes for memory sizing of different SAP Applications as mentioned bel     ow
    1793345 - Sizing for SAP Suite on HANA
    1637145 - SAP BW on HANA: Sizing SAP In-Memory Database
    1872170 - Suite on HANA memory sizing
    1736976 - Sizing Report for BW on HANA  
    The objective if the the above is to get the footprint of uncompressed DATA in AnyDB.
    That forms one of the parameter for sizing the HANA DB.
    Based on this sizing information one would use the suitable T-Shirt sized HANA Appliance from the hardware vendor. We then have to apply the
    Traditional the RAM should be atleast 2x(uncompressed_DB / Compression factor) and the Disk space would be at least 3-4xRAM for persisitance layer and 1xRAM for logs.
    The compression factor might be around 4-7 times depending on the type SAP application.
    Regards
    Arshad

  • Database Size versus Backup Size

    Is there a formuly I can use, to calculate the amount of backup space I will need ?
    We have a backup script, for backing up to disk - I copy and paste the main body of the script below. My would like to be able to estimate how much backup space we need, as the database grows.
    connect target
    run
    change archivelog all crosscheck;
    backup database
    include current controlfile
    format '/backup/rman/oraadmin/DBF_%d_%p_%s.RMan'
    filesperset 4
    tag = 'Full_DB_Backup';
    sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
    run
    # Backup Archived Logs
    backup archivelog all
    format '/backup/rman/oraadmin/ARC_%d_%p_%s.RMan'
    filesperset 16
    delete input;
    run
    #* Copy Current Control File to Backup Location
    copy current controlfile to '/backup/rman/oraadmin/ControlFile.Ctl';
    }

    use this script -
    column dummy noprint
    column pct_used format 999.9 heading "%|Used"
    column name format a16 heading "Tablespace Name"
    column Kbytes format 999,999,999 heading "KBytes"
    column used format 999,999,999 heading "Used"
    column free format 999,999,999 heading "Free"
    column largest format 999,999,999 heading "Largest"
    break on report
    compute sum of kbytes on report
    compute sum of free on report
    compute sum of used on report
    select nvl(b.tablespace_name,
    nvl(a.tablespace_name,'UNKOWN')) name,
    kbytes_alloc kbytes,
    kbytes_alloc-nvl(kbytes_free,0) used,
    nvl(kbytes_free,0) free,
    ((kbytes_alloc-nvl(kbytes_free,0))/
    kbytes_alloc)*100 pct_used,
    nvl(largest,0) largest
    from ( select sum(bytes)/1024 Kbytes_free,
    max(bytes)/1024 largest,
    tablespace_name
    from sys.dba_free_space
    group by tablespace_name ) a,
    ( select sum(bytes)/1024 Kbytes_alloc,
    tablespace_name
    from sys.dba_data_files
    group by tablespace_name
    UNION
    select sum(bytes)/1024 kbytes_alloc, tablespace_name
    from sys.dba_temp_files
    group by tablespace_name )b
    where a.tablespace_name (+) = b.tablespace_name;
    Message was edited by:
    jittu13

  • Difference in DB size and backup size

    Hi,
    I work on a backup/recovery product and in that I am into testing of SAP HANA backup/recovery using my third party backup tool.
    I have 4node(3+1) HANA setup with a total of 1.5TB RAM. I have created a DB of 1TB DB. I use this for testing backup performance of DB. As for backup persistent data is taken from the disk storage (shared in case of multi node setup) I want to know the size of DB on disks. When I use the following command to check the size of DB "select sum(allocated_page_size) from M_CONVERTER_STATISTICS" I get a size of around 950-970GB, which I feel is correct. But when I take backup of the same DB the backup size will be around 2TB. My log is in "OVERWRITE" state, so logs have some data as a duplicate copy is also ruled out.
    Request you to help me understand the reason for this difference in DB size on disk and in backup.
    Thanks,
    Prasanna

    My best guess is that MAX_SIZE is the total number of extents used for any purpose, whereas MAX_SORT_SIZE is the total number of extents ever used for sorting.
    Consider that temporary segments can be used for things other than sorting. Some examples are temporary LOB handling, backing storage for temporary tables, hashing, merging bitmaps, etc.
    Hope that helps,
    -Mark

  • How to know the database size

    can one tell how to find the database size?

    Depends what you mean by database size and how you want the output to look?
    Are you referring to the number of rows across all tables of a schema? The number of bytes used by the rows? The number of bytes used by the tablespaces? The number of bytes used by the datafiles? etc. etc. etc. So many options.
    Be more clear in your requirements please.

  • Using MaxL in batch script to get Essbase database size before proceeding

    I have a batch script which dynamically generates some MaxL before passing it to ESSMSH. I would like to insert a command at the beginning of the MaxL script, to get and assess the size of the database before proceeding. If the database is empty I would like the script to quit. This is to prevent the script from exporting data and overwriting the previous export file if the database is empty.
    The generated MaxL (modified) is currently as follows. What logic can I add to the MaxL script, to assess the database size and go to the "errorhandler" label if it is empty? Is this even possible?
    login %USER% identified by %PASS% on %SERVER%;
    iferror "errorhandler";
    /* log file */
    spool stdout on to '<directory>.log';
    iferror "errorhandler";
    /* error file */
    spool stderr on to '<directory>.err';
    iferror "errorhandler";
    /* export data */
    set timestamp on;
    execute calculation %APP%.%DB%.C_Export;
    iferror "errorhandler";
    /* reset database */
    alter database %APP%.%DB% reset data;
    iferror "errorhandler";
    /* import data */
    import database %APP%.%DB% data from server data_file "<filename>.txt" on error abort;
    iferror "errorhandler";
    /* calculate database */
    execute calculation default on %APP%.%DB%;
    iferror "errorhandler";
    /* error handler */
    spool off;
    define label "errorhandler";
    logout;
    exit;

    Hi Stuart,
    Yes I was aware of display database "app"."db"; however this will output a table rather than a specific value. And what logic can I then add to the MaxL script to assess the specific value of "Db Status" and go to the "errorhandler" label if it is empty?
    It would seem this needs to be done via a VBScript, to loop through the file rows to find the value before proceeding accordingly. But I was hoping there might be a way to do this within MaxL.

  • Calculate database size.

    Hi,
    Any one help me how to check the total database size and currently used size in oracle.
    Regards,
    S.Mugunthan.

    mugunthan wrote:
    Hi,
    Any one help me how to check the total database size and currently used size in oracle.
    Regards,
    S.Mugunthan.check the total database size and currently used size in oracle
    col "Database Size" format a20
    col "Free space" format a20
    col "Used space" format a20
    select     round(sum(used.bytes) / 1024 / 1024 / 1024 ) || ' GB' "Database Size"
    ,     round(sum(used.bytes) / 1024 / 1024 / 1024 ) -
         round(free.p / 1024 / 1024 / 1024) || ' GB' "Used space"
    ,     round(free.p / 1024 / 1024 / 1024) || ' GB' "Free space"
    from    (select     bytes
         from     v$datafile
         union     all
         select     bytes
         from      v$tempfile
         union      all
         select      bytes
         from      v$log) used
    ,     (select sum(bytes) as p
         from dba_free_space) free
    group by free.p
    /

  • Mailbox database size before & after backup

    Hi there
    i recently made a similar thread and someone told me that i should do it here so here is my issue :
    i've been assigned to do a specific report related to exchange and its backup 
    so what we want is a report that would give us the global size of all our mailbox databases before and after the backup ( even the size of the logs before and after)
    (example : we have a mailbox database X: , we need to go inside the data folder, and retrieve the size of the .edb
    then do the same thing with the logs, go inside the logs folder, and retrieve the logs size )
    i was wondering if anyone ever managed to pull a script that does similar things, given the fact that i ve never worked with powershell and my knowledge is kinda limited in that area
    Thanks

    Hi Amassuo,
    for finished scripts that do things, check out the
    gallery. If you want to learn powershell (I might be biased, but I highly recommend it), check out the
    learning center.
    Regarding your specific issue, you can check the free space on a specific disk by running this powershell command:
    Get-WmiObject win32_logicaldisk -Filter "DeviceID = 'C:'" | Select -ExpandProperty FreeSpace
    Comparing before/after will get you the space differential (adapt drive letter in filter as needed).
    Cheers and good luck with your script,
    Fred
    There's no place like 127.0.0.1

  • Database file sometimes gets to zero size and zero file flags

    I have a problem that on my system sometimes single database file gets to a state where it has zero size and zero file flags ( as if set chmod 0 file ).
    My database runs 24/7 and there are multiple agents running at the same time. My database files are backed up and removed from time to time to protect stored data. So I guess that this error could come up when two agents get to backup or recover the database file at the same time. Though, it is hard to find if it is caused by this problem, so I'd like to ask if there is anyone who stumbled on same problem - where one database ends up in state of 0 flags and 0 size.

    Hello, anyone has any tip about this issue?

  • Database backup file size is too small compare to actual database size

    Hi All,
    I know that backup file size can be smaller than actual DB size (i.e., MDF size + LDF size). But in my case i am observing huge difference. 
    My Database size is 16 GB out of which 10 GB consumed by MDF and 6 GB consumed by LDF. But when i took the backup, the backup file size is only 1 GB!!!!!
    I am skeptical about whether i am doing anything wrong. Please advice me.

    Olaf is right it must be compressed backup:
    To check if the backup file is compressed or not
    RESTORE HEADERONLY FROM DISK = 'Path to backup file';
    Looks for column labelled "Compressed". 1 = compressed, 0 = not compressed.
    If you are skeptical about backup file you can verfiy whether a SQL database backup can be read and restored:
    RESTORE VERIFYONLY FROM DISK = 'Path to backup file'
    If the backup is valid, the SQL Server Database Engine returns:
    The backup set on file 1 is valid

Maybe you are looking for