반응형

 

목차

    1. 테스트 환경 

    <Oracle Restart Single>

    OS : Oracle Linux Server 7.9 (Linux rdb01d 5.4.17-2102.201.3.el7uek.x86_64)
    DB : Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production (Version 19.26.0.0.0)
    Host : tdb01t(192.168.0.51) 

    DB : ORCL

    Instance : ORCL

    2. glogin.sql 파일 조회

    [ORCL:oracle@tdb01t][/home/oracle]$ echo $ORACLE_HOME
    /u01/app/oracle/product/19c/db_1
    
    [ORCL:oracle@tdb01t][/home/oracle]$ cat $ORACLE_HOME/sqlplus/admin/glogin.sql
    --
    -- Copyright (c) 1988, 2005, Oracle.  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
    --

    sql*plus로 접속 시 해당 파일의 내용을 자동으로 실행하게됨 

    3. glogin.sql 파일 수정 

    [ORCL:oracle@tdb01t][/home/oracle]$ vi $ORACLE_HOME/sqlplus/admin/glogin.sql
    [ORCL:oracle@tdb01t][/home/oracle]$ cat $ORACLE_HOME/sqlplus/admin/glogin.sql
    --
    -- Copyright (c) 1988, 2005, Oracle.  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
    --
    SET TIMING OFF
    SET HEADING OFF
    SET FEEDBACK OFF
    SET TIMING OFF
    SET TERM OFF
    COLUMN HOSTNAME NEW_VALUE _HOSTNAME
    COLUMN CON_NAME NEW_VALUE _CON_NAME
    SELECT SYS_CONTEXT('USERENV', 'HOST') AS HOSTNAME FROM DUAL;
    SET SQLPROMPT '[&_DATE][&_HOSTNAME]<&_CONNECT_IDENTIFIER@&_USER.> '
    SET TIMING ON
    SET TERMOUT ON
    SET SERVEROUTPUT ON
    SET NULL "(NULL)"
    SET FEED ON
    SET LINES 200
    SET PAGES 100
    SET HEADING ON
    SET FEEDBACK ON
    SET TERM ON

     

    현재 일시, 호스트명, 인스턴스명, 접속한사용자의 정보를 출력하게됨

    4. sqlplus로 접속

    [ORCL:oracle@tdb01t][/home/oracle]$ sqlplus "/as sysdba"
    
    SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jun 15 21:52:36 2025
    Version 19.26.0.0.0
    
    Copyright (c) 1982, 2024, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
    Version 19.26.0.0.0
    
    [2025-06-15:21:52:36][tdb01t]<ORCL@SYS>

    위와 같이 출력하게 됨 

     

    단, DB작업 시 해당 glogin.sql 설정이 되어 있어 성공하지 못하는 작업이 있을 수 있음 

    그럴 경우를 대비하여 DB작업 전 아래와 같이 glogin.sql 파일을 백업 시킴 

    mv /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql.bak

    작업이 완료 된 후 아래와 같이 원상 복구 시키면됨 

    mv /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql.bak /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql

     

     

    반응형

    + Recent posts