set linesize에 대한 질문입니다. 0 7 4,049

by 하혜진 [2008.06.04 21:27:01]


이 명령어로 sql*plus에서 더 편하게 볼 수 있는 건 알고 있습니다.

그런데 창을 닫으면 또 매번 그렇게

set linesize 120;

이런식으로 지정하는 방법밖에 없는지 해서요

영구적으로 linesize를 바꾸려면 어떻게 해야하는지 좀 알려주세요~ ^^

고수님들의 가르침을 +ㅁ+ 기다리고 있겠습니다. ^^

보기 좋게 하는 다른 프로그램들을 까는 방법밖에 없는건가 해서..

질문을 올려요 ^^

 

 

by 장태길 [2008.06.04 21:56:12]
예전 자료 퍼왔습니다.
Sql plus 환경 구성 ORACLE



디폴트로 Current Path 및 Oracle 환경 변수 Path 디렉토리 내에서

login.sql 이 존재 하는지 서치 되고, 존재시 sql plus 에 대한 환경을

자동으로 loading 하게 된다.

간편하게는 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?"

select
sys_context('USERENV','IP_Address',15) ipaddr,
sys_context('USERENV','HOST',16) host,
sys_context('USERENV','NETWORK_PROTOCOL',8) netprtc,
sys_context('USERENV','CURRENT_USER',8) curruser,
sys_context('USERENV','CURRENT_SCHEMA',8) currschema,
sys_context('USERENV','FG_JOB_ID',4) fgjob,
sys_context('USERENV','BG_JOB_ID',4) bgjob
from dual ;

################################################################################
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.

########################################################################


by 현 [2008.06.05 06:54:53]
우와...태길님..좋은 자료 감사합니다.

by 장태길 [2008.06.05 08:08:57]
현석이 형님 왜그러세요 ㅇ_ㅇ;;
부끄럽게 ㅇ_ㅇ;
이르지만
좋은 연휴 보내세요 ^^*

by 된장 [2008.06.05 08:51:26]
ㅎㅎㅎ ^^

by 이지웅 [2008.06.05 09:49:18]
좋은 자료네요.. 잘쓰겠습니다~ ㅋ

by 하혜진 [2008.06.05 18:59:24]
일단 답변 감사합니다. ^^
다들 좋은정보라 하는데
음.. 그런데.. 뭐 어떻게 하는건데요 전 초보자라 모르겠어요 ㅜㅜ
파일을 검색해서 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() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입