Oracle登入指令碼

Michael_DD發表於2015-01-15
Oracle登入指令碼



點選(此處)摺疊或開啟

  1. REM turn off the terminal output - make it so SQLPlus does not
  2. REM print out anything when we log in
  3. set termout off
  4.   
  5. REM default your editor here. SQLPlus has many individual settings
  6. REM This is one of the most important ones
  7. define _editor=vi
  8.   
  9. REM serveroutput controls whether your DBMS_OUTPUT.PUT_LINE calls
  10. REM go into the bit bucket (serveroutput off) or get displayed
  11. REM on screen. I always want serveroutput set on and as big
  12. REM as possible - this does that. The format wrapped elements
  13. REM causes SQLPlus to preserve leading whitespace - very useful
  14. set serveroutput on size 1000000 format wrapped
  15.   
  16. REM Here I set some default column widths for commonly queried
  17. REM columns - columns I find myself setting frequently, day after day
  18. column object_name format a30
  19. column segment_name format a30
  20. column file_name format a40
  21. column name format a30
  22. column file_name format a30
  23. column what format a30 word_wrapped
  24. column plan_plus_exp format a100
  25.   
  26. REM by default, a spool file is a fixed width file with lots of
  27. REM trailing blanks. Trimspool removes these trailing blanks
  28. REM making the spool file significantly smaller
  29. set trimspool on
  30.   
  31. REM LONG controls how much of a LONG or CLOB sqlplus displays
  32. REM by default. It defaults to 80 characters which in general
  33. REM is far too small. I use the first 5000 characters by default
  34. Set long 5000
  35.   
  36. REM This sets the default width at which sqlplus wraps output.
  37. REM I use a telnet client that can go upto 200 characters wide -
  38. REM hence this is my preferred setting.
  39. set linesize 200
  40.   
  41. REM SQLplus will print column headings every N lines of output
  42. REM this defaults to 14 lines. I find that they just clutter my
  43. REM screen so this setting effectively disables them for all
  44. REM intents and purposes - except for the first page of course
  45. set pagesize 9999
  46.   
  47. REM MY SQL_NAME , it different from tom ,it prefer to hostname/username@database
  48. REM here is how I set my signature prompt in sqlplus to
  49. REM username@database> I use the NEW_VALUE concept to format
  50. REM a nice prompt string that defaults to IDLE (useful for those
  51. REM of you that use sqlplus to startup their databases - the
  52. REM prompt will default to idle> if your database isn\'t started)
  53. define gname=idle
  54. column global_name new_value gname
  55. select sys_context(\'userenv\', \'host\')||\'/\'||lower(user) || \'@\' ||
  56.        substr( global_name, 1, decode( dot,
  57.                                        0, length(global_name),
  58.                                           dot-1) ) global_name
  59.   from (select global_name, instr(global_name,\'.\') dot
  60.           from global_name );
  61. set sqlprompt \'&gname> \'
  62. REM and lastly, we\'ll put termout back on so sqlplus prints
  63. REM to the screen
  64. set termout on

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29500582/viewspace-1403179/,如需轉載,請註明出處,否則將追究法律責任。

相關文章