Sponsored Content
Top Forums Shell Programming and Scripting Spool - Append and Calculation Post 302775787 by Yoda on Tuesday 5th of March 2013 12:10:19 PM
Old 03-05-2013
How about using a PL/SQL?

PHP Code:
SET SERVEROUTPUT ON;
DECLARE
        
V_DATE          VARCHAR2(10);
        
V_TIME          VARCHAR2(10);
        
V_TOTAL_GB      dba_data_files.bytes%type;
        
V_USED_GB       dba_data_files.bytes%type;
        
V_USED_PER      dba_data_files.bytes%type;
BEGIN
        select to_char
(sysdate'mm/dd/yyyy'into V_DATE from dual;
        
select to_char(sysdate'HH24:MI'into V_TIME from dual;
        
select round(sum(bytes)/1024/1024/1024,4into V_TOTAL_GB from dba_data_files;
        
select round(sum(bytes)/1024/1024/1024,4into V_USED_GB from dba_segments;
        
select round((V_USED_GB 100)/V_TOTAL_GB,4into V_USED_PER from dual;
        
dbms_output.put_line (V_DATE || ' ' ||  V_TIME || ' ' ||  V_TOTAL_GB || ' ' || V_USED_GB || ' ' || V_USED_PER);
END;

Create a CSV instead, so that you can distinguish the fields and read it in a script:

PHP Code:
dbms_output.put_line (V_DATE || ',' ||  V_TIME || ',' ||  V_TOTAL_GB || ',' || V_USED_GB || ',' || V_USED_PER); 
Also turn off the FEEDBACK:

PHP Code:
SET SERVEROUTPUT ON FEEDBACK OFF
These 2 Users Gave Thanks to Yoda For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Spool for Printer

i have created a new printer in the printcab file. when i use lpc and the status command it says: LMAPFE20: printer is on remote host lpt1: queuing is enabled printing is enabled cannot examine spool directory What ive... (1 Reply)
Discussion started by: JuergenW
1 Replies

2. UNIX for Dummies Questions & Answers

Spool

hi every body, is there any possibles to spool the commads with output(like oracle spool file) (1 Reply)
Discussion started by: kskumar
1 Replies

3. UNIX for Dummies Questions & Answers

Spool Issue

Hi: At every month end I would like to collect the information of a spool. Every Spool has more then one job, below is the individual job information, I really want to collect into a text file. Sp-id Proc User Printer Id Pty Form Copy Total SP7494 MONTHEND SYED R123 P2 1 WIDE ... (3 Replies)
Discussion started by: shah2
3 Replies

4. Shell Programming and Scripting

Spool / Spool off

Hi everyone I'm new in this forum, I have a question: I have a script with many sql staments and I have the spool command at the beginning and the 'spool off' at the end of the script. But, I want to write after each sql stament to a log file not at the end. How can I do it? Thanks (0 Replies)
Discussion started by: edzela
0 Replies

5. UNIX for Dummies Questions & Answers

Spool command in Unix

Hi, Is there any command in unix similar to spool command in oracle. (6 Replies)
Discussion started by: manosubsulo
6 Replies

6. Solaris

Spool directory

hi all, I have unix box I install 2 zone on it I want to make spool directory and assign one to each zone How can I do that ? (5 Replies)
Discussion started by: coxmanchester
5 Replies

7. UNIX for Dummies Questions & Answers

Like spool in UNIX

Hi, Can you please help me how to spool the unix commands executed in my client and its output to a file in local machine. Basically, I want to save all OS commands executed in my session and its output into a file from my client something like we do oracle with "SPOOL". Thanks in advance.... (2 Replies)
Discussion started by: pointers
2 Replies

8. UNIX for Dummies Questions & Answers

Issue with SPOOL

Hi, I use SunOS and i connect to database via isql. When tried using SPOOL command to extract the report from database, system thrown me saying "Spoool command not found". Please advise. (3 Replies)
Discussion started by: kusathy
3 Replies

9. Shell Programming and Scripting

Issues with SPOOL

I am using a unix shell script to create and then FTP the file to a mainframe application. The unix script uses spool to extract data from a Oracle database. The data is extracted into a text file. The text file is having all the data I need but not in the correct format. The rows of... (1 Reply)
Discussion started by: rameez
1 Replies

10. Shell Programming and Scripting

Append date to sql*plus spool (log) file in shell script

SQL*Plus version : 11.2.0.4 OS : Oracle Linux 6.5 SQL*Plus is a client application to connect to oracle database. The log file for this tool is generated via spool command as shown below. I am trying to append date ( $dateString ) to spool file as shown below. $ cat test2.sh #!/bin/bash... (4 Replies)
Discussion started by: kraljic
4 Replies
All times are GMT -4. The time now is 03:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy