formatting of sqlplus

Hi all

In sqlplus below query returns the result in 2 rows. I want the output to be on the same line

SELECT DISTINCT ORIGINATING_TIMESTAMP, MESSAGE_TEXT to sys. X$ DBGALERTEXT WHERE MESSAGE_TEXT AS MESSAGE_TEXT AS 'fatal %' or 'ORA-%' AND ORIGINATING_TIMESTAMP > SYSDATE-4;


example of output:

28 APRIL 10 07.03.29.925 H + 03:00
ORA-28: abandonment of opiodr treat unknown ospid (18707_1)

I tried to use set linesize and column format also. but the output is not displayed in a row

No idea what I have to put

Kai

Check the sys. X definition DBGALERTEXT $. MESSAGE_TEXT is VARCHAR2 (2048). So you need to see it on a single line using LINESIZE:

SQL> select DISTINCT ORIGINATING_TIMESTAMP,MESSAGE_TEXT from sys.X$DBGALERTEXT WHERE MESSAGE_TEXT LIKE 'ORA-%' or MESSAGE_TEXT LIKE '%Fatal%' AND ORIGINATING_TIMESTAMP > SYSDATE-4;

ORIGINATING_TIMESTAMP
---------------------------------------------------------------------------
MESSAGE_TEXT
--------------------------------------------------------------------------------
26-JUL-10 11.52.01.178 AM -04:00
ORA-1109 signalled during: ALTER DATABASE CLOSE NORMAL...

SQL> set linesize 2200
SQL> /

ORIGINATING_TIMESTAMP                                                       MESSAGE_TEXT
--------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------
26-JUL-10 11.52.01.178 AM -04:00                                            ORA-1109 signalled during: ALTER DATABASE CLOSE NORMAL...

SQL> 

SY.

Tags: Database

Similar Questions

  • Cannot display the column format in SQLPLUS.

    Hi all

    Why my sqlplus just displays # when I run sql > column group # format a20;

    SQL > column group # format a20;
    SQL > select group # log v$.

    GROUP #.
    ----------
    ##########
    ##########
    ##########
    ##########

    Help, please!
    Thank you!

    Welcome to the forums!

    Try:

    COLUMN group# FORMAT 9999
    

    You try to provide a column for a VARCHAR2 format, but the data type is NUMBER.

  • How publish data from the table with some data loss all post in the forum

    I wonder how people are displayed the data in the table or the result of a query with losing them its format from Sqlplus display when they post in the forums of Oracle. I searched on the basis of knowledge of DB but I see no article about it. can you please help me or direct me to this link, I tried different options using code and other tags but nothing has worked, thank you for your help. Thank you.

    Edited by: Ariean October 3, 2011 12:34

    You can click on the link to the FAQ at the top right: http://wikis.sun.com/display/Forums/Forums+FAQ.

  • How to recover my deptno values

    Hi all
    I had a problem like this

    SQL > select deptno from emp;

    DEPTNO
    ----------
    ##########
    ##########
    ##########
    ##########
    ##########
    ##########
    ##########
    ##########
    ##########
    ##########
    ##########

    DEPTNO
    ----------
    ##########
    ##########
    ##########

    14 selected lines.





    can someone help me how to recover my values of deptno.
    Thnkx

    Try to change a column format in SQLPlus

    SQL> select max_extents from user_tables;
    
    MAX_EXTENTS
    -----------
     2147483645
     2147483645
    
    SQL> column max_extents format 99
    SQL> /       
    
    MAX_EXTENTS
    -----------
         ###
         ###
    
    SQL> column max_extents format 9999999999999999999999999
    SQL> /
    
                MAX_EXTENTS
    --------------------------
              2147483645
              2147483645
    
  • How to format the sql format GET easily in sqlplus

    Hello
    I use TOAD to format my sql always (to help shift + ctrl + F). It's really frustrating because I have to format the sqls a lot all the time. I have recently joined a successful dba team and need to quickly understand the sqls.

    A member of the forum can you please suggest me a way to do it quickly in sqlplus itself?

    Thanks & take care,.
    Malika

    Anthony wrote:

    But there are situations where I have to work on machines where I can't access the internet because of procedures/etc security problems, that's why I need to find a way to quickly put the sqls in sqlplus/unix itself.

    SQL * Plus is not an editor does not support formatting of unformatted existing SQL code. It uses an external editor - and formatting you want to, must be a function or feature of the external editor. The Unix/Linux default editor is vi or vim. Emacs, kate and others can also be configured (using the EDITOR environment variable) for use with SQL * more.

    Formatting manual is often a 'good' thing that it forces you to slow down and look at each line (when the manual formatting) in the code. So they identify issues and problems that could be missed when looking at already formatted code.

  • Import specifications of centralized in Sqlplus scripts possible column format?

    I want to centralise the definitions of column as

    FORMAT of COLUMN TABLE_NAME A20 direction "foobar".
    ...

    keep in a centralized definition file and import into several Sqlplus scripts (executing).

    Is - it somehow possible?

    Peter

    Is - it somehow possible?

    Yes put all definitions of column in a single file, you say coldef.sql

    Whenever you need to use it in a script that is run with the help

    Start coldef.sql

    Max
    http://oracleitalia.WordPress.com

  • sqlplus formatting / set

    Hi all

    I am creating a report with the help of SQL * Plus and shell.

    I use a lot of a shell script sql script. In my report, output, k I still see the actual query:

    SQL > select * from v version $;

    BANNER

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

    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production

    PL/SQL Release 11.2.0.2.0 - Production

    CORE Production 11.2.0.2.0

    AMT for Linux: Version 11.2.0.2.0 - Production

    NLSRTL Version 11.2.0.2.0 - Production

    Is it possible to remove the query and get the result of the query in my report? What SET option would do that?

    I would really appreciate any suspicion!

    Thank you so much in advance!

    M

    Hello

    Have you tried SET POSITION OFF and SET ECHO OFF?

    Cat sql_test.sh:

    sqlplus-s $login<>

    Set serveroutput on

    trigger the echo

    set the position

    Select 'Testing' to double;

    output

    ++

  • Output of sqlplus formatting

    Oracle 11.1.0.7:

    I followed SQL. But when I run it it gives me all the SQL statements and other things. How can I get just the result of select?
    sqlplus stream_mon/stream_mon << EOF!
     set head off
     set pagesize 0
     set feed off
     set echo off
     spool ${MON_FILE} append
    
     SELECT APPLY_NAME || '|NoOfErrors=' || COUNT(*) FROM DBA_APPLY_ERROR group by APPLY_NAME;
    
     select APPLY_NAME || '|Latency=' ||
         (apply_time-applied_message_create_time)*86400
      from dba_apply_progress;
    
     select QUEUE_NAME || '|SrcSpillMsgs=' || spill_msgs || chr(10) || 'SrcInMemoryMsgs=' ||  (NUM_MSGS - SPILL_MSGS)
    from V\$BUFFERED_QUEUES;
    
    SELECT APPLY_NAME || '|DestSpilledTransactions=' || MESSAGE_COUNT
      FROM DBA_APPLY_SPILL_TXN;
    
    select APPLY_NAME || '|DestTotalMessagesSpilled=' || TOTAL_MESSAGES_SPILLED from V\$STREAMS_APPLY_READER;
    
    select case when status = 'ENABLED' then CAPTURE_NAME || '|CaptureProcess=1'
               else CAPTURE_NAME || '|CaptureProcess=0'
               end
          from dba_capture;
    
    select case when status = 'ENABLED' then PROPAGATION_NAME || '|PropProcess=1'
               else PROPAGATION_NAME || '|PropProcess=0'
               end
          from dba_propagation;
    
    select case when status = 'ENABLED' then APPLY_NAME || '|AppProcess=1'
               else APPLY_NAME || '|AppProcess=0'
               end
          from dba_apply;
    
     select CAPTURE_NAME || '|CaptureErrMsg=' || replace(error_message, ' ', '_') from dba_capture;
     select PROPAGATION_NAME || '|PropErrMsg='    || replace(error_message, ' ', '_') from dba_propagation;
     select APPLY_NAME || '|ApplyErrorMsg=' || replace(error_message, ' ', '_') from dba_apply;
    
     spool off
    
    EOF!
    Out something like this
    SQL>  select QUEUE_NAME || '|SrcSpillMsgs=' || spill_msgs || chr(10) || 'SrcInMemoryMsgs=' ||  (NUM_MSGS - SPILL_MSGS)
      2  from V$BUFFERED_QUEUES;
    CAP_QUEUE|SrcSpillMsgs=0 

    sqlplus stream_mon/stream_mon<>

    not above but below
    sqlplus-s stream_mon/stream_mon<>

  • SQLPLUS formatting

    I have the following SQL code

    Select file_name, bytes/1024/1024 * 80 of dba_data_files

    I want the output for each line look like this (remove the line breaks, tabs...)  Y at - it an easy way to do it. I know you can use single quotes

    around the literals

    ALTER database datafile '+ DATA01/da01fmd_imkl065d/datafile/dw_daily_acct_sum.8.820408375' resize 24576 M Note size must be an integer

    Thanks to all those who responded


    Thank you all. Frank your example was a syntax error, so I used the following which works perfectly for me.

    Select 'alter database datafile ' | ''''|| file_name | '''' || "resize".

    || TO_CHAR (trunc (bytes/1024/1024 * 0.8)) | ' m;'    from dba_data_files

  • Csv output SQLCL differs from output csv SQLPLUS

    Hello

    I try to replace my script sqlplus generating a csv file.

    with a new one generated by sqlcl because sqlcl seem to handle it "natively".

    However, I have several problems, it's not so easy... (it is not possible, in fact, as a replacement for sqlplus by sqlcl to generate a csv file)

    There are several differences with the release made with my script in sqlplus. Let me explain

    NB: Please note I'm french therefore:

    * default csv separator is; (but I could accept this separator is)

    * decimal separator is ",".

    Script from SQLplus

    trigger the echo

    Set feedback off

    fixed term off

    set point

    Go head

    the Embedded value on

    set pagesize 0

    break off Set

    NEWP NONE Set

    set SPACE 0

    TAB SET OFF

    recsep off Set

    left the underline

    COLUMN of resource_type FORMAT A10 COLUMN TYPEE

    ALTER session set nls_date_format = "dd/mm/yyyy";

    ALTER SESSION SET NLS_NUMERIC_CHARACTERS = ",";

    set LINESIZE 30000

    Set trimspool on

    Coil test.csv

    SELECT "'sysdate';'" COL1 "; "" COL2 "; "" LENGTH "' double.

    SELECT

    '"' || SYSDATE | « « ; » »

    '"' || trunc (sysdate) | « « ; » »

    || To_char (sysdate, ' DD/MM/YYYY HH24:MI:SS'). « « ; » »

    || RM. LENGTH | '"'

    Of

    TABLE RM

    WHERE

    RM. CODE = "ABCD";

    spool off

    output

    SQLCL script

    trigger the echo

    Set feedback off

    fixed term off

    set point

    break off Set

    Set trimspool on

    Set sqlformat csv

    Coil test2.csv

    SELECT

    SYSDATE,

    trunc (sysdate),

    To_char (sysdate, ' DD/MM/YYYY HH24:MI:SS'),

    RM. LENGTH

    Of

    TABLE RM

    WHERE

    RM. COL = 'ABCD '.

    ;

    spool off

    output

    SQLplus output CSV (and the result is correct)

    "sysdate"; "' COL1 '; "" COL2 "; "" LENGTH ".

    "11/05/2015"; 11/05/2015; "11/05/2015-11:11:27 '; "6.07"

    SQLCL CSV output

    < blank line >

    "SYSDATE", "TRUNC (SYSDATE)", "TO_CHAR (SYSDATE," DD/MM/YYYY HH24:MI:SS) ',' LENGTH' "

    05/11/15 11:12:12, 000000000, 05/11/15 00:00:00000000000, ' 11/05/2015 11:12:12 ', 6,07

    --------

    You can see in the output of SQL CL

    * an empty line first (?)

    * the fields sysdate is followed, 0000000, which breaks the structure of the csv file. Don't know why this is displayed.

    * value sysdate is fine (date + hour) in sqlcl, trunc (sysdate) should not display the time (minor)

    * in sqlplus then I've not used instructions ALTER SESSION SET NLS_NUMERIC_CHARACTERS = ",".

    digital data are 6.07 (whereas it should be 6.07, and default sqlplus output. (In sqlplus to 6.07, I need to put the NLS_NUMERIC statement above))

    * in sqlplus, only char data are placed in square brackets. In my case it would be necessary to have each data attached to make sure that imposing CSV is safe.

    If too many problems, I can't currently use sqlcl to generate a csv result...

    Don (don't know if this is the place to talk about SQL imporvement, , but it would be great if the sqlcl could be improved: )

    * the date of issue (000000) would be fixed (unless there is a solution?)

    * Digital output default must be with '.'. And after having the opportunity to change the decimal separator, as in SQLPLUS

    * We wouldn't abilty to choose whether the data should be included or not in the media (even for digital data / date)

    * We would be able to change the csv separator

    * no first blank line ould generated (minor)

    Thanks for any suggestions you could provide, because at the moment, I can't use sqlcl to the output in csv format, although it has very promising output features

    > We are working on support for that now.

    What I wanted, it was, it does not work in the latest version available, but work soon.

  • NLS_DATE_FORMAT in PLSQL Developer differ from sqlplus

    Hello

    When you set the nls_date_format sqlplus at the session level, the results are as expected.Capture.JPG

    Whereas, when you set the second level nls_date_format in PL/SQl developer, output the same format in both cases.

    Capture1.JPG

    help kindly on even...

    Thank you to make clear... just ask out of curiosity, is possible for my session I modified my NLS_DATE_FORMAT and always the system reflecting the NLS_DATE_FORMAT substituted by the client software...

    Means for my session how is it possible that without good privileges Client software replaces the format...

    Why do you think that the output that you see in a GUI such as PLSQL Developer is determined by NLS session parameters? When the result set contains a date, then the proponent of the product is free to decide if it is displayed after the session or some settings settings in the tool preferences.

    SELECT SYSDATE FROM dual;

    ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD ";

    SELECT SYSDATE FROM dual;

    When I run the present into a toad, I get two different formats for the last statement in the manner which I run it:

    F9 (run the statement): 10:26:08 09/01/2015

    F5 (Exceute as a script): 2015-09-01

    If the toad ignores the parameter when the developer thought that I don't know what I really want.

    The same executions in SQL Developer shows 2015-09-01 both times. Here, the designer would think "Hey the user is a developer, that he or she will know what to do" or the designer has not thought to the problem and simply used the session settings.

    Concerning

    Marcus

  • Get the domain FULL of SQLPLUS connect_identifier

    Hello!  I'm all new to Oracle.  I have a previous developer files that contain SQLPLUS commands.  I noticed that the format of the CONNECT subcommand is:

    username/password[@connect_identifier]

    I have something like:

    SQLPLUS foo/bar@fum

    What should I do to solve the 'MED' connect_identifier to a fully qualified domain name?

    Look in your tnsnames.ora file, or do a 'WUF tnsping"("fum"seems to be your login).

  • Export to HTML format with text "preformatted"?

    Hello

    I have a column varchar2 with contains carriage returns.  I want to run my query in SQL Developer and 'export' the results in HTML format.  But when I do, the data in the column lost things like several spaces and returns the cart.  That's why I want to mainly export the column with the < PRE >... < / PRE > html tags.  Any way to do this from SQL Developer?

    Example of table in sqlplus:

    SQL> create table my_demo (MY_TEXT varchar2(255));
    
    Table created.
    
    SQL> insert into my_demo values ('Hello'||CHR(10)||'   World');
    
    1 row created.
    
    SQL> select * from my_demo;
    
    MY_TEXT
    -----------------------------------------------------------------
    Hello
       World
    
    
    SQL> 
    

    So what I want is the MY_TEXT column in the HTML export file to show the world "Hello" above indented it word 'World', just like we see in SQLPlus (my actual query is obviously much more complex).  If I try to select the column with string literals '< PRE >' and ' < / PRE > ' around the column MY_TEXT it does not work and indicates those string and not as HTML tags.

    In SQL, we can use "COLUMN".... ENTMAP OFF"- but who does not work in SQL Developer.  Similarly, I don't see how the / * fixed * / index of the SQL Developer will help me.

    Suggestions?  An option may be missing me?

    Thank you.

    I suppose the best solution that I could do was modify the query for:

    Select '

    '||my_text||'
    "from my_demo;

    Then export it to HTML format.  Then open it with my favorite text editor and make the following replacements:

    < PRE >--->

    </PRE>    --->   

    Save my raw HTML code after manually making the substitution with the text editor and now I have the registered page displays properly as I want it.

    While work work - around, I was just hoping that there was a better solution that does not need me manually change the HTML in a text editor.

  • How to get sqlplus not to use the output of size documents fixed?

    I want to generate the sql code to clear all data in tables in the database of flat files, one file per table, one row per record.  I thought I'd try to use the ascii code for characters inherited 31 as a delimiter to separate the fields and start sqlplus. But a problem is how do you get to specify linesize? Are there not a way to get out of creating fixed size records in sqlplus? I would prefer each line to just be so great that it must be rather than set the linesize being the absolute maximum. (32767) or understand what the maximum size is on a per-table basis.

    Is it possible to do?

    What I've tried so far (so I would have executed him each resulting sort script d30_x.) OK but how to get rid of this thing linesize?

    / * create dump file using US 31 to separate the fields * /.

    wrap off Set

    Set linesize

    Set feedback off

    set pagesize 0

    set verify off

    UNDEF tab;

    set myfile = d30_ & & tab... SQL;

    is prompt myfile and myfile;

    coil & myfile

    Guest set linesize 2500

    Guest set pagesize 0

    Guest departed wrap

    quick game check out

    Quick spool & tab... LST

    Select guest of

    Select lower (column_name) |' | Chr (31)

    ||'
    of user_tab_columns
    where table_name = upper ('& tab') and
    column_id! = (select max (column_id) in the user_tab_columns where)
    table_name = upper ('& tab'))
    order of column_id
    /
    Select lower (column_name)
    of user_tab_columns
    where table_name = upper ('& tab') and
    column_id = (select max (column_id) in the user_tab_columns where)
    table_name = upper ('& tab'))
    order of column_id
    /
    from guest & tab
    Guest /.

    prompt off spool
    spool off

    Wait, I think it works!  Tell him to use the maximum linesize, then

    tell him to get rid of these spaces.

    OOPS I forgot something. A problem with this is that if there are embedded newlines \r \n one of those or both in a field, then this format that uses the newline to indicate the end of the recording is toast. And I know that they are inclined to do this. (Users can not live with them, can't live without 'em). More on that later.

    / * create dump file using US 31 to separate the fields * /.
    wrap off Set
    Set feedback off

    set linesize 150
    set pagesize 0
    set verify off

    UNDEF tab;

    set myfile = d30_ & tab... SQL;
    prompt myfile is &myfile;

    coil & myfile
    Guest set pagesize 0
    Guest departed wrap
    quick game check out
    prompt value trimspool on
    Guest trimout value on
    Guest set linesize 32767
    fast coil & tab... LST

    Select guest of
    Select lower (column_name) |' | Chr (31) | »
    of user_tab_columns
    where table_name = upper ('& tab') and
    column_id! = (select max (column_id) in the user_tab_columns where)
    table_name = upper ('& tab'))
    order of column_id
    /
    Select lower (column_name)
    of user_tab_columns
    where table_name = upper ('& tab') and
    column_id = (select max (column_id) in the user_tab_columns where)
    table_name = upper ('& tab'))
    order of column_id
    /
    Guest of & tab
    Guest /.

    prompt off spool
    spool off

    Post edited by: Lake

  • number format

    Hello

    on 10.2.0.4

    I treid the suite, but not an explicit display of

    SQL > select file #, status, checkpoint_change # from v$ datafile, whose name like '% SYS % ';

    STATUS # CHECKPOINT_CHANGE #.

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

    1 1.9475E + 12 SYSTEM

    3. RECOVER 1.9475E + 12

    17 RETRIEVE 1.9475E + 12

    18 RETRIEVE 1.9475E + 12

    SQL > select file #, status, TO_CHAR (checkpoint_change #, '$99 990,99') v $ datafile where name like '%sys% ';

    STATUS # TO_CHAR (CHE

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

    1 SYSTEM #.

    RECOVER 3 #.

    RECOVER 17 #.

    RECOVER 18 #.

    SQL > select file #, status, TO_CHAR (checkpoint_change #, '99999990.000') of v$ datafile whose name like '% SYS % ';

    FOLDER # TO_CHAR (CHECK STATUS

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

    1 SYSTEM #.

    RECOVER 3 #.

    RECOVER 17 #.

    RECOVER 18 #.

    SQL > select file #, status, TO_CHAR (checkpoint_change #, '9999,9990.000') of v$ datafile whose name like '% SYS % ';

    FOLDER # TO_CHAR (HOSTING STATUS

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

    1 SYSTEM #.

    RECOVER 3 #.

    RECOVER 17 #.

    Can you help me please?

    Thank you.

    Checkpoint_change # is probably a number with more digits that you specified in the format.  You must specify a larger format (more numbers). Note: There is zero decimals, so you don't need to specify decimals.

    In sqlplus, you can also generically set numwdith 'N NUMLARGEUR SET' - for example "SET NUMLARGEUR 32" to allow up to 32 digits digital display.  Then, you need not specify a format for the column.

    Hemant K Collette

Maybe you are looking for

  • Mac Pro early 2008 OS 10.6.8 at 10.11 on a new SSD upgrade

    Hi all! I want to spend my Mac Pro hard drive to an SSD with a new installation of El Capitan, but I also want to continue to use Adobe CS3 (I can't afford a new version... > _ <).  I read that some people have a lot of problems after upgrading their

  • By clicking on the link does not open new tab

    By clicking on a link in an e-mail message (MAC Mail) open FF and directly to the page, if Firefox is closed. Fine.However, if FF is already running, by clicking on the link only FF put in the foreground, but does not open a new tab, or the link fill

  • Clone Stock HDD to new 850 EVO Pro - T440s

    Hi all I was wondering if there is a good tutorial somewhere on the right sequence of steps to successfully clone my HDD to the SSD Pro 850. I'm more curious about what had to be done before, during or after the process of cloning (AHCI?) the bios se

  • M92p (3227-BL8) BIOS download session is missing

    Hello I can't find the download BIOS on the download list session! In the past it was exist but cannot now visible that's why I can't download it. Please check!

  • Single virtual channel with several digital ports

    Hi all I created a program that creates a task to read continuously for 3 lines of digital channels in the same unit (PXI-6133). I'm trying to figure out how I can retrieve the data from each row of port to be in a waveform graph. Currently, I use DA