How can i shrink the db(530GB) in chunks?

How can i shrink the db(530GB) in to chunks?.
Thanks,
Ron.

Since i am new.Do you have any scripts or this?
I am trying bleow scripts,but its not showing any result:
Use Test
--Tuesday, July 26, 2011Shrink database in chunks
declare @DBFileName sysname
declare @TargetFreeMB int
declare @ShrinkIncrementMB int
-- Set Name of Database file to shrink
set @DBFileName = 'I:\Program Files\Microsoft SQL Server\MSSQL.12\MSSQL\Data\Test_data.mdf'
-- Set Desired file free space in MB after shrink
set @TargetFreeMB = 5000 --need to change the size
-- Set Increment to shrink file by in MB
set @ShrinkIncrementMB = 1000
-- Show Size, Space Used, Unused Space, and Name of all database files
select
[FileSizeMB] =
convert(numeric(10,2),round(a.size/128.,2)),
[UsedSpaceMB] =
convert(numeric(10,2),round(fileproperty( a.name,'SpaceUsed')/128.,2)) ,
[UnusedSpaceMB] =
convert(numeric(10,2),round((a.size-fileproperty( a.name,'SpaceUsed'))/128.,2)) ,
[DBFileName] = a.name
from
sysfiles a
declare @sql varchar(8000)
declare @SizeMB int
declare @UsedMB int
-- Get current file size in MB
select @SizeMB = size/128. from sysfiles where name = @DBFileName
--Print '@sizemb = '+ @sizemb
-- Get current space used in MB
select @UsedMB = fileproperty( @DBFileName,'SpaceUsed')/128.
--print '@usedMB = ' + @usedmb
select [StartFileSize] = @SizeMB, [StartUsedSpace] = @UsedMB, [TargetFreeMB] = @TargetFreeMB,[Total] =@UsedMB+@TargetFreeMB ,[DBFileName] = @DBFileName
-- Loop until file at desired size
while @SizeMB > @UsedMB+@TargetFreeMB+@ShrinkIncrementMB
begin
set @sql =
'dbcc shrinkfile ( '+@DBFileName+', '+
convert(varchar(20),@SizeMB-@ShrinkIncrementMB)+' ) '
print 'Start ' + @sql
print 'at '+convert(varchar(30),getdate(),121)
exec ( @sql )
print 'Done ' + @sql
print 'at '+convert(varchar(30),getdate(),121)
-- Get current file size in MB
select @SizeMB = size/128. from sysfiles where name = @DBFileName
-- Get current space used in MB
select @UsedMB = fileproperty( @DBFileName,'SpaceUsed')/128.
select [FileSize] = @SizeMB, [UsedSpace] = @UsedMB, [DBFileName] = @DBFileName
end
select [EndFileSize] = @SizeMB, [EndUsedSpace] = @UsedMB, [DBFileName] = @DBFileName
-- Show Size, Space Used, Unused Space, and Name of all database files
select
[FileSizeMB] =
convert(numeric(10,2),round(a.size/128.,2)),
[UsedSpaceMB] =
convert(numeric(10,2),round(fileproperty( a.name,'SpaceUsed')/128.,2)) ,
[UnusedSpaceMB] =
convert(numeric(10,2),round((a.size-fileproperty( a.name,'SpaceUsed'))/128.,2)) ,
[DBFileName] = a.name
from
sysfiles a

Similar Messages

  • How can you shrink the size of an upright picture to make it smaller without losing any of the detail in it??? At the moment, if I view them on my laptop, landscape photos fill the screen, but portrait photos only show the middle part.

    How can you shrink the size of an upright picture to make it smaller without losing any of the detail in it (in Slideshow)??? At the moment, if I view them on my Mac Laptop, landscape photos fill the screen, but portrait photos only show the middle part, so I loose the top and bottom of the picture.  Have tried cropping, but that means I lose top and bottom part of the picture, so that is not the answer!!

    Homestly haven't a clue what's going on there. 
    Try trash the com.apple.iPhoto.plist file from the HD/Users/ Your Name / library / preferences folder.
    (On 10.7: Hold the option (or alt) key while clicking on the Go menu in Finder to access the User Library)
    (Remember you'll need to reset your User options afterwards. These include minor settings like the window colour and so on. Note: If you've moved your library you'll need to point iPhoto at it again.)
    What's the plist file?
    For new users: Every application on your Mac has an accompanying plist file. It records certain User choices. For instance, in your favourite Word Processor it remembers your choice of Default Font, on your Web Browser is remembers things like your choice of Home Page. It even recalls what windows you had open last if your app allows you to pick up from where you left off last. The iPhoto plist file remembers things like the location of the Library, your choice of background colour, whether you are running a Referenced or Managed Library, what preferences you have for autosplitting events and so on. Trashing the plist file forces the app to generate a new one on the next launch, and this restores things to the Factory Defaults. Hence, if you've changed any of these things you'll need to reset them. If you haven't, then no bother. Trashing the plist file is Mac troubleshooting 101.

  • How can I shrink the track icon size?

    Why is the the first track icon in the orchestral template ginormous while the rest are small and how can I shrink it?

    Hi
    In that template, the AutoZoom function is on so the selected track will be larger than the others.
    Turn it off using the (default) button in the ToolBar, or use the (default) key command Control-Z
    CCT

  • How can I shrink the spacing between the icons in the bookmarks toolbar?

    Hello everyone!
    I would like to open up some space in my bookmarks toolbar (also on the navigation toolbar if I can) by reducing the spacing between the icons. Is there any way to do this without the need of some third party program? If not, which one should I download?
    Curious thing is that a few days ago I did not have this problem at all, all my bookmarks were visible in the toolbar regularly, neat and tight. Now there is that boring guillemet sitting there at the corner...
    And this is the line where I thank you quite a bit for your interest towards my problem. So thank you very much:)
    With respect
    Arial

    You're welcome
    You can also remove the text labels with code in userChrome.css and if necessary adjust the margins as you like.
    Add code to the userChrome.css file below the default @namespace line.
    *http://kb.mozillazine.org/userChrome.css
    The customization files userChrome.css (interface) and userContent.css (websites) are located in the chrome folder in the user profile folder.
    *http://kb.mozillazine.org/Editing_configuration
    <pre><nowiki>#personal-bookmarks .bookmark-item > .toolbarbutton-text {
    display:none !important;
    #personal-bookmarks .bookmark-item > .toolbarbutton-icon {
    margin:0px !important;
    padding:0px !important;
    </nowiki></pre>
    *https://developer.mozilla.org/en/CSS/margin
    *https://developer.mozilla.org/en/CSS/padding

  • How can I shrink the picture of the folders that are on my desktop?

    I need to resize/shrink the picture of the folders on my desktop.

    Right or Control Click anywhere on the desktop.  Select Show View Options....

  • How can I shrink the Site Identity Icon? It takes all the space, no URL visible!

    I must confess, I heve lots of addons installed, therefore my toolbar is fully loaded. the adress bar is shrunk to a minimum, but there would be absolutely no need for the Page Security Info to be THAT space consuming!!? Who needs the full name of the certificate to be visible all the time! Wouldn´t it be enough to just show it by hovering over it?
    Is there any possibility to shrink this annoying text to the size of an icon??
    Thanx 4 every hint!
    Firefox 5.0.1, Windows XP

    Here is a variation that shows the label on hover.<br />
    <br />
    <pre><nowiki>@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
    #identity-icon-labels { display:none!important; }
    #identity-box:hover #identity-icon-labels { display:block!important; }
    </nowiki></pre>

  • I was trying to print a coupon page from a website but the print command page was too big and the print button was below the edge of my screen. How can I shrink the page to get to the button?

    I tried ctrl - -- / tried right click to properties/ the arrows show on the top and sides but don't reduce the size of the window.

    See:
    *http://kb.mozillazine.org/Corrupt_localstore.rdf

  • How can i make the size of my document that i created smaller so that i can email it easier

    The 5 page document I created and need to send is 1.7MB.  I need it to be 250KB to send using the format requested.  All the info needs to be sent.  How can i shrink the data by such a large amount to enable the document to send?  I am on Windows 7 and using AcrobatXI

    Depending on the content you may be asking for a lot. From within Acrobat the two options to do this are PDF Optimize or Reduce File Size. The location of these options vary among menus based on version. In some versions they are under the File>Save As options (AA XI). The PDF Optimize also has an audit that helps you determine the source of the bloat. If you used WORD to create the PDF, a first step in a smaller file size is to print to the Adobe PDF printer to avoid all the tagging and other markup. Of course, that is a compromise if you had wanted the bookmarks and all.

  • My LR previews data file has just gone over 50GB, how can I shrink it as I really need the space on my laptop?

    My LR previews data file has just gone over 50GB, how can I shrink it as I really need the space on my laptop?

    Or if you don't want to delete all of it, you can just discard 1:1 previews using Library->Previews menu - that may or may not buy you the space you need.
    If you do opt for deleting the whole thing, here is an idea to keep it from going back to 50G: change the size/quality of standard previews and/or the policy for auto-removing 1:1 previews (Lr Preferences -> Catalog Settings -> File Handling).

  • How can I change the page size of a pdf so i can view it on my iphone more clearly?

    How can I change the page size of a pdf so i can view it on my iphone more clearly?

    I think there may be more to this question than you say.
    If your PDF page is say, 8 x 12 inches, and you found a way to scale it to 25%, changing it to 2 x 3 inch, shrinking everything on the page to quarter size - wouldn't it look exactly the same on the iPhone? It's just going to be the same as zooming.
    Or were you hoping for something more like in Word, where changing the page size keeps everything the same size and spreads it over more pages? That isn't something you can do.

  • When I'm using a browser (like Safari) in Yosemite, how can I shrink it and share my desktop with other applications?

    I have an iMac, and after installing Yosemite (OS 10.10), all my browsers (like Safari) no longer share the screen with other applications, like Word or even Calculator.  How can I shrink Safari (or any browser) and share my desktop with other applications?

    When I'm using any browser (at the moment, it's Safari), I am unable to resize the window.  The browser BECOMES my entire desktop.  And if I open another application, suddenly the browser vanishes to the right, so I can only see the other app.  AND my dock disappears into a solid black space below the screen, which I can penetrate with my curser (after dragging the curser back and forth above and below the black space until the dock eventually reappears.  But if I select any app in the browser to open, then Safari vanishes instantly to the right of the screen.  I've tried to resize Safari (and Firefox and Chrome) by moving the curser to the bottom right of the browser, but that old standby doesn't seem to work anymore.  The browser takes up all of the screen, except for a small portion of the top, where my curser can reveal Safari's old menus, and the bottom of the screen, which is entirely black until I can locate my dock by dunking the curser up and down in the black ooze.
    I really want the old convenience of my Mac, where several programs can open side by side, but Yosemite seems to have precluded that possibility.  What can I do?

  • When I'm using a browser (like Safari), how can I shrink it and share my desktop with other applications?

    I have an iMac, and after installing Yosemite (OS 10.10), all my browsers (like Safari) no longer share the screen with other applications, like Word or even Calculator.  How can I shrink Safari (or any browser) and share my desktop with other applications?

    Yes, mission control threw everything across the screen (which is way beyond anything I could figure out), but the real answer I needed came from Apple Tech Support, which I finally called, and I learned about the two arrows in the top righthand corner, when I held the cursor there, which turned blue and resized and released the browser from total domination of the screen.  Those two, opposite-pointing arrows allowed me to shrink the browser and let other applications be seen on the desktop.  But thank you for extending a helpful tip, which I can use another time.

  • How can I reclam the space

    oracle 10g, on the production one of the schema (40GB), i took export and restored one of the test env. and i see the datafie size 15GB.
    question how can I reclam the space on production whitout any outage. can i able to do something online to reclame the space?
    Thanks

    What about Segment Space Management on your Tablespace of that table? ASSM(auto)/MSSM(manual)
    MSSM:
    - ALTER TABLE ... MOVE
    alter table .. move - this makes your index unusable. You have to "alter index ... rebuild" after that
    - ALTER INDEX ... REBUID
    ASSM:
    - ALTER TABLE ... SHRINK SPACE
    You can shrink space online ... But You have "alter table ... enable row movement"
    "alter table ... enable row movement" can make stored procedure depend on this table status be INVALID.
    You can shrink space online, Ifr you have heavy DML, that can make your table blocking lock.
    STEP SHOULD BE =>
    ALTER TABLE ... ENABLE ROW MOVEMENT;
    ALTER TABLE ... SHRINK SPACE COMPACT; -- THIS NOT AFFECT DML, BUT NOT REDUCR HWM
    ALTER TABLE ... SHRINK SPACE; -- THIS HELP REDUCE HWM
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/schema.htm#ADMIN10161
    - ALTER INDEX ... SHRINK SPACE
    If your data is LOB, you have to "alter table ... move lob"
    http://it.toolbox.com/blogs/surachart/move-lobsegment-to-different-tablespace-30530
    Good Luck

  • How can i manipulate the links on a tab?

    Hi,
    i have multiple tabs on my page and want one tab to directly link to a differnet page. how can i manipulate the link on the tab?
    thanks,
    Ralf Schmitt

    Hello,
    Zooming doesn't change tile sizes for you on the new tab page? Just to be clear about the zooming feature:
    * To make things bigger, press '''Ctrl''' and '''&#43''' at the same time.
    * To make things smaller, press '''Ctrl''' and '''-''' at the same time.
    * To reset the size back to normal, press '''Ctrl''' and '''0''' at the same time.
    You can also see '''jscher2000''''s Chosen Solution here: https://support.mozilla.org/en-US/questions/1025414
    It requires the [https://addons.mozilla.org/firefox/addon/stylish/ Stylish] add-on but will automatically shrink the tiles on the page so that more appear:
    * https://userstyles.org/styles/106326/shrink-new-tab-thumbnails
    Unless you have an extension installed that changes the new tab page, changing the zoom level for the page will change the size of the tiles and show more. The limit is set to 3 rows by 5 columns by default (if you zoom out the page/shrink the tile sizes sufficiently, the number of tiles are limited to that setting). If you want to change those values:
    # In the [[Location bar autocomplete|Location bar]], type '''about:config''' and press '''Enter'''. The about:config "''This might void your warranty!''" warning page may appear.
    # Click '''I'll be careful, I promise!''' to continue to the about:config page.
    # Search for and modify the preferences (by double clicking the row, or right clicking the row and selecting '''Modify''')
    #* '''browser.newtabpage.columns'''
    #* '''browser.newtabpage.rows'''

  • I am having macbook air recently my iphotos did not open and was showing report apple and reopen but i came to know that by pressing alt and iphotos i open an new photo library and stored the pics but now how can i get the pics which i had in the earlier

    i am having macbook air recently my iphotos did not open and was showing report apple and reopen but i came to know that by pressing alt and iphotos i open an new photo library and stored the pics but now how can i get the pics which i had in the earlier photo please help me to recover my photos

    Well I'll guess you're using iPhoto 11:
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In early versions of Library Manager it's the File -> Rebuild command. In later versions it's under the Library menu.)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  
    Regards
    TD

Maybe you are looking for