Help with excel generate


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with excel generate
# 1  
Old 01-05-2012
Help with excel generate

Hi,
I want to calculate the table space usages an this result save as excel. It's saved but header coming two time within one excel file like :

TABLESPACE_NAME SIZE_MB FREE_MB USED_MB FREE_% USED_% a 10000 3395.63 6604.37 33 66 b 2048 1330.38 717.62 64 35 c 7964.1875 3898.88 4065.3075 48 51 TABLESPACE_NAME SIZE_MB FREE_MB USED_MB FREE_% USED_% d 2048 699.63 1348.37 34 65 e 627 1.19 625.81 0 99

I want to show only one header in one excel. Please find below my script :
Code:
#!/bin/bash
sqlplus -s sys/password@sid as sysdba << EOC  > /dev/null
set feed off markup html on spool on
spool table_space.xls
select
b.tablespace_name,
tbs_size size_mb,
a.free_space free_mb,
tbs_size-a.free_space used_mb,
Trunc((a.free_space/tbs_size) * 100) "FREE_%",
Trunc(((tbs_size-a.free_space)/tbs_size) * 100) "USED_%"
from  (select tablespace_name, round(sum(bytes)/1024/1024 ,2) as free_space
       from dba_free_space
       group by tablespace_name) a,
      (select tablespace_name, sum(bytes)/1024/1024 as tbs_size
       from dba_data_files
       group by tablespace_name) b
where a.tablespace_name(+)=b.tablespace_name;
spool off
set markup html off spool off
EOC

Thanks in advance.

Last edited by Franklin52; 01-05-2012 at 04:10 AM.. Reason: Please use code tags for code and data samples, thank you
# 2  
Old 01-05-2012
Provide the output also in CODE tags .. Your getting output seems to be confusing ..
# 3  
Old 01-05-2012
Help with excel generate

This is o/p what i had got when i ran ur query. i couldn't see two header . Smilie

TABLESPACE_NAME SIZE_MB FREE_MB USED_MB FREE_% ------------------------------ ---------- ---------- ---------- ---------- USED_% ---------- SYSAUX 290 9.06 280.94 3 96 USERS 130 6.69 123.31 5

SYSTEM 350 1.19 348.81 0 99 UNDO 305 296.31 8.69 97 2
# 4  
Old 01-05-2012
Thanks for replay.

The problem is solved.
I had increased the page size.
set pagesize 200
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

2. Shell Programming and Scripting

Summing up the data from different excel sheet into one excel sheet

Hi Folks, Can you please advise for any script in unix such that for example , i have 3 different excel sheet at the location /ppt/gfr/exc so the name s of the excel sheet are 1excel.xslx 2excel.xslx 3excel.xslx now in these 3 different excel sheet there is lot of data for example each... (3 Replies)
Discussion started by: punpun66
3 Replies

3. Shell Programming and Scripting

Perl script to Merge contents of 2 different excel files in a single excel file

All, I have an excel sheet Excel1.xls that has some entries. I have one more excel sheet Excel2.xls that has entries only in those cells which are blank in Excel1.xls These may be in different workbooks. They are totally independent made by 2 different users. I have placed them in a... (1 Reply)
Discussion started by: Anamika08
1 Replies

4. Shell Programming and Scripting

Writing excel file using perl : Excel file formatting changed

I am trying to create a program where user can input data in certain excel cells using user interface on internet....the programming is on perl and server is unix But when i parse data into excel the formatting of sheets is turned to default and all macro coding removed. What to do...Please... (7 Replies)
Discussion started by: mud_born
7 Replies

5. Shell Programming and Scripting

a shell script to generate an excel sheet from a text file..

hi, i have a text file that looks like this! i want to generate an excel sheet out of it, removing all the junk data except the addresses that look like . Arrow Electrical Services Rotating Machinery, Electrical Contracting & Mining Specialists Onsite maintenance, breakdown... (8 Replies)
Discussion started by: vemkiran
8 Replies

6. UNIX for Dummies Questions & Answers

Generate dates

let says, today is my payroll day (7/26), my next payroll day will be 8/9. i want to generate a shell script to extract 8/9, 8/23, 9/6, and so on for 2010. (2 Replies)
Discussion started by: tjmannonline
2 Replies

7. Shell Programming and Scripting

generate a report

Hi Please help me to resolve the below query. My shell script has generated a file output.file like below ******************************** DROP TABLE GPS_CONTACT_DETAILS DB20000I The SQL command completed successfully. CREATE TABLE GPS_CONTACT_DETAILS ( CONTACT_ID ... (8 Replies)
Discussion started by: sailaja_80
8 Replies

8. Shell Programming and Scripting

PERL: Split Excel Workbook to Indiv Excel files

Hi, I am trying to find a way to read an excel work book with multiple worksheets. And write each worksheet into a new excel file using perl. My environment is Unix. For example: I have an excel workbook TEST.xls and it has Sheet1, Sheet2, Sheet3 worksheets. I would like to create... (2 Replies)
Discussion started by: sandeep78
2 Replies

9. UNIX for Dummies Questions & Answers

Script to generate text file from excel file

Hello, I have a excel file which has almost ten columns on the shared drive. I have to write a shell script to ftp that daily to unix server and then extract some columns from there and generate oracle standard text file. The columns should be in proper order and aligned properly, otherwise... (1 Reply)
Discussion started by: isingh786
1 Replies

10. Programming

generate a program

I have created a shell script but i wnt to translate that in c++ program as it is not working that fast. 1 strip=6 tickets 1 ticket has 27 values in that there should be exactly 15 values rest can be filled with zeroes. 1 strip has exactly 90 values. in a column the entries should be in... (2 Replies)
Discussion started by: namishtiwari
2 Replies
Login or Register to Ask a Question