DISQUS

Eddie Awad’s Blog: Oracle SQLPlus

  • Robert Vollman · 4 years ago
    Great article! It works!

    I put mine in glogin.sql.

    Related links:

    Jonathan Lewis' and his FAQ:
    http://www.jlcomp.demon.co.uk/faq/sqlplus_promp...

    Oracle SQL*Plus FAQ:
    http://www.orafaq.com/faqplus.htm

    Also, "Setting Up" (Chapter 0) from Tom Kyte's "Expert One-on-One Oracle" and, naturally, the SQL*Plus User's Guide and Reference, available from here:
    http://www.oracle.com/technology/documentation/...
  • Eddie Awad · 4 years ago
    Great links as usual. Thanks Robert.
  • Alex Nuijten · 4 years ago
    In 10g, it gets even easier:

    set sqlprompt `'_user@_connect_identifier > '`

    SQL*Plus Command Reference
  • Eddie Awad · 4 years ago
    Thanks for the tip Alex. Another reason to upgrade to 10g :)
  • Sumi · 3 years ago

    Hi


    I am tring to insert bulk sql statements from syslog-ng into oracle and I find there are more thn 50% lose.


    syslog daemon writes "insert statements" to a FIFO pipe, from this pipe another daemon attempts to push insert statements to sqlplus CLI.


    syslog-ng daemon config


    writes to FIFO pipe /var/run/ora.pipe


    destination d_oracle {
    pipe("/var/run/ora.pipe"
    template("ALTER SESSION SET SQL_TRACE = true;\nINSERT INTO syslogentry (hostname, facility, SEVERITY, MSG_SENT_TIME,p
    rogram, message,MSG_RCV_TIME) VALUES ( '$HOST','$FACILITY', '$PRIORITY', to_date('$MONTH $DAY$ $YEAR $HOUR:$MIN:$SEC', 'mm dd
    yyyy hh24:mi:ss'), '$PROGRAM', '$MSGONLY',SYSTIMESTAMP);\ncommit;\n") template-escape(yes));
    };


    we have tried to compare number of event (insert statements) coming on this pipe by writing another script that writes to file.


    pipe to db script



    !/bin/sh

    nohup sqlplus user/pass < /var/run/ora.pipe >> /home/oracle/log.err


    pipe to file script



    !/bin/sh

    nohup cat /var/run/ora.pipe > /logs/debug.log


    number of events in files are almost 10 times more than going in db within a given time slot.


    can any one help me ?


    Regards
    Sumit

  • Pradeep · 2 years ago

    Is it possible to add color to the prompt?


    I want different color's for different environments that I use sqlplus on to distinguish them a bit and also add a bit of color to the whole black and white shell.


    I tried using control characters that work on the OS I'm using but they get simply printed as is.


    Anyone know a wrapper that I can use?

  • Eddie Awad · 2 years ago

    Pradeep, this is the first time I've ever heard that you can even have a colorful SQLPlus prompt! I do question the need for color though. That won't work well with color blind people.

  • kinzlaw · 2 years ago

    Pradeep, yes I got colors in sqlplus. It's done via vi's Ctrl-v to write the escape sequences to the login.sql, and also, the escape sequence is supported by xterm, which is what I use putty to connect to a Linux box(I guess on Windows it would be a different way to do it or just can't be done). My sqlprompt variable looks like this:
    ^[[32;47m&_user@&_connect_identifier^[[30m>^[[0;49m
    Copy & paste won't work, you should use vi or other editor which is capable of inputing escape sequences instead to get the '^['s to the file.

  • acomplia · 1 year ago
    How to turn on colors?
  • FARIZA · 1 year ago
    May i ask about Views in Oracle in this forum?

    thank you
    -fariza-
  • Eddie Awad · 1 year ago
    FARIZA, You can. However, I suggest you use http://forums.oracle.com
  • Partha · 1 year ago
    Wonderful, colors worked! Good great tipe! Thanks.
    But also I needed the host name to be in my prompt. Any help is greatly appreciated.
    thanks
    Partha