간편하게는 glogin.sql 을 편집하는게 가장 편하나, sqlplus 시에 모든 적용 되기
때문에 login.sql 을 주로 사용하도록 하자 !! [ 작업 디렉토리를 활용, No Path 이용 ]
################################################################################
more login.sql
set linesize 150
set pagesize 180
set serveroutput on
set head off
rem select '현재 접속한 Database는 '||upper(name)||'입니다.' from v$database ;
select '현재 접속한 Database는 '||sys_context('USERENV','DB_NAME')||'입니다.' from dual ;
select '당신의 IP와 사용PC는 '||sys_context('USERENV','IP_ADDRESS')||'
'||sys_context('USERENV','HOST')||'입니다.' from dual ;
show user
set heading on
column ipaddr format a15 heading "IP 주소"
column host format a20 heading "호스트"
column netprtc format a8 heading "네트워크|프로토콜"
column curruser format a8 heading "현재|유저"
column fgjob format a4 heading "FG|Job?"
column bgjob format a4 heading "BG|Job?"
################################################################################
more login.sql
define _editor=vi
set serveroutput on size 1000000
set trimspool on
set long 5000
set linesize 100
set pagesize 9999
column plan_plus_exp format a80
column global_name new_value tggname
column username new_value uname
set termout off
select global_name from global_name ;
select user username from dual ;
set sqlprompt '&uname@&tggname>'
set termout on
alter session set nls_Date_format ='YYYY.MM.DD hh24:mi:ss';
################################################################################
계속해서 login.sql 을 적용 하려면
같은 디렉토리 내에 아래 화일을 생성한다.
more connect.sql
set termout off
connect &1
@login
set termout on
################################################################################
참고 glogin.sql
more /app/oracle/product/10.1.0/sqlplus/admin/glogin.sql
--
-- Copyright (c) 1988, 2003, Oracle Corporation. All Rights Reserved.
--
-- NAME
-- glogin.sql
--
-- DESCRIPTION
-- SQL*Plus global login "site profile" file
--
-- Add any SQL*Plus commands here that are to be executed when a
-- user starts SQL*Plus, or uses the SQL*Plus CONNECT command
--
-- USAGE
-- This script is automatically run
--
-- Used by Trusted Oracle
COLUMN ROWLABEL FORMAT A15
-- Used for the SHOW ERRORS command
COLUMN LINE/COL FORMAT A8
COLUMN ERROR FORMAT A65 WORD_WRAPPED
-- Used for the SHOW SGA command
COLUMN name_col_plus_show_sga FORMAT a24
COLUMN units_col_plus_show_sga FORMAT a15
-- Defaults for SHOW PARAMETERS
COLUMN name_col_plus_show_param FORMAT a36 HEADING NAME
COLUMN value_col_plus_show_param FORMAT a30 HEADING VALUE
-- Defaults for SHOW RECYCLEBIN
COLUMN origname_plus_show_recyc FORMAT a16 HEADING 'ORIGINAL NAME'
COLUMN objectname_plus_show_recyc FORMAT a30 HEADING 'RECYCLEBIN NAME'
COLUMN objtype_plus_show_recyc FORMAT a12 HEADING 'OBJECT TYPE'
COLUMN droptime_plus_show_recyc FORMAT a19 HEADING 'DROP TIME'
-- Defaults for SET AUTOTRACE EXPLAIN report
COLUMN id_plus_exp FORMAT 990 HEADING i
COLUMN parent_id_plus_exp FORMAT 990 HEADING p
COLUMN plan_plus_exp FORMAT a60
COLUMN object_node_plus_exp FORMAT a8
COLUMN other_tag_plus_exp FORMAT a29
COLUMN other_plus_exp FORMAT a44
SQLPLUS EDIT 설정
## Unix 에서
-- edit by dba
more /app/oracle/product/8.1.7/sqlplus/admin/glogin.sql
define _editor=vi
-- edit by developer
작업 directory 내에 login.sql 을 생성 후
define _editor=vi
## NT 에서
editor
1. To change the editor for a single SQL*Plus session, type:
SQL>DEFINE_EDITOR=<path and name of the editor of your choice>
EXAMPLE:
SQL>DEFINE_EDITOR=D:\WINNT\SYSTEM32\EDIT;
2. To make a permanent change to the default editor, edit the GLOGIN.SQL
file. The file is located in the \ORACLE_HOME\PLUS33 or ORACLE_HOME\PLUS80
directory.
Add a line to the file:
DEFINE_EDITOR=<path and name of the editor of your choice>
Save the changes to the glogin.sql file, and each time you open SQL*Plus,
the editor will be the one you defined.
The _EDITOR has not been set to be your desired editor. If _EDITOR is
undefined, EDIT attempts to invoke the default host operating
system editor.
일단 답변 감사합니다. ^^
다들 좋은정보라 하는데
음.. 그런데.. 뭐 어떻게 하는건데요 전 초보자라 모르겠어요 ㅜㅜ
파일을 검색해서 glogin.sql 이게 있는건 알겠는데요
login.sql은 만들어서 추가하라는 말인가요?
by 장태길
[2008.06.05 22:05:34]
SQL*PLUS 를 실행 하는 PATH
즉 TELNET 으로 서버 접속 후
CD PATH 하신다면
PATH 이동후 그 해당 디렉토리에
login.sql
을 생성 합니다.
화일 내용은 원하는 환경 설정을 넣어주시면
SQL*PLUS 실행 시마다 실행 하시는 디렉토리에서
LOGIN.SQL 을 로드 후 자동 실행 합니다.
댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.