Script to calculate the size of table

I am very new to scripting. My first script i need to make is for finding the total size of my oracle tables.
I have to provide two inputs that is the database name and tabale name
and the script should give me the size. This script will also be incorporated in crontab for checking the size of a particular table which is for txn logging and will be mailing us when the size of the table reaches 1gigs.
what i have in mind till yet is
#!/usr/bin/ksh
# Script to find sze of the table
# usage ./truncate_table.ksh ORACLE_SID TABLE_NAME
set -x
export ORACLE_HOME=/opt/oracle/product/9.2.0.4
SUMMARY=/tmp/truncate_table.log
date > $SUMMARY
export ORACLE_SID=$1
echo $ORACLE_SID
export TABLE_NAME=$2
if [ -z $ORACLE_SID ]
then
echo "Oracle SID not set"
exit
fi
export PATH=$ORACLE_HOME/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/openwin/bin:/usr/dt/bin:/opt/rational/clearcase/bin:/usr/local/samba/bin:/
export/home/oracle/bin:/u01/oracle/admin/adhoc:/opt/oracle/OPatch:/usr/ccs/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
${ORACLE_HOME}/bin/sqlplus -s '/ as sysdba'<<EOF>>$SUMMARY
set pagesize 0 feedback on verify on heading off echo on
select (bytes/1024/1024) as total_gigs from dba_segments where owner='SIEBEL' and segment_name='$TABLE_NAME'
exit;
EOF
But this is not working...
CAn someone help

select (bytes/1024/1024) as total_gigs from dba_segments where owner='SIEBEL' and segment_name='$TABLE_NAME'You are missing ";" at the end of query. That's the reason why your script does not work.
export TABLE_NAME=$2Why you did export of TABLE_NAME? This doesn't make sense. The same as ORACLE_SID export.
Just use "TABLE_NAME=$2"

Similar Messages

  • To Calculate the Size of Infocube

    Hi ..
       How to calculate the size of the Infocube...?
    I know there is one formula for it...!
    Can any one help me...
    Thanx in Advance...
    Vasu

    hi Vasu,
    calcute the size of infocube
    - total records
    transaction se16 -> fact table name, /bic/f[infocube name] and /bic/e[infocube name] or /bi0/f.. and /bi0/e for business content infocube, click 'number of entries'
    use program (se38) SAP_INFOCUBE_DESIGNS
    - size in bytes
    transaction db02 -> 'detail analysis' -> object name = [infocube name]
    hope this helps.

  • How to calculate the size each PSA request or all PSA for the Datasources?

    Hi All,
    Can anybody tell me how to calculate the size of each PSA Request or all PSA's requests for all datasources?
    Regards,
    Rajesh

    Hi ,
    PSA technical name can be found as,
    1)Right click on your Data Target,go to Display dataflow,click on the PSA ,here you can find the technical name.
    2)Goto RSRV tcode>PSA Table>Consistency between PSA Partitions and SAP Administration-->Give your Infosoure name,it gives u PSA technical name also,
    Thanks&Regards,
    Praveena.

  • How can I change the size of table control in table maintenance re-gen?

    Hello Experts,
    I hv created a maintenance view and after generated table maintenance view for it.
    now it adjusts the size of table control in table maintenance generation.
    I want to change the size (width) of table control and again re-generate the table maintenance.
    But when re-generation occurs, table control size is set to initial.
    why it is happening? and wt to do to solve this issue? any user exit?
    I need the changed size of table control even if its re-generated.
    Regards,
    R.Hanks

    Hello Ronny,
    Goto SM30, Enter your table name for which you have maintained your table maintainence generator .
    When the maintainence screen appears for your table name , Goto System->Status->Screen Program name.
    Copy that program name from there.
    Open that module program through SE80,this is the program name of your SM30 screen which appears when we enter our table name in SM30 transaction.
    In SE80,click the layout of the module program name you have entered there.
    Its layout will display you the table control(of SM30) present to enter your your enteries.
    In the change mode you can change its size , savee it and activate that program.
    Now goto to SM30 again and enter your table name, it will show you the changed size of the table control used to take the enteries.
    Note:This changed size is only for your table name and it will remain of its previous size for other table enteries.
    Hope it helps you.
    Thanks Mansi

  • How to fix the size of table data in html

    I want to fix the size of table data in html. ie if i want to insert only 50 char in a <td> field then it contain only 50 character, after that it switched to another line and contain the remaining character. Means <td> field wil not get automatically adjust there size according to data.

    you cant specify how many characters a td cell can have but u can specify the pixel width of a td cell
    <td width=50>
    as long as you have wrap text on, then text will not force the box size over the 50 pixels
    this wont limit it to only 50 chars though, you will probably have to use some javascript to cut the string down to size (unless youre using something like php or asp then that will do the trick too)

  • How to calculate the size of web forms in hyperion planning?

    Hi Experts,
    I am trying to calculate the size of planning forms in Hyperion smart view., but i am unable to find out the way to calculate.
    Can you pls explain how to calculate the size of web form in Smart view?
    --- Srini.

    Hi Srini,
    First, here is what Oracle says:
    Data Form Size Estimation:
    To get a rough estimate of data form size, open the data form and select File > Save As from the browser. The size of the .HTML file is the portion of the data form that changes based on grid size. The .JS files remain the same size and can be cached, depending on browser settings. Information such as data form definitions, pages, and .gif files are not compressed when data forms are opened and sent to the Web browser.
    I have not been able to find out using their method.
    In any case, you can find out the size of grid by using below
    1. Right click on the form grid and click "View source"
    2. Save the source file as "Example.html"
    3. Right click the saved file and click "Properties"
    4. The Form size whould be same as that of file..
    Let me know if it helps.
    Cheers
    RS

  • I need a script to reduce the size of the Fra which has used 34 gb in space

    I need an rman script to reduce the size of the Fra:
    SQL> select * from v$flash_recovery_area_usage;
    FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
    CONTROL FILE 0 0 0
    REDO LOG 0 0 0
    ARCHIVED LOG 0 0 0
    BACKUP PIECE 0 0 0
    IMAGE COPY 0 0 0
    FLASHBACK LOG 69.99 19.33 2357
    FOREIGN ARCHIVED LOG 0 0 0
    7 rows selected.
    SQL> SELECT
    2 ROUND((A.SPACE_LIMIT / 1024 / 1024 / 1024), 2) AS FLASH_IN_GB,
    3 ROUND((A.SPACE_USED / 1024 / 1024 / 1024), 2) AS FLASH_USED_IN_GB,
    4 ROUND((A.SPACE_RECLAIMABLE / 1024 / 1024 / 1024), 2) AS FLASH_RECLAIMABLE_GB,
    5 SUM(B.PERCENT_SPACE_USED) AS PERCENT_OF_SPACE_USED FROM
    6 V$RECOVERY_FILE_DEST A,
    7 V$FLASH_RECOVERY_AREA_USAGE B
    8 GROUP BY
    9 SPACE_LIMIT,
    10 SPACE_USED ,
    11 SPACE_RECLAIMABLE ;
    FLASH_IN_GB FLASH_USED_IN_GB FLASH_RECLAIMABLE_GB PERCENT_OF_SPACE_USED
    50 34.99 11.14 69.99

    In /gateprd/ARCHIVE/*.arc
    This is the script to remove the archives after it has been backup by the netbackup policy named Archive. This policy removes the archives that have been backed up.
    /home/oracle/dba/scripts> more rmovarch.sh
    #!/bin/ksh
    # compress /gateprd/ARCHIVE/*.arc
    find /gateprd/ARCHIVE/*.arc -type f ! -exec echo {} > /home/oracl
    e/dba/lists/ARCHIVElist \;
    if test $(cat /home/oracle/dba/lists/ARCHIVElist|wc -l) -gt 0
    then
    echo "Hay archives. Se corre script de borrar"
    /home/oracle/dba/scripts/ARCHIVE_BACKUP.sh ARCHIVE
    else
    echo "No archives!!"
    fi

  • To calculate the size of backup for a particular database in RMAN catalog

    Hi ALL,
    Could you please guide me how I can calculate the size of backup data for a particular database in Recovery Catalog, if I am using Tapes as my backup media for recovery catalog.
    Regards
    Harpreet Singh

    Hi,
    I am not Up to the mark of your question ..
    If you see the V$log you can get it.. Size of the redo logs can be determined either by examining the file system size or by reading the BYTES column on the V$LOG view. Then Check the number of redo Logs avaialble checked whether they are mirrored or etc., Combining the two figures we have a total redo log data at peak in one day. This is the amount of data that any backup facility or storage of Archive Redo Logs would have to take into account. This figure should be mitigated against the fact that manual switching of redo logs means that not all archived redo logs will be the full size.
    - Pavan Kumar N

  • How to calculate the size of the heap memory? its urgent pls

    i had a task in which i need to calculate the size of the heap memory can anybody help me its urgent pls

    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    Specifically:
    max/total/freeMemory()
    http://javaalmanac.com/egs/java.lang/GetHeapSize.html?l=new

  • Calculate row size of table with clob

    Hi
    I have a table which has clob data type, how can I calculate size of each row ?

    Mark D Powell wrote:
    What version of Oracle?
    Are you interested in the combined row size of the base table row and the Lob segment or just the row size of the base table row? Or just the lob segment size?
    Are you asking about a specific row or just the average for the entire table?
    Depending on your version of Oracle dbms_stats which calculates the avg_row_len for the base table when lob columns are present incorrectly.
    HTH -- Mark D Powell --I need row size for every record in the table, the table itself is only 1GB, can be combined size or lob size relevant to each record in a table it doesnt matter.
    v11.2
    thanks

  • How to calculate the size of a Text Field?

    Is there a way to calculate the number of characters allow in a Text Field? If a uer type over this number of characters a popup window will appear telling the user that he/she has too much texts. Of course I could use the Limit Length, but I have to manually put texts into this text field and count them. If the Limit Lenth number is too small, the texts does not fill the whole text field. If the number is too big then the texts does not get printed.

    There would be no easy way to do this. You'd need to do some pretty fancy calculations, it would all depend on the size of the field, what font is used, the font size, whether it's been bolded, underlined, italicized, etc etc.
    What are you trying to accomplish? Make it so that the user can type in the text field until it fills and then have it stop without scroll bars coming up to allow him to keep typing?
    Chris
    Adobe Enterprise Developer Support

  • How to calculate the size of DB given the transaction and the INVT

    Hi,
    I need to know the size of a database
    transactions/day-900
    Total Items=12,200
    We are preparing for a proposal .The above is the descriptions given by the client.
    How to estimate the size of database We need to design a hardware configuration
    Can anyone help me
    Maran.

    Any clue regarding the size of the row in the 900 transactions per day?
    Will there be a single table updated per transaction or multiple tables?
    Will the transaction be of type insert mostly?
    If it is going to be insert only, then probably you can estimate the database size based on size of row * 900 transactions per day... You need to consider if there will be other tables affected via triggers.
    Also, the size of the indexes defined on these tables will contribute to the database size.
    No idea as to what do you mean by 12,200 items.
    Message was edited by:
    satishkandi

  • How to identified the size of table logging (SCU3)

    hi SAP Expert,
    currently i'm activating the table logging via parameter REC\CLIENT = ALL, understand that this will accumulate the log times to times, is there anyway i can identified how big is the log file already? since i'm concern the log files would make my hardisk full. thanks for any respon.
    Regards
    Hariyono

    Table logging write to table DBTABPRT, just check the size of the table in DB02 (or number of entries in SE16) you can track the growth of the table and wipe the contents once the data is been consumed by whoever requested it.
    You can check in DB02 in what tablespace the table is located and make sure that theres enough space in the filesystem for the table to grow without causing inconvenients.
    Regards
    Juan

  • How to calculate the size of database (a different one)

    Hello Friends,
    I am told to move the data from server to another machine (cloning is one very good option, I agree. But I expect a different answer regarding exports and imports). so How should I go about the task. The destination machine has got unlimited space. So thats not a problem. My questions are :
    1) How should I start the task ( I generally go for studying the structures and their sizes. Is it ok ?)
    2) If I am using Unix machine and there is a limitation that my server will not support file sizes of more than 2 GB, What should I do ?
    3) Shall I have to go for a full database backup or fragment the task ? If I do that , there are many schemas, so it will become tedious. But full backup will exceed OS size limitation. What should be done ?
    4) Is there anyway, I can go through a dump file, to find out, the database objects present inside that and note the related dependencies.
    Please respond.
    Regards,
    Ravi Duvvuri

    1) They are Unix machines. So will the size problem occur(if there is a limitation). How to overcome that?
    If the OS are of the same version you will have any problem. Regarding the storage only you have to have space in disk to store the datafiles, redo logs and controlfiles and nothing else.
    2) I am trying Export/import measure. Though there are other good methods, I just want to explore the full capabilities of Exp/Imp
    r.- Recreate the controlfiles is more effective and fast if the OS are of the same version.
    3) And the oracle version is 9i 2. (If I have to perform this on 8i (both source and destination, will the methods are going to differ ?)).
    R.- The method is the same for 8i/9i/10g.
    How should I go about doing this export/import ?
    r.- To use this method you have to have the original database started.
    To recreate the controlfile without having the datafile that you mentioned you have to get out it from the CREATE CONTROLFILE sentence and that's it.
    For Example: I mean, if your database has 8 datafiles and you have only 7, you have to include only 7 in the CREATE CONTROLFILE sentence.
    Joel Pérez
    http://otn.oracle.com/experts

  • Calculate the size(in bytes) that will be displayed to the console by command Write-Output

    Is there some way to check the size(in bytes) of the output that will be displayed to the console using Write-Output command. I want the console to display only the first 1024 bytes of the objects output.

    Hi Sachin,
    in that case let me add an example on how to read content from a file that may be or may not be a text file:
    $string = [System.Text.Encoding]::UTF8.GetString([System.IO.File]::ReadAllBytes("D:\example.txt"))
    Theoretically, the "Get-Content" cmdlet ought to do the same, however I have occasionally experienced different results.
    You can choose to not convert it to string and just print the bytes too (or choose another encoding of your preference). Remember, a single letter usually uses 2 bytes, thus reading the first 1024 bytes from a file you converted to text would mean printing
    the first 512 letters.
    Cheers,
    Fred
    There's no place like 127.0.0.1

Maybe you are looking for

  • IMac G5 & connecting wirelessly to Actiontec modem

    Hello all, I just turned on my first Mac ever today. It is exciting & somewhat frustrating so far but I have made the switch. I have talked to Qwest & apple support for a total of at least an hour & they dont think I can do it. With someone elses hel

  • E50 Web Browser & Red Button behavior

    Is there anyway to change the behavior of the Red Button (End Call) when in the web browser on the E50? Currently, if the red button is accidentally hit it instantly closes the web browser and all typing and web pages are closed and lost. This happen

  • Cannot access certain websites (in particular the ...

    I have had an ongoing issue where I am unable to access certain websites on my BT broadband connection. Example sites include: rsjoomla Dell I know the problem is not my PC, software firewall or router/hub.  If use a free proxy service on the interne

  • Kismac stays in location services after removal

    I tried kisMAC under Lion, but it is not ready for 10.7(1) yet. After removal of the app (using AppCleaner) it sticks in the System Preferences - Security & Privicy - Privacy - Location Services app list. Is there anybody who knows how to remove it f

  • Can't type in text

    I'm stuck trying to input text in Live Type. Every key that I appear as a dot and reproduces an image I used in my last project. I'm not sure how I've activated this mode so need your help to get out.