Shrink database to only up to its current initial size

In SQL server every database has a property Initial Size (MB) which can be seen in properties of database in SSMS. By default it will be 3 MB for mdf and 1 MB for
ldf file.
So now if create a new database then it will be set to default size(i.e 3 MB for mdf and 1 mb for ldf file). But after creating the database I change the initial size to some other value say For mdf 10 MB and ldf 5 MB.(In real-time some database administrator
may want to change initial after creating database)
But now if shrink the database it will shrink beyond the initial size I have set after creation(consider that no data is there in database otherwise it will shrink to its actual content size). It will shrink till the initial size it had during creation of database(i.e
3mb for mdf and 1 mb for ldf). I was expecting to shrink till the initial size which I have set(i.e 10 mb for mdf and 5mb for ldf). Can it be possible to do? If possible then how?
In some article i saw like dbcc SHRINKFILE can be used to shrink beyond initial size and dbcc SHRINKDATABASE cannot shrink beyond initial size. But I want to shrink only till the initial size to which I have set.
Note: I know that shrink is bad and should not be done.But I want to know how it can be done? If sql server considers only the initial size set during creation of database then what is the use of setting the initial size after creating database?

http://technet.microsoft.com/en-us/library/ms190488.aspx
The database cannot be made smaller than the minimum size of the database. The minimum size is the size specified when the database is
originally created, or the last size explicitly set by using a file size changing operation such as DBCC SHRINKFILE or ALTER DATABASE. For example, if a database is originally created with a size of 10 MB in size and grows to 100 MB, the smallest the database
can be reduced to is 10 MB, even if all the data in the database has been deleted.
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence
I understood what you have mentioned above. As you said minimum size is the size specified during database creation. But is there any way to change the initial size of database so that during shrink it will come only up to that value. i know that during shrinkfile
i can specify size. But i want to know whether we can change that initial size.

Similar Messages

  • Print only the external movie with its current applied settings?

    Hi,
    I'm making a flash application for a paint company to test various paints on different objects. But I got a little problem.
    Which is here...
    Here is my code....
    /* Print Button Function Here.....*/
    print_btn.addEventListener(MouseEvent.CLICK,printPage);
    function printPage(evt:MouseEvent) {
        var printJob:PrintJob = new PrintJob();
        if (printJob.start()) {
            if (uiLoader.source.width>printJob.pageWidth) {
                uiLoader.source.width=printJob.pageWidth;
                uiLoader.source.scaleY=uiLoader.source.scaleX;
            printJob.addPage(Sprite(uiLoader.source));  
            printJob.send();
    Actually I have a movie clip which contains a Print Button and a uiloader.
    uiloader loads differnt external movies.
    I applied a code to Print button to print those movies.
    This code is working good but problem is, it print the both (main_movie & external_movie) with its actual colors not with the current applied colors.
    I want to print only External movie with its current color settings (applied by user) not actual default colors.
    So can any one tell me how can i do this?
    Thank for help....

    use:
    print_btn.addEventListener(MouseEvent.CLICK,printPage);
    function printPage(evt:MouseEvent) {
        var printJob:PrintJob = new PrintJob();
        if (printJob.start()) {
            if (uiLoader.width>printJob.pageWidth) {
                uiLoader.width=printJob.pageWidth;
                uiLoader.scaleY=uiLoader.scaleX;
            printJob.addPage(uiLoader);  
            printJob.send();

  • No way to publish a workflow, I get this error: System.InvalidOperationException: Operation failed with error Microsoft.Workflow.Client.ScopeInactiveException: Scope ... is not in an active state. Its current state is 'Unregistering'

    Hi,
    I'm using Project Server 2013 and I'm not able to publish a workflow in SharePoint Designer 2013, I get this error:
    System.InvalidOperationException: Operation failed with error Microsoft.Workflow.Client.ScopeInactiveException: Scope '/SharePoint/default/d7feb9ea-ccb2-4ec3-8f89-2a45b6cf3777' is not in an active state. Its current
    state is 'Unregistering'. HTTP headers received from the server - ActivityId: c47ef567-8c54-4ae0-9a1a-1e4fb51320d8. NodeId: TestServer. Scope: /SharePoint/default/d7feb9ea-ccb2-4ec3-8f89-2a45b6cf3777. Client ActivityId : c6e5979c-20f8-e042-1f9d-2cb2a25d7f9e.
    ---> System.Net.WebExceptio
    The thing is that I transferred the databases from a Prod.Env. to the Test Env. and from that moment on the Test Env. stopped working (only workflows), then I
    was thinking that maybe the workflow is not working in the Test Environment because when I transferred the databases from Prod Env to Test Env I didn’t transfer the databases related to workflow, I only transferred:
    WSS_Content
    PWA_ServiceDB
    But I didn’t transfer:
    SBGatewayDatabase
    SBManagementDB
    SBMessageContainer01
    WFInstanceManagementDB
    WFManagementDB
    WFResourceManagementDB
    I didn’t transfer them because, before, when I transferred DB’s in version 2010, these DB’s were not needed, as the workflows were done using another method.
    So, I tried to create a new workflow in the Test Env. but there is no way, I always get that error.
    I've tried to Register again the workflow, and the result looks ok, but it doesn't solve the problem:
    Register-SPWorkflowService
    –SPSite "http://whatever/PWA"
    –WorkflowHostUri "http://TestServer:12291"
    –AllowOAuthHttp -Force
    Do you know how to solve this issue or have an idea to give me some light?
    Thank you for your help and regards,
    José Espases

    Looks like you haven't defined the WF scope or the site where you are trying to deploy the workflow to isn't included in the scope
    Check this article
    http://fangdahai.blogspot.in/2013/04/on-premise-windows-workflow-server.html
    Thanks | epmXperts | http://epmxperts.wordpress.com

  • Make CA database read-only?

    Is it possible to make Firefox not accept any new Certificate Authorities without user interaction?
    Long story short, I have having a problem where Firefox is adding a CA to it's database that is hosing things up. The actual problem is with the cert that is being offered to me, and I am working with that system owner to fix the cert, but in the mean time I would like to have Firefox not ever load the CA into it's database. This new CA is added without the user being prompted at all. Simply visiting a specific website causes this new CA to be added to the list (but again, not trusted, just added to the list).
    By default when it is loaded the new cert has no permissions so it is not trusted, but the problem is the fact that the CA that is added is a duplicate name with another known good CA in my list and it causes things to go wacky when there are two with the same name (different signatures, different issuer, the only thing the same is the nickname).
    I know this isn't a problem with Firefox directly. In 99.9999% of cases when it adds an additional CA to the list it doesn't cause a problem at all because it is not trusted and it won't inherently allow the secure connection. But since fixing the real problem with the owner of the website is going to take a long time (weeks/months) I would like to put a band-aid on the symptom so that I can cut my maintenance of this topic down greatly.
    I am running Red Hat Enterprise Linux 5.9 with Firefox 10.0.12 (RHEL distributed Firefox).
    I could go into extreme detail to explain what is causing my problem, but the short question I have is "Is there a way to make the CA database read-only"?
    I have tried editing the permissions of cert8.db in ~/.mozilla/firefox/*.default/ to only be readonly (0400) vice read-write (0600) currently. However this causes Firefox to have kittens when I try to use anything that reads the CA list so I had to change it back.
    I have a hacky script to remove the CA using certutil, but since certutil uses the 'nickname' of the cert to decide which one to delete, and both the good cert and the bad cert have the same nickname I get worried I'll blow away the good one and not the bad one. So far it has consistently matched the bad cert, but I don't have enough confidence that it will do that every time to push it out to my users. If I could use certutil -D with something more specific than nickname (fingerprint, signature value, etc) I would be OK with that as well.
    I know there are options to restrict user changes to things like proxies and the such, is there a similar way to do it with CAs? about:config doesn't appear show anything that looks like it would do it.
    Can I have it prompt me when it tries to add a CA to the database and allow me to say yes/no?
    I am OK if the change is something that requires manual intervention if we do decide to add another CA to the list. Currently I am having to repair this problem multiple times a day and new CAs don't come all that often.
    Unfortunately, I can't simply upgrade to the latest Firefox as software restrictions are in place. I'm open to any ideas you may have.

    Seems unlikely two unrelated CA or sub-CA certs would have the exact same issuer name. Was the name too generic? If they actually related and I assume created by your organization perhaps you could simply add the "Integration CA 456" certificate to your root store -- assuming you trust it.
    Firefox validates certificate chains by looking up issuers, and in case of duplicates by default it grabs the one with the most recent "Not Before" date. There is a newer algorithm under development that won't stop at the first match but will continue to trying intermediate combinations until it finds a match or runs out of options. If you'd like to try it you need to add the boolean preference "security.use_libpkix_verification" and set it's value to true. This pref will not appear in about:config by default, but you can right-click in about:config to add it.

  • Using mapviewer with database installation only ?

    using mapviewer with database installation only ?
    i have installed oracle database 11g on windows
    the enterprise manager already relies on the ocj4 ('http://orcl:1158/em')
    if i open 'http://orcl:1158' i get the start page for the appllication server - by clicking on 'manage applications' i come to the enterprise manager start page (i thinked, i can uplaod some ear application file, sinve oc4j is present for the em)
    its possible to install the mapviewer.ear with this database installation only (since the oc4j is present for the em) - or i have to install the oc4j too?
    thx

    You should be able to deploy MapViewer in this OC4J. Take a look on chapter 1 of the MapViewer User's Guide for information about deploying MapViewer in an Oracle application server.
    Joao

  • How to shrink database for the Oracle

    Hi,
    As you know, in the Sql server database there is a "shrink database" for the shrink the database space, but how to do that for the Oracle9i?
    Any comments would be appreciated.
    Thanks a lot

    You will have to resize ur datafiles to shrink ur db. Here are the steps
    1) select file_name,file_id,bytes from dba_data_files;
    This will give u the current size of datafiles.
    2) select file_id,sum(bytes) from dba_free_space group by file_id;
    This will give u the free space in the datafiles. If the file_id is not listed in this query that means the file is fully occupied/used.
    (used space = bytes col from query 1 - sum(bytes) col from query 2)
    3) alter database datafile file_id resize ### ;
    Enter the value you wanna resize based upon ur req. You cannot shrink the datafiles below the used space.
    Regards,
    http://askyogesh.com

  • Shrink database is not active in SQL SERVER Enterpriser manager

    Dear guru
    Shrink database is not active in SQL SERVER Enterpriser manager what to do
    Rupesh
    SAP BASIS Consultant

    Hi,
    >Thank you very much for not supporting i have solved the problem by reading some other documents
    That's exactly what I wanted you to do : With a little personal work, you can actually learn to do your own work ! "Don't give fish to hungry people. Teach them how to go fishing !"
    Regards,
    Olivier

  • WebPartPagesWebService.GetWebPartProperties gives The file is not available. Either the file does not exist or it cannot be edited from its current location.

    Hi,
        I am trying to get all web parts from our sharepoint site by calling web service method GetWebPartProperties of WebPartsPages service. The method works fine for the root page (Home Page) but for pages in sub site i get this in the xml
    node, Outer XML - <WebParts xmlns="http://microsoft.com/sharepoint/webpartpages"><!--The file is not available. Either the file does not exist or it cannot be edited from its current location.--></WebParts>. I am struck here.
    Please help me understand why i am getting this?
    Regards,
    Kalim

    Hi,
    We can do as follows:
    1. Mark sure the page URL is correct.
    2. Check whether current user has permission to access  the page.
    3. Use SPServices to get web part properties.
    http://spservices.codeplex.com/wikipage?title=WebPartPages
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Only activities of the current calendar year are shown in plannend act.

    Hello Techies,
    We are using the 2007 UI and I have the following problem. Only activities of the current calendar year are shown in plannend activities and interaction history.
    SAP probably made a query only showing a set of data (current year) for performance reasons. I would like to change this in the last 6 months. My users can not see there activities of last week since it only shows 2009.
    How can this be changed?
    Kind regards.
    Frederik

    Frederik
    You can control this by maintaining the view:
    CRMV_ACC_1O_CUST
    Or in the IMG:
    CRM->Master Data->Business partner->Specify Display Options for Business Transactions
    Take care,
    Stephen

  • I am using FCPX 10.1.3. and want to duplicate my project, and its complete resources, to a different hard drive.  When I click "duplicate", it automatically duplicates the project in its current hard drive.  How do duplicate to a different hard drive

    I am using FCPX 10.1.3. with Yosemite, and want to duplicate my project and its complete resources to a different hard drive.  When I click "duplicate", it automatically duplicates the project in its current hard drive, unlike the previous FCPX that gave you options. How do duplicate to a different hard drive?

    Since projects are now stored in events and events are stored in libraries, you need to create a new l;bray on that different drive or open an existing library on that drive. Then duplicate your project and move it to the new library. It will copy the media. Then use the Consolidate Project File command to round up any external assets; there may or may not be any.
    Russ

  • What's wrong with my MacBook, it only works when its plugged in to the wall charger

    my MacBook only works when its plugged in with the wall charger. What's wrong with it? it the problem fixable ?

    Marina -
    What Kappy said, or maybe your Battery charging cable is faulty, or something's happened to the input slot.
    I'd take it to Apple and have them troubleshoot it for you. 

  • All of sudden, I can't launch iTunes as I get a popup saying "iTunes requires Quicktime 7.5.5 or later". I only have 7.4 currently and the apple site doesn't show anywhere to download Quicktime upgrade. Software Update detects no reqd updates. Help pls??

    all of sudden, I can't launch iTunes as I get a popup saying "iTunes requires Quicktime 7.5.5 or later". I only have 7.4 currently and the apple site doesn't show anywhere to download Quicktime upgrade. Software Update detects no reqd updates. Help pls??

    Here's a link to the QuickTime for Leopard 7.7 installer:
    http://support.apple.com/kb/DL761

  • How to make database read only?

    Hi
    All,
    I have restored my production database to development. I want to make these database available only for reading purpose means nobody can make any changes to that database only thing is that they can see the data. Is there any feature available to achieve the same?
    Thanks,
    Vishal

    Hi,
    >>I am guessing: Use triggers not to allow insert, update or delete on that table.
    The easy trick is create a check constraint with disable validate state ... but you are not safe in case a drop statement is issued ...
    TEST@XE> create table t1 (id number);
    Table created.
    TEST@XE> alter table t1 add constraint chk_readonly check (1=1) disable validate;
    Table altered.
    TEST@XE> insert into t1 values (1);
    insert into t1 values (1)
    ERROR at line 1:
    ORA-25128: No insert/update/delete on table with constraint (TEST.CHK_READONLY) disabled and validated
    TEST@XE> truncate table t1;
    truncate table t1
    ERROR at line 1:
    ORA-25128: No insert/update/delete on table with constraint (TEST.CHK_READONLY) disabled and validated
    TEST@XE> drop table t1;
    Table dropped.Cheers
    Legatti

  • I want to get increment only amount and its percentage of increment from HR

    Dear Sir,
    I want to get increment only amount and its percentage of increment can you plz help me how to get it
    please find below mentioned query.
    Regards
    select
    papf.employee_number as employee_number,
    papf.last_name as last_name,
    papf.middle_names as middle_name,
    papf.first_name as first_name,
    papf.known_as as preferred_name,
    ppt.user_person_type as employment_type,
    ppp.change_date as change_effective_date,
    cur.currency_code as currency,
    ppp.proposed_salary_n * per_saladmin_utility.get_annualization_factor(paaf.assignment_id , to_date(sysdate)) as current_salary_annual,ppp.proposed_salary_n,
    per_saladmin_utility.get_previous_salary(paaf.assignment_id,ppp.PAY_PROPOSAL_ID) PREVIOUS_SAL,
    ppp.proposal_reason as sal_proposla_resaon,
    ppp.attribute2 as performance,
    ppp.attribute3 as gandac,
    ppp.attribute4 as NINEBOXPOSITION,
    ppp.attribute1 as RPR
    from
    per_all_people_f papf,
    per_all_assignments_f paaf,
    per_pay_proposals ppp,
    per_pay_bases ppb ,
    pay_input_values_f piv,
    pay_element_types_f pet,
    fnd_currencies_tl cur,
    per_person_type_usages_f pptu,
    per_person_types ppt
    where 1=1
    and papf.employee_number in (127)
    --and ppp.change_date >= ’01-Jan-2005?
    and papf.current_employee_flag = 'Y'
    and sysdate between papf.effective_start_date and papf.effective_end_date
    and papf.person_id = paaf.person_id
    and sysdate between paaf.effective_start_date and paaf.effective_end_date
    and paaf.assignment_id = ppp.assignment_id
    and paaf.pay_basis_id = ppb.pay_basis_id
    and ppb.input_value_id = piv.input_value_id
    and piv.element_type_id = pet.element_type_id
    and pet.input_currency_code = cur.currency_code
    and papf.person_id = pptu.person_id
    and pptu.person_type_id = ppt.person_type_id
    order by papf.employee_number, ppp.change_date desc
    Edited by: user10941925 on Jan 20, 2012 2:37 AM

    Maybe (taking it literally)
    select proposed_salary_n - PREVIOUS_SAL increment,
           100 * (proposed_salary_n / PREVIOUS_SAL - 1) increment_percentage
      from (select papf.employee_number as employee_number,
                   papf.last_name as last_name,
                   papf.middle_names as middle_name,
                   papf.first_name as first_name,
                   papf.known_as as preferred_name,
                   ppt.user_person_type as employment_type,
                   ppp.change_date as change_effective_date,
                   cur.currency_code as currency,
                   ppp.proposed_salary_n * per_saladmin_utility.get_annualization_factor(paaf.assignment_id,to_date(sysdate)) as current_salary_annual,
                   ppp.proposed_salary_n,
                   per_saladmin_utility.get_previous_salary(paaf.assignment_id,ppp.PAY_PROPOSAL_ID) PREVIOUS_SAL,
                   ppp.proposal_reason as sal_proposla_resaon,
                   ppp.attribute2 as performance,
                   ppp.attribute3 as gandac,
                   ppp.attribute4 as NINEBOXPOSITION,
                   ppp.attribute1 as RPR
              from per_all_people_f papf,
                   per_all_assignments_f paaf,
                   per_pay_proposals ppp,
                   per_pay_bases ppb,
                   pay_input_values_f piv,
                   pay_element_types_f pet,
                   fnd_currencies_tl cur,
                   per_person_type_usages_f pptu,
                   per_person_types ppt
             where 1=1
               and papf.employee_number in (127)
    --         and ppp.change_date >= ’01-Jan-2005?
               and papf.current_employee_flag = 'Y'
               and sysdate between papf.effective_start_date and papf.effective_end_date
               and papf.person_id = paaf.person_id
               and sysdate between paaf.effective_start_date and paaf.effective_end_date
               and paaf.assignment_id = ppp.assignment_id
               and paaf.pay_basis_id = ppb.pay_basis_id
               and ppb.input_value_id = piv.input_value_id
               and piv.element_type_id = pet.element_type_id
               and pet.input_currency_code = cur.currency_code
               and papf.person_id = pptu.person_id
               and pptu.person_type_id = ppt.person_type_id
             order by papf.employee_number,ppp.change_date desc
    order by employee_number,change_effective_date descRegards
    Etbin

  • [BASIC question] what is the component I should use to fix an AC voltage and its current (in the same component)

    I need urgently to know how use a component which allows me to fix an AC voltage and its current.
    I can't use a resistance and an AC current in parallele for my application..
    Thanks a lot you will be very helpful !

    In general the way to fix both voltage and current requires a source and an impedance, but you say you do not want that solution.
    Please tell us exactly what your application is and why a current source in parallel with a resistance is unacceptable.
    Lynn

Maybe you are looking for

  • Itunes says there's an update but doesn't appear in app store

    Anybody else get this?  I have been getting this for a while with iTunes updates...  There will be updates available but they never appear in the App Store....

  • [SOLVED]Choppy to no sound

    I have a strange problem with my Toshiba/intel laptop. If I play a mp3 in XMMS there is no sound. If I jump out in the song there is a 1.5 sec sound (the mp3) witch repeats 2 times rapidly. Then there is silence until I jump in the song again. What c

  • Error in executing ABAP dataflow

    We are trying to integrate SAP ECC system with SAP BODS.While doing that we are trying to extract data from SAP tables in BODS with the help of ABAP dataflow.While we run the ABAP dataflow, an error is thrown saying  that a file with .dat extension c

  • Windows 7 Starter supporting 2GB memory?

    I upgraded my Ideapad s10-3, (which I just bought a few weeks ago) with a 2 GB memory module. I wonder if Windows 7 Starter supports 2GB memory. In the manuals it it is said, w7 Starter does not support 2GB. However, when I start up the Task Manager

  • Aperture crashes with 'F' Fullscreen command

    Aperture 3 crashes every time (100% of the time) when I hit 'f' for full screen since upgrading to the latest update. Any ideas? maljo