Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use spool command to export a sql script result to a date format's file?

Quanwen ZhaoJul 10 2017 — edited Jul 25 2017

Hello,

my sql script file is,

-----------------------------------------------------------------------------------------------------------------------------------------------

SET heading       ON

SET echo            OFF

SET feedback     OFF

SET trimspool     ON

SET newpage     NONE

SET verify           OFF

SET define          OFF

SET termout        OFF

SET timing          OFF

SET linesize    400

SET pagesize  0

SPOOL check_redo_apply_xxxxxxxxxxxxxx.log

COL current_scn FOR 9999999999999999

SELECT current_scn FROM v$database;

SELECT MAX(sequence#) FROM v$archived_log WHERE applied='YES';

SELECT MAX(sequence#) FROM v$archived_log WHERE applied='NO';

SELECT process,pid,status,sequence#,block#,blocks,delay_mins FROM v$managed_standby;

SELECT sequence#,status,archived FROM v$standby_log;

COL name                   FOR  a24

COL value                   FOR  a12

COL unit                      FOR  a28

COL time_computed   FOR  a20

COL datum_time         FOR  a20

SELECT * FROM v$dataguard_stats;

SPOOL OFF

-----------------------------------------------------------------------------------------------------------------------------------------

please ask 'SPOOL check_redo_apply_xxxxxxxxxxxxxx.log' in 'xxxxxxxxxxxxxx',i wanna to use a date format, how to add in SQL or PL/SQL ?

Thanks!

Regards

QuanwenZhao

This post has been answered by GregV on Jul 10 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 8 2017
Added on Jul 10 2017
9 comments
1,335 views