Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

RE: Check Sybase data/log sizes

by cadfael (Friar)
on Nov 02, 2000 at 20:36 UTC ( [id://39667]=note: print w/replies, xml ) Need Help??


in reply to Check Sybase data/log sizes

Not bad, so far. I ran it, and it worked just fine after I hit CPAN for Number::Format.

I did see some odd things, but I am running ASE 12.0, and you seem to be running ASE 11.9.2. In any event, I know my log is not 100% full.

I appreciate seeing how you set up your query to the database and deal with the results. Everyone I see has done it just a little differently, which is one of the reasons I like Perl.

One thing I use in nearly all my databases is threshholds. For example, I created a threshhold to dump the log at about 80% full, thereby eliminating a great deal of "pooper scooping" when people write poorly-framed queries.

Following is the output from my first try with your script:

9:14am % ./view_log_size.pl -U xxxxxx -P xxxxxxxxxxxxxx -D xxxx
Argument "buffer manager" isn't numeric in addition (+) at ./view_log_size.pl line 94.
Argument "not applicable" isn't numeric in multiplication (*) at ./view_log_size.pl line 91.
Argument "not applicable" isn't numeric in multiplication (*) at ./view_log_size.pl line 91.
Use of uninitialized value in concatenation (.) at ./view_log_size.pl line 122.
   Warning! Resources are getting low in Sybase database!
   Threshold used: 
      Log or Data Empty Percent greater than 30.00%

       Host: xxxx
   Database: xxxxx
     Server: 
      Owner: xxxxx
    Created: Apr 01, 1999

   Total Size: 1,144.41 MB

    Data Size: 953.67 MB
    Data Used: 399.99 MB
    Data Free: 553.69 MB
        Empty: 58.06%

     Log Size: 190.73 MB
     Log Used: 190.73 MB
     Log Free: 0
        Empty:  0.00%

   Please fix the situation ASAP!

-----
"Computeri non cogitant, ergo non sunt"

Replies are listed 'Best First'.
RE: RE: Check Sybase data/log sizes
by lachoy (Parson) on Nov 03, 2000 at 01:55 UTC

    Cool! Thanks for checking it out. Unfortunately, I don't have a copy of ASE 12 around to test this out -- Sybase seems to be waiting to release 12.5 before they put a new version out for Linux. Can you do me a favor and dump the output of a 'sp_help mydbname' from isql or sqsh (or dbish or ...) and either post it here or email it to me?

    I suspect the output of the same stored procedure on the two different versions is different, which is kind of a pain. This is a cheap way to do it anyway -- a real Sybase hacker would read information from the system tables anyway :-)

    Thresholds are definitely a good idea, and we implement them where possible as well.

      I had the same thought exactly, and yes, they ARE differerent. In fact, I see where the error messages I mentioned in my previous note are coming from, as there is a new section of information between the general info and the device usage section. The free space on the logsegment is "not applicable", so it would be problematical parsing out information that just does not exist (at least with the ASE 12.0 version of sp_helpdb).

      I tend to go to the system tables for my information, anyway.

      Here is what the new version looks like:

      1> sp_helpdb mdb3
      2> go
       name                     db_size       owner                    dbid  
              created       
              status                                                                  
                                    
       ------------------------ ------------- ------------------------ ------
              --------------
              ------------------------------------------------------------------------
      ------------------------------
       mdb3                         1200.0 MB dhancock                      5
              Apr 01, 1999  
              select into/bulkcopy/pllsort                                            
                                    
      
      (1 row affected)
       name                           attribute_class               
              attribute                      int_value  
              char_value                                                              
                                                                                      
                                                                                      
                             
              comments                                                                
                                                                                      
                                                                                      
                             
       ------------------------------ ------------------------------
              ------------------------------ -----------
              ------------------------------------------------------------------------
      --------------------------------------------------------------------------------
      --------------------------------------------------------------------------------
      -----------------------
              ------------------------------------------------------------------------
      --------------------------------------------------------------------------------
      --------------------------------------------------------------------------------
      -----------------------
       mdb3                           buffer manager                
              cache binding                            1
              mdb3_cache                                                              
                                                                                      
                                                                                      
                             
              NULL                                                                    
                                                                                      
                                                                                      
                             
      
       device_fragments               size          usage               
              free kbytes     
       ------------------------------ ------------- --------------------
              ----------------
       db_disk                        100.0 MB      data only           
                         86322
       db_disk                        300.0 MB      data only           
                         46444
       db_disk                        300.0 MB      data only           
                        304976
       db_disk2                       100.0 MB      data only           
                        102000
       db_disk2                       200.0 MB      data only           
                         40822
       log_disk1                      100.0 MB      log only            
              not applicable  
       log_disk1                      100.0 MB      log only            
              not applicable  
      
                                                                     
       --------------------------------------------------------------
       log only free kbytes = 126720                                 
      
       device                        
              segment                                                                 
                        
       ------------------------------
              ------------------------------------------------------------------------
      ------------------
       db_disk                       
              default                                                                 
                        
       db_disk                       
              system                                                                  
                        
       db_disk2                      
              index_seg                                                               
                        
       log_disk1                     
              logsegment                                                              
                        
      
      (return status = 0)
      
      

      -----
      "Computeri non cogitant, ergo non sunt"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://39667]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-24 15:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found