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)

Similar Messages

  • QUERY TO GET database size, used size, freesize, tablespacesize of RQ table

    Pls give me a query for to get database size, used size, freesize, tablespacesize of sometables which is starting with 'RQ%'
    I have to get result like this
    Total size, used size, free size ,tablespace size of RQ tables alone
    Reason why i go for "tablespace size of RQ tables" i want to know the size of database after deleting the rq tables
    ( Since i am not getting any reply i go for database forum)
    Pls reply
    S
    Edited by: AswinGousalya on Jul 8, 2009 3:41 PM

    Hello,
    This question looks like it is really for the Oracle RDBMS and not for Berkeley DB. In BDB, we do not have a notion of tablespace size. What database product are you using?
    regards,
    mike brey
    BDB engineering

  • How to get count,index and compare to arraylists

    hi
    how to get count,index and comparing of 2 arraylist.... plz suggest me asap...

    How is your question related to JDBC? And what have you done so far with your code?

  • Getting Window Size And Position

    Hey, well I wanted to know if it was possible in a java application to get the size and location of another window in focus. For instance, I run my app, then I open up an internet window, is there anyway to get the size of that internet window, and the XY coordinates on the screen for it? And if so, is there anyway to capture data such as colors and such if the window is in focus?
    Is it possible to do by process name? Like this...
    if(process is running)
         if(window is minimized)
            System.out.println("WINDOW MINIMIZED");
         else
               System.out.println("The coordinates of the window are...");
               System.out.println("The size of the window is...");
               System.out.println("The resolution of the window is...");
    }Thanks

    Sucka8 wrote:
    I am trying to make a cards probability calculator, the reason I need that information is so I can get the program to see what is on the table. No idea on how to do it?Hm! No!
    >
    Edit: Augh, java is a bitch. I wish I spent all the time I spent on java on C++ or something...Well. Then C is your friend.
    ;-) Bye!

  • Query for  to get  database size, used size, freesize, db size after drop

    Pls give me a query for to get database size, used size, freesize, tablespacesize of sometables which is starting with 'RQ%'
    I have to get result like this
    Total size, used size, free size ,tablespace size of RQ tables alone
    Reason why i go for "tablespace size of RQ tables" i want to know the size of database after deleting the rq tables
    Pls reply
    S

    i tried with
    SELECT
    --fs.tablespace_name name,
    df.totalspace/1024/1024 mbytes,
    (df.totalspace - fs.freespace)/1024/1024 used,
    fs.freespace/1024/1024 free
    FROM
    (SELECT
    --tablespace_name,
    ROUND(SUM(bytes)) TotalSpace
    FROM
    dba_data_files
    ) df,
    (SELECT
    --tablespace_name,
    ROUND(SUM(bytes)) FreeSpace
    FROM
    dba_free_space
    ) fs
    i AM GETTING total bytes, used bytes, free bytes
    I WANT TO include one more column.. database size after deleting rq tables
    Pls reply
    S
    Edited by: AswinGousalya on Jul 10, 2009 2:17 PM

  • 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

  • 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

  • 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

  • Sending pictures on BBM gets lower size and quality

    My friend has Bold 9000, and I have Bold 9700. When i send a picture to his bb through bbm, he recieves it in full size and quality, but when he sends me a picture from his bb to mine through bbm, i recieve it in a lower quality and size then the actual picture. we both are using the latest bbm. please help

    Well before you uninstall the BlackBerry, you can create a backup using Desktop Manager.  Also you can wireless backup your BlackBerry Messenger contacts within BBM.
    To create a wireless backup:
    1. Open BlackBerry Messenger.
    2. Press the Menu key and choose Options.
    3. Scroll down to Contact List, and click on Backup.
    -ViciousFerret
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Like! for those who have helped you.
    Click  Accept as Solution for posts that have solved your issue(s)!

  • How to get file size and name from a directory in 1.1.8

    Hello
    I am trying to get a list of files and their sizes in
    1.1.8.i am compelled to use this,since the version
    our company use is 1.1.8. i could successfully
    resolve this in 1.3. using listfiles option.
    can anybody suggest me how
    to work on this in 1.1.8
    Thanks
    Arjun

    if everything else fails try:
    File dir = //your directory
    String file = //the name of a file
    FileInputStream in = new FileInputStream(new File(dir, file));
    System.out.println("Size of " + file + " (in bytes) is " + in.available());Cheers,
    Binil

  • DB Query to get table sizes and classification in OIM Schema

    My customer's OIM Production DB size has gone upto 300 gb. They want to know why. Like they want to know "what kind of data" is the reason for such a large size of DB. Is there a way to find out, from OIM schema, what are sizes for each table (like ACT, USR etc) and classify them into User Data, Config Data, Audit Data, Recon Data, etc?
    Any help is very much appreciated in this regard.
    Regards
    Vinay

    You can categorize tables using information from below link:
    http://rajnishbhatia19.blogspot.in/2008/08/oim-tables-descriptions-9011.html
    You can count number of rows for tables using:
    select count(*) from tablename;
    Find major tables whose size is to be calculated and find avg length of a row (by adding attribute lengths defined).
    Finally, calculate the table size using below query:
    select TABLE_NAME, ROUND((AVG_ROW_LEN * NUM_ROWS / 1024), 2) SIZE_KB from USER_TABLES order by TABLE_NAME;
    regards,
    GP

  • Is there specific order to adding footer, watermark, ORC scan, security and optimization to get best size and quality results?

    Does it matter what order that the following are done to a document? Are there any guidelines of best practices to know?
    - Adding meta data
    - ORC scan to searchable image
    - Footer/Page Number
    - Watermarks
    - Save as optimized PDF
    - Security
    Is it possible the results would be different (files seize and quality) if the above steps are done id different orders.
    The example I am thinking of is:
    - If footer and watermark is done first, will ORC scan that content or give errors that some parts are already text ?
    - If the file is first optimized using good quality image resampling, will that ruin the ORC results if optimization is done first?

    Hello Scott,
    I have a question about a weird behaviour of the gmaps rendering: When I navigate the first time to gmaps, everything is rendered correctly...but if I navigate back to homescreen and then again to gmap, the gmap is rendered in a very small area of the page on the left side...Why such a rendering issue?
    Maybe you are aware of that. Thank you!
    Best regards,
    Rufat

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

  • How to get Exchange 2010 database size c#

    I'm trying to get smallest Exchange database in my Exchange 2010 server using remote session.
    I successfully connect to my exchange server and get database with properties. Some of them with value, but Properties "DatabaseSize" with Null value for each of them.
    Did some body be able to get database size value?
    For me important to use URI to connect Exchange DAG.
    Part of my code below:
    static void Main(string[] args)
    string exchangePowershellRPSURI = "http://my.domain/powershell?serializationLevel=Full";
    PSCredential credentials = (PSCredential)null;
    //Provides the connection information that is needed to connect to a remote runspace
    // Prepare the connection
    WSManConnectionInfo connInfo = new WSManConnectionInfo((new Uri(exchangePowershellRPSURI)),
    "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credentials);
    connInfo.AuthenticationMechanism = AuthenticationMechanism.Kerberos;
    connInfo.SkipCACheck = true;
    connInfo.SkipCNCheck = true;
    connInfo.SkipRevocationCheck = true;
    // Create the runspace where the command will be executed
    Runspace runspace = RunspaceFactory.CreateRunspace(connInfo);
    // Add the command to the runspace's pipeline
    runspace.Open();
    //Represents the base functionality of a pipeline that can be used to invoke commands
    Pipeline pipeline = runspace.CreatePipeline();
    Command getMDB = new Command("Get-MailboxDatabase");
    getMDB.Parameters.Add("Identity", "*");
    getMDB.Parameters.Add("Status", null);
    pipeline.Commands.Add(getMDB);
    Collection<PSObject> select = pipeline.Invoke();
    if (select.Count > 0)
    foreach(PSObject obj in select)
    var db = obj.Properties["DatabaseSize"].Value;
    string name = obj.Properties["Name"].Value.ToString();
    Console.WriteLine("Database Name: {0} Size: {1}", name, db);
    else
    Console.WriteLine("Failed to create email account");
    runspace.Dispose();
    Console.ReadLine();

    I found solution of my problem by myself. I just changed in string
    getMDB.Parameters.Add("Status", null);
    "null" to "true" like this:
    getMDB.Parameters.Add("Status", true);
    Now everything work fine for me.

  • Getting file header size and image size

    Hi all,
    Now that the AVI file type won't work for me, I have to do some of that functionality myself.
    I can use the function to Get File Size, and the size is returned in bytes, so far so good.
    I figured I could calculate the image size by taking the resolution, multiply X and Y, that gives me the number of pixels.
    Then multiply pixels by bit depth, to get the number of bits, divide by 8 for the number of bytes.
    Since bit depth is 8, the number of bytes will be exact (and the same as the number of pixels).
    When I did the math, and divided by the file size, it didn't come to a round number, and was a larger number than the number of images I could display.
    I figured there is probably additional information stored with each image, but I don't know how to adjust for that.
    There may be byte clustering happening, making each image larger than the actual byte count would indicate.
    And, there is probably file header info, but not sure where to get that.
    I looked through the IMAQ functions, and didn't see one about getting the image size (I did see the one that returns resolution, but I have that data already).
    Any suggestions on how I can calculate how many images are in my binary file?
    And, how to get the byte sizes I need to be able to set the file pointer correctly to get an image out of the middle of the file?
    Thank you for any suggestions,
    Jeff

    If I understand correctly You have binary file with multiple images inside and You want to extract that images?
    Depending on image type You can search by tags where image begins and ends: http://www.impulseadventure.com/photo/jpeg-decoder.html and extract.

Maybe you are looking for

  • Questions on select statement in the data model

    Hi, In the select statement, the order by statement seems only to work at the lowest level of the select statement. Is this true? What is the the purpose of the group by statement in the select statement? As far as I understand, the grouping is cater

  • FB60-No display of special gl transaction

    Hi, in the T.code FB60 special g/l transaction symbols are not displayed. According to my client he want to post special g/l transactions in FB60 only. he dont want F-43 and anyother. When i want to in FB60. to choose a special gl indicator the syste

  • Vendor Quality Score

    I want to map the following scenario related to vendor score calculation. During GR, score is calculated using (1* Accepted Qty + 0.4* Conditionally accepted Qty+ 0* Rejected Qty) / (whole divided by) Total quantity. How can we configure this in cust

  • Is it possible to downgrade to Mountain Lion on the 2013 Mac Pros?

    Obviously came with Mavericks, but would like to know if it's possible to run 10.8. Thanks!

  • Save for web not working

    Hi I 'saved for web' once and all OK when using the resultant quicktime webpage to check. Now this page just shows a green screen in the embedded video and only plays a loud static noise. No changes made to location of files. I tried it again but no