find the size of a database by counting all the used pages


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers find the size of a database by counting all the used pages
# 1  
Old 03-10-2009
find the size of a database by counting all the used pages

Hi all,

I am looking to find the size of the database by counting all the used pages.

1. I have a file which reads like below
16384 4750850
32768 165
The first column is the pagesize and the second column is the number of pages associated.

So what i am trying is to do is read the file and put the values in 4 variables A,B,C,D....if A = 16384 then E = $A * $B(4750850)

So how do i read 16384 into A and so on....

thanks in advance
# 2  
Old 03-10-2009
Are you familiar with awk?
You could try
Code:
awk '{print $1" x "$2" = "$1*$2}' filename

$1 would be the first field, $2 would be the second, etc.
# 3  
Old 03-10-2009
can you guide me in reading those values into variables...like putting 16384 into A and 32XXX into B etc
# 4  
Old 03-10-2009
Code:
awk '{A=$1;B=$2;print A" x "B" = "A*B}' filename


Last edited by R.T.; 03-10-2009 at 05:54 PM.. Reason: Needed code tags
# 5  
Old 03-10-2009
How can i get the grand total?

awk '{A=$1;B=$2;print A" x "B" = "A*B}' out
16384 x 4750850 = 7.78379e+10
32768 x 165 = 5406720


Looking for a total ( 7.7XXXX + 5406720)
# 6  
Old 03-10-2009
Code:
awk '{A=$1;B=$2;C=C+A*B;print A" x "B" = "A*B};END{print "Total = "C}' filename


Last edited by R.T.; 03-10-2009 at 09:32 PM.. Reason: dropped a }
# 7  
Old 03-10-2009
you rock

you rock bud...thnx a ton
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Scrape 10 million pages and save the raw html data in mysql database

I have a list of 10 million page urls. I want those pages scraped and saved in the mysql database as raw html. I own a Linux VPS server with 1GB RAM and WHM/cPanel. I would like to scrape at least 100,000 urls in 24 hours. So can anyone give me some sample shell scripting code? (4 Replies)
Discussion started by: Viruthagiri
4 Replies

2. UNIX for Dummies Questions & Answers

Help with Database size script

Hello, I'm not very good at scripting as my job is an DBA for a small firm, but now I'd like to implement a few cron jobs which access and report on the databases on an automatic basis. This is my SQL TEXT # -- Total size of Database Size in GB set echo off feedback off verify off... (4 Replies)
Discussion started by: jnrpeardba
4 Replies

3. Shell Programming and Scripting

Help with Database size script

Hello, I'm not very good at scripting as my job is an DBA for a small firm, but now I'd like to implement a few cron jobs which access and report on the databases on an automatic basis. This is my SQL TEXT # -- Total size of Database Size in GB set echo off feedback off verify off pause... (2 Replies)
Discussion started by: jnrpeardba
2 Replies

4. AIX

NMON 12a Size of proc in 4k pages?

Hi running NMON 12a under AIX. Lately I get some out of mem errors from a java machine running "-xmx 1024" which means it can hold up to 1GB mem. Monitoring the process in NMON shows under TOP -> SIZE KB -> 250M I've found nothing in the documentation so I'd like to ask here if anyone... (2 Replies)
Discussion started by: Malapha
2 Replies

5. UNIX and Linux Applications

Database Size

Can anybody tell me how to look for the size of the database on the solariis servers. I am using Solaris 5.6 and Solaris 1.1.1 Any help will be appreciated.................. (1 Reply)
Discussion started by: asalman.qazi
1 Replies

6. HP-UX

know the size of database

Hi all , How to know the size of a oracle database running in hp-ux server. (1 Reply)
Discussion started by: megh
1 Replies

7. Solaris

command to find out total size of a specific file size (spread over the server)

hi all, in my server there are some specific application files which are spread through out the server... these are spread in folders..sub-folders..chid folders... please help me, how can i find the total size of these specific files in the server... (3 Replies)
Discussion started by: abhinov
3 Replies

8. UNIX for Dummies Questions & Answers

command(s) to find size of mysql database?

hello, i'm trying to figure out the size of a mysql database shelling into my server with putty / command line. is there / are there any commands that will return the size of a database, in MB? thanks. (4 Replies)
Discussion started by: sbourgeois
4 Replies

9. Solaris

database image size

hi , we are using Veritas netbackup 5 to backup all databases at our site. i noticed lately that a specific filesystem on the netbackup servers in running critically out of space , after some investigations i found that there are images that are increasing in size everytime a backup is taken .... (6 Replies)
Discussion started by: ppass
6 Replies

10. UNIX for Advanced & Expert Users

how to figure out the size in MB for an informix database

This is the info i have so far. please if you are dead positive can u let me know if i my math/process is correct. Chunks address chk/dbs offset size free bpages flags pathname 5003e1f8 1 1 0 250000 177177 PO- /database/link_cw_p01_rootdbs 5003e494 2 ... (5 Replies)
Discussion started by: Optimus_P
5 Replies
Login or Register to Ask a Question

Featured Tech Videos