database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
ㆍOracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
Oracle Tutorials 8858 게시물 읽기
 News | Q&A | Columns | Tutorials | Devel | Files | Links
No. 8858
Oracle 8 - Network Administration
작성자
정재익(advance)
작성일
2001-12-12 22:26
조회수
12,051

01. 네트워킹 개요 (Networking Overview)]

 

 - ORACLE_HOME, ORACLE_SID 환경변수 확인
   $ env | grep ORA

 - TNS_ADMIN 환경변수 확인
   $ env | grep TNS 

[b]Network Configurations[/b]

 - Two-Tier
   : Client ---- Server

 - N-Tier
   : Client ---- Middle Tier --- Server

  * Middle Tier 가 하는일
    - Translation services
    - Scalability services
    - Intelligent agent services

[b]네트워크 환경을 구성하려고 할 때 고려해야 할 사항들[/b]

 - Configuring the Network Environment
      - network 환경은 어떠한가?
      - single protocol 또는 multi protocol을 사용하는가?
      - network이 증설될 가능성이 있는가?
      - configuration option은 무엇인가?
      - network 환경을 설정하기 위한 tool을 사용하는가?

 - Maintaining the Network
      - network 유지보수 요구는 어떠한가?
      - client와 server가 추가될 것인가?
      - upgrade가 종종 발생하는가?


 - Tuning, Troubleshooting, and Monitoring the Network
      - network에 필요한 tool들을 갖고 있는가?
      - workload(user수, transaction수, node수, node위치)는 어떠한가?


 - Implementing Sequrity in the Network


 - Integrating Legacy Systems

[b]Oracle's Solution[/b]

 - Net8
      - Protocol independence
      - Comprehensive platform support
      - Integrated GUI administration tools (OEM)
      - Multiple configuration options
      - Tracing and diagnostic toolset
      - Open API
      - Basic Security

 - Oracle Names
      - Centralized configuration
      - Simplified network administration
      - Client profile information

 - Connection Manager
      - Multiplexing of connections
      - Cross Protocol Connectivity
      - Network Access Control

 - Advanced Networking Option
      - Network security using encryption
      - Integration with 3rd party Security Servers
      - DCE integration (Needs Checking)

 - Security Server
      - A framework for security and single sign-on
      - Authentication and authorization of users, web servers, and servers
      - Management of users' identities and privileges
      - Authentication and authorization using cryptography

 - Open Gateway
      - Transparent gateways
      - Procedural gateways

 

02. 기본 Net8 의 구조 (Basic Net8 Architecture)

 

[b]Client - Server 간의 통신을 위한 파일명과 위치는 아래와 같다.[/b]

   Server : $ORACLE_HOME/network/admin/listener.ora

   Client : C:\ORANT\net80\admin\tnsnames.ora
              C:\ORANT\net80\admin\sqlnet.ora   <-- client profile

   * TNS_ADMIN = $ORACLE_HOME/network/adimin 이라는 parameter는 .profile에 있다.

[b]Net8 architecture[/b]

   --------------------------------------------------
   Client                                        Server
   --------------------------------------------------
   Application              <------>   Server
   OCI                        <------>   OPI
   Two Task Common  <------>   Two Task Common
   TNS                       <------>   TNS
   OPA                       <------>   OPA
   Protocol                 <------>   Protocol
   --------------------------------------------------

[b]Client 쪽에서 본 Layers[/b]

 - Application (User Interface) Layer
      - Character/GUI
      - Data presentation
      - application specifics
      - Identification of database operations

 - OCI(Oracle Call Interface) or UPI(User Program Interface) Layer
      - Defines server calls
      - Parses SQL statements
      - Opens cursors
      - Binds variables
      - Executes SQL
      - Fetches data
      - Closes Cursors

 - Two Task common Layer
      - Datatypes conversion
      - character set conversion

 - TNS(Transparent Network Substrate) Layer : NI, NR, NN, NS main, NS 2nd, NA 등의 sub layer를 갖고 있다.
      - Provides generic interface to industry standard protocols
      - consists of more Net8 specific layers
      
      * NI(Networking Interface) Layer
        - Provides a generic interface to access Net8 functions
        - Resolves connect descriptors to connect strings
        - Handles Break and Reset requests
        
      * NR(Network Routing) Layer
        - Routes information from client to destination
        
      * NN(Network Naming) Layer
        - Resolves network aliases to destination address
        
      * NA(Network Authentication) Layer
        - Negotiates authentication with destination
        
      * NS(Network Session) Layer
        - Handles connect handshake and negotiation
        - Buffer management
        - Handles connection pooling and multiplexing

 - OPA(Oracle Protocol Adapter) Layer
      - Maps TNS generic calls to protocol-Specific calls
      - Includes NT layers that handle transport

 - Protocol
      - Existing Network protocol for machine level connectivity

[b]Server 쪽에서 본 Layers (OPI, Server layer를 제외하고 나머진 client와 동일함.)[/b]

 - OPI(Oracle Program Interface) Layer
      - Responds to each OCI call made by the client side

 - Server Layer
      - Responsible for receiving OCI calls from the client and resolving SQL statements
        on behalf of the client

[b]Server - Server Networking 시엔 NPI Layer가 필요함.[/b]

  NPI(Network Program Interface) Layer
   - Server-specific version of OCI
   - Enables coordinating server to construct SQL requests for other servers

 

03. 기본 Net8 서버측 설정 (Basic Net8 Server-Side Configurations)

 

[b]1. Steps in a Bequeath Session[/b]

 - A client connects to the listener with the network address.
 - The listener receives the session request, and determines if the client's request may be serviced.
    If not, the listener refuses the session and then continues listening.
 - The listener spawns a new dedicated server process to serve the incoming session.
 - The listener bequeaths the session to that server process.
 - Once the session is established, data flows directly between the client and dedicated server process.
 - The listener continues listening for incoming sessions.

[b]Steps in a Redirect Session(Prespawned Dedicated Server Process)[/b]

 - The listener spawns a series of dedicated server processes when it is stated.
 - A client connects to the listener with the network address.
 - The listener receives the session request, and determines if the client's request may be serviced.
    If not, the listener refuses the session and then continues listening.
 - The listener issues a Redirect message to the client containing the network address of one of the prespawned servers.
 - The client disconnects from the listener, and connects to the prespawned address given by the listener.
 - Once the session is established, the listener spawns another server to replace the one used by the client.

[b]Steps in a Redirect Session (Dispatcher Server process)[/b]

 - When a database instance is started, dispatchers are started according to the configuration parameters defined in the configuration file.(init.ora)
 - The address of each dispatcher is then is registered with the listener.
 - A client connects to the listener with the network address.
 - The listener receives the session request, and determines if the client's request may be serviced.
     If not, the listener refuses the session and then continues listening.
 - The listener issues a redirect message to the client containing the network address of the least-used dispatcher for the multithreaded server.
 - The client disconnects from the listener and connects to the dispatcher address given by the listener.
 - The dispatcher updates the listener with the new load value. The listener continues listening for incoming sessions.

[b]LISTENER.ORA File[/b]

 Default value
   - listener name  : LISTENER
   - Port               : 1521
   - Protocols       : TCP/IP and IPC
   - SID name       : default database
   - Hostname      : Default hostname

   -- listener.ora -- 

  LISTENER =
  (ADDRESS_LIST =
        (ADDRESS = 
          (PROTOCOL = TCP)
          (Host = st)
          (Port = 1521)
        )
        (ADDRESS = 
          (PROTOCOL = TCP)
          (Host = 127.0.0.1)
          (Port = 1521)
        )
#        (ADDRESS = 
#          (PROTOCOL = SPX)
#          (Service = st_lsnr)
#        )
  )
STARTUP_WAIT_TIME_LISTENER = 0
CONNECT_TIMEOUT_LISTENER = 10
TRACE_LEVEL_LISTENER = ADMIN
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = st)
      (SID_NAME = ORCL)
    )
    (SID_DESC =
      (SID_NAME = extproc)
      (PROGRAM=extproc)
    )
  )
 

[b]listener.ora file parameters[/b]

[b]Parameter [/b]
 Desciption
 
[b]CONNECT_TIMEOUT_listener_name[/b]
 Sets the number of seconds that the listener waits to get a valid database query after the session has started.
 
[b]LISTENER_address[/b]
 Defines the listening addresses for the listener.
 
[b]LOG_DIRECTORY_listener_name[/b]
 Controls the directory where the log file is written.
 
[b]LOG_FILE_listener_name[/b]
 Specifies the filename to which the log information is written.
 
[b]LOGGING_listener_name[/b]
 By default, logging is always on unless you provide this parameter and turn logging off.
 
[b]PASSWORDS_listener_name[/b]
 Specifies a password to perform certain DBA tasks against the listener using the LSNRCTL command.
 
[b]SAVE_CONFIG_ON_STOP_listener_name[/b]
 Any changes made by the LSNRCTL SET command are made permanent if the parameter is set to TRUE.
 
[b]SERVIE_LIST_listener_name[/b]
 Defines the service served by the listener. This is the same as the SID_LIST, made more generic for non-database servers.
 
[b]SID_LIST_listener_name[/b]
 Defines the SID of the databases served by the listener.
 
[b]STARTUP_WAIT_TIME_listener_name[/b]
 Sets the number of seconds that the listener sleeps before responding to the first LSNRCTL STATUS command. This assures that a listener with a slow protocol will have time to start up before responding to a status request.
 
[b]TRACE_DERECTORY_listener_name[/b]
 Controls the destination directory of the trace file.
 
[b]TRACE_FILE_listener_name[/b]
 Controls the name of the listener trace file.
 
[b]TRACE_LEVEL_listener_name[/b]
 Turns tracing on or off to a specified level.
 
[b]USE_PLUG_AND_PLAY_listener_name[/b]
 Instructs the listener to register with a well-known names server. Will continue to look for a well-known names server until one is found.
 

[b]LSNRCTL -- Listener Control Utility[/b]

   $ lsnrctl start [listener_name]

   $ lsnrctl stop [listener_name]

[b]LSNRCTL commands[/b]

[b]  Command[/b]
 Desciption
 
[b]CHANGE_PASSWORD[/b]
 Dynamically changes the encrypted password of a listener.
 
[b]DBSNMP_START[/b]
 Starts the SNMP Intelligent Agent for an Oracle database running on the same node.
 
[b]DBSNMP_START[/b]
 Verifies whether the SNMP agent is running.
 
[b]DBSNMP_STOP[/b]
 Stops the SNMP agent for an Oracle database.
 
[b]EXIT[/b]
 Quits the LSNRCTL utility.
 
[b]HELP[/b]
 Provides the list of all available LSNRCTL commands.
 
[b]QUIT[/b]
 Provides the functionality of the EXIT command.
 
[b]RELOAD[/b]
 Shuts down everything except listener addresses, and re-reads the listener.ora file. This command enables you to add or change services without actually stopping the listener.
 
[b]SAVE_CONFIG[/b]
 Creates a backup of your listener configuration file (called listener.bak ) and updates the listener.ora file itself to reflect any changes.
 
[b]SERVICES[/b]
 Provides detailed information about the services the listener listens for.
 
[b]SET command[/b]
 This command lists the parameter values that can be set for the listener.
 
[b]SHOW command[/b]
 This command lists the value of the parameters set for the listener.
 
[b]LSNTCTL SET and SHOW Modifiers.[/b]

   LSNRCTL> SET trc_level ADMIN
   LSNRCTL> SHOW connect_timeout

[b]  Command[/b]
 Desciption
 
[b]SET CONNECT_TIMEOUT[/b]
 Determines the amount of time the listener will wait for a valid connection request after a connection has been started.
 
[b]SET CURRENT_LISTENER[/b]
 Sets or shows parameters when multiple listeners are used.
 
[b]SET LOG_DIRECTORY[/b]
 Sets a non-default location for the log file or to return the location to the default.
 
[b]SET LOG_FILE[/b]
 Sets a non-default name for the log file.
 
[b]SET LOG_STATUS[/b]
 Turns listener logging on or off.
 
[b]SET PASSWORD[/b]
 Changes the password sent from the LSNRCTL utility to the listener process for authentication purposes only.
 
[b]SET SAVE_CONFIG_ON_STOP[/b]
 Saves any changes made by the LSNRCTL SET command permanently if the parameter is on. All parameters are saved right before the listener exits.
 
[b]SET STARTUP_WAITTIME[/b]
 Sets the amount of time the listener sleeps before responding to a START command.
 
[b]SET TRC_DIRECTORY[/b]
 Sets a non-default location for the trace file or to return the location to the default.
 
[b]SET TRC_FILE[/b]
 Sets a non-default name for the trace file.
 
[b]SET TRC_LEVEL[/b]
 Turns on tracing for the listener.
 
   * SHOW command 는 SET PASSWORD를 제외하고 동일하게 사용 가능하다.

[b] 연습문제 [/b]

PC 에서 아래의 내용을 참조하여 Net8 Assistant로 listener "Uxx" 을 생성하시오.
listener 의 이름 중 xx은 위에서 부여한 사용자의 번호와 동일하게 하시오. 사용 프로토콜은 TCP/IP로 하시오.

- Start -> Program -> Oracle for WindowsNT -> Net8 Assistant 를 시작하시오.
- Listener folder 를 클릭하시오.
- Edit 에서 Create 를 선택하거나, "+" 를 클릭하시오.
- Choose Listener Name Dialog Box 에 listener 이름인 "Uxx" 를 입력하시오.
- 새롭게 추가한 listener 의 이름은 Net8 Assistant 에 있는 Listeners folder 에 나타날 것이다.
- Net8 Assistant 에 있는 Listeners folder 에서 Uxx 를 선택한 후, 화면 오른쪽의 Full-down menu 에서 "Listening Location" 을 선택하여, Add Address 탭을 선택하여 리스터의 상세 주소를 입력한다. (Host 와 프로토콜, PORT는 환경 설정시 지정한 것을 사용한다.)
- 화면 오른쪽의 Full-down menu 에서 Database Services 에서 화면 하단의 Add Database 를 선택하여, 필요한 사항을 입력한다. (Global Database Name 은 "world" 로 하고, SID 와 Oracle Home 디렉토리를 각각 입력한다. SID 를 입력할 때, 첫번째 대문자가 나타나지 않는다면,
  문자가 나타날 때까지 Shift+Letter 를 계속 누란다.)
- Net8 Assistant -> File -> Save Network Configuration 을 선택하여 구성 내용을 저장한다.

위에서 작업한 내용을 실제로 확안을 해보자. 즉, Uxx 을 위해 생성된 listener.ora file의 내용을 확인하시오.
파일은 C:\ORANT\net80\admin 에 존재 할 것이다.

PC(client) 에서 생성된 listener.ora file 을 ftp 를 이용해서 Server 족으로 이동하여 사용할 수 있다.
(아래를 직접 수행하지 말고 내용만 참조하고, (4) 의 작업을 수행하십시오.)

C:\ORANT\NET80\ADMIN> ftp kredusun2
Connected to kredusun2.
220 kredusun2 FTP server (SunOS 5.6) ready.
Name (kredusun2:maxlee): user19
331 Password required for user19.
Password:
230 User user19 logged in.
ftp> mput listener.ora
mput listener.ora? y

-- 그냥 편집 하려면 아래부터 하면 된다. --

서버쪽에서 vi를 이용해서 listener.ora file 을 수정하시오.
리스너의 이름, Address, port 등 기타 관련된 사항을 수정하시오.
아래의 내용 중에서 굵게 표시된 부분이 수정되어야 할 부분이다.

$ cd $TNS_ADMIN
$ vi listener.ora

아래와 같이 수정하시오.

  U20=
  (ADDRESS_LIST =
        (ADDRESS = 
          (PROTOCOL = TCP)
          (Host = 152.69.25.2)
          (Port = 8020)
        )
  )
SID_LIST_U20=
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = DBA220)
      (ORACLE_HOME =/home/DBA805/dba220)
    )
  )
STOP_U20=YES
STARTUP_WAIT_TIME_U20=0
CONNECT_TIMEOUT_U20=10
TRACE_LEVEL_U20=USER
LOG_DIRECTORY_U20=/home/DBA805/dba220/network/admin/log
TRACE_DIRECTORY_U20=/home/DBA805/dba220/network/admin/log

수정이 완료 되었으면저장하고 host로 나간다.
LOG 내용을 기록하기 위한 디렉토리를 작성하시오.

$ cd $TNS_ADMIN
$ mkdir log

Listener Control utility 를 이용해서 listener 를 구동하시오.

$lsnrctl start u20
.....
U20         has 1 service handler(s)
The command completed successfully.

위의 메세지처럼 나와야 정상적으로 리스너가 기동 된 것임.

Listener contol utility 를 이용해서 리스터를 종료하고, 네번째에서 지정한 리스너의 로그 파일과
Trace 파일의 내용을 조회하여 기록된 내용이 무엇인지 검토하시오.

$ lsnrctl stop u20
.....
The command completed successfully

$ cd $TNS_ADMIN/log
$ vi u20.log
$ vi u20.trc

오라클 서버를 시작하시오.

$ svrmgrl
SVRMGR> connect internal
SVRMGR> startup

Dedicated Server Process를 Prespawned 시켜서, 실제 서버가 생성이 되는지를 테스트한다.

1) listener.ora 파일에 아래의 굵게 된 내용을 추가 시킨 후, 리스너를 기동시킨다.

SVRMRG> host
$ cd $TNS_ADMIN
$ vi listener.ora

  U20=
  (ADDRESS_LIST =
        (ADDRESS = 
          (PROTOCOL = TCP)
          (Host = 152.69.25.2)
          (Port = 8020)
        )
  )
SID_LIST_U20=
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = DBA220)
      (ORACLE_HOME =/home/DBA805/dba220)
      
      (PRESPAWN_MAX=99)
        (PRESPAWN_LIST=
          (PRESPAWN_DESC=
            (PROTOCOL=TCP)
            (POOL_SIZE=3)
            (TIME_OUT=2)
          )
        )
        
    )
  )
STOP_U20=YES
STARTUP_WAIT_TIME_U20=0
CONNECT_TIMEOUT_U20=10
TRACE_LEVEL_U20=USER

LOG_DIRECTORY_U20=/home/DBA805/dba220/network/admin/log
TRACE_DIRECTORY_U20=/home/DBA805/dba220/network/admin/log
 
수정이 완료되었으면 저장하고 나온다.

$ lsnrctl start u20


2) OS Prompt 에서 프로세스를 조회해서 prespawned dedicated server 가 생성되었는지를 확인한다.

$ ps -ef | grep u20 | sort

Prespawned dedicated server의 설정 내용이 정상적으로 수행된 것을 확인한 후,
원래대로 listener 가 Spawned and Bequeath 방식으로 운영되도록 한다.
즉, listener.ora 위에서 추가했던 사항을 제거하고 다시 저장한다.

$ lsnrctl stop u20
$ vi listener.ora

  U20=
  (ADDRESS_LIST =
        (ADDRESS = 
          (PROTOCOL = TCP)
          (Host = 152.69.25.2)
          (Port = 8020)
        )
  )
SID_LIST_U20=
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = DBA220)
      (ORACLE_HOME =/home/DBA805/dba220)
      
#      (PRESPAWN_MAX=99)
#        (PRESPAWN_LIST=
#          (PRESPAWN_DESC=
#            (PROTOCOL=TCP)(POOL_SIZE=3)(TIME_OUT=2)
#          )
#        )
        
    )
  )
STOP_U20=YES
STARTUP_WAIT_TIME_U20=0
CONNECT_TIMEOUT_U20=10
TRACE_LEVEL_U20=USER

LOG_DIRECTORY_U20=/home/DBA805/dba220/network/admin/log
TRACE_DIRECTORY_U20=/home/DBA805/dba220/network/admin/log


위에서 입력/수정한 내용을 "#" 표시를 하여 주석으로 처리함.

하나의 listener.ora 파일에 다중 리스너를 구성해 보자.
우선 listener.ora 파일에 또 다른 리스너를 정의하기 위해서 기존의 리스너의 내용에 아래의 내용을 추가한 후, 저장하시오.
이제는 한 개의 listener.ora 파일에 2개의 리스너를 기동할 수 있게 설정이 되었다.
각각의 리스너를 시작하시오. 다중 리스너를 구축하는 이유는 무엇인가?

$ vi listener.ora

  U20=
  (ADDRESS_LIST =
        (ADDRESS = 
          (PROTOCOL = TCP)
          (Host = 152.69.25.2)
          (Port = 8020)
        )
  )
SID_LIST_U20=
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = DBA220)
      (ORACLE_HOME =/home/DBA805/dba220)
    )
  )
STOP_U20=YES
STARTUP_WAIT_TIME_U20=0
CONNECT_TIMEOUT_U20=10
TRACE_LEVEL_U20=USER
LOG_DIRECTORY_U20=/home/DBA805/dba220/network/admin/log
TRACE_DIRECTORY_U20=/home/DBA805/dba220/network/admin/log
U20_2=
  (ADDRESS_LIST =
        (ADDRESS = 
          (PROTOCOL = TCP)
          (Host = 152.69.25.2)
          (Port = 8120)
        )
  )
SID_LIST_U20_2=
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = DBA220)
      (ORACLE_HOME =/home/DBA805/dba220)
    )
  )
STOP_U20_2=YES
STARTUP_WAIT_TIME_U20_2=0
CONNECT_TIMEOUT_U20_2=10
TRACE_LEVEL_U20_2=USER
LOG_DIRECTORY_U20_2=/home/DBA805/dba220/network/admin/log
TRACE_DIRECTORY_U20_2=/home/DBA805/dba220/network/admin/log
 



$ lsnrctl start u20
$ lsnrctl start u20_2

$ pf -ef | grep u20 | sort

아래의 명령어를 통해 리스너의 상황을 점검해 보시오.

$ lsnrctl serv u20
$ lsnrctl serv u20_2 

 

04. 기본 Net8 클라이언트 측 설정 (Basic Net8 Server-Side Configurations)

 

[b]TNSNAMES.ORA File[/b]

 - tnsnames. ora

  # C:\ORAWIN95\NET80\ADMIN\TNSNAMES.ORA Configuration File:C:\orawin95\net80\admin\tnsnames.ora
# Generated by Oracle Net8 Assistant

CMM.WORLD = ST10
  (DESCRIPTION = ST10
    (ADDRESS_LIST = 152.69.25.3
      (ADDRESS = (PROTOCOL = tcp)(PORT = 1610)(HOST = CM_SERVER))
      (ADDRESS = (PROTOCOL = tcp)(PORT = 1521)(HOST = LSNR_SERVER))
    )
    (CONNECT_DATA = 152.69.25.3
      (SID = ORCL)
    )
    (SOURCE_ROUTE = yes)
  )

CMEXAMPLE.WORLD = 
  (DESCRIPTION = 
    (ADDRESS_LIST = 
      (ADDRESS = (PROTOCOL = tcp)(PORT = 1610)(HOST = CM_SERVER))
      (ADDRESS = (PROTOCOL = tcp)(PORT = 1521)(HOST = LSNR_SERVER))
    )
    (CONNECT_DATA = 152.69.25.3
      (SID = ORCL)
    )
    (SOURCE_ROUTE = yes)
  )
 
[b]SQLNET.ORA File[/b]

- sqlnet. ora

  TRACE_LEVEL_CLIENT = OFF
#sqlnet.authentication_services = (NONE)
names.directory_path = (TNSNAMES, HOSTNAME)
names.default_domain = world
name.default_zone = world
automatic_ipc = off
 
[b]* tnsnames.ora, sqlnet.ora file은 Net8 assistance로 작성할 수 있다.[/b]


[b] 연습문제 [/b]

Net8 Assistant의 Local Naming Method 를 이용해서, Network 을 사용할 수 있도록 Client를 Setting 하시오.

   1) Start -> Program -> Oracle for WindowsNT -> Net8 Assistant 를 시작하시오.
   2) Profile folder 를 선택한 후, 우측의 Pull-down 메뉴에서 Naming 을 선택하시오.
   3) 좌측의 Selected Method 에 "TNSNAMES", "HOSTNAME" 이 선택되었는지를 확인한 후,
      메뉴에서 File -> Save -> Network Configuration 을 선택하여, 지금까지의 선택 사항을
      저장하시오.
   4) 클라이언트의 %ORACE_HOME%\net80\admin\sqlnet.ora 파일의 내용을 조회하시오.
      NAMES.DIRECTORY_PATH=(TNSNAMES, HOSTNAME) 로 되었는지를 확인하시오.
      
      #C:\ORANT\NET80\ADMIN\SQLNET.ORA
      #Configuration File:C:\ORANT\net80\admin\sqlnet.ora
      #Generated by Oracle Net8 Assistant
      
      NAME.DEFAULT_ZONE=world
      NAMES.DEFAULT_DOMAIN=world
      
      #sqlnet.authentication_services=(nts)
      SQLNET.EXPIRE_TIME=0
      SQLNET.ENCRYPTION_SERVER=requested
      
      SQLNET.ENCRYPTION_CLIENT=requested
      NAMES.DIRECTORY_PATH=(TNSNAMES, HOTNAME)

Net8 Easy Config 를 이용해서 새로운 서비스 명을 등록하고 테스트 하시오.
(프로토콜은 TCP/IP 를 이용하고, 리스너의 포트 번호와 SID를 입력하시오.)

   1) Start -> Program -> Oracle for WindowsNT -> Net8 Easy Config 를 시작하시오.
   2) Add Service 를 선택하여 새로운 서비스 명을 등록한다.
   3) Oracle Service Name Wizard 에서, 접속할 주소의 논리적 이름(TNS Service Name)을 입력한다. 편의를 위해 Uxx 로 한다.
   4) wizard 의 순서에 따라서 사용 프로토콜, 호스트 이름, 오라클 SID 를 입력한다.
   5) 테스트는 system/manager 로 기동을 한다.(테스트에 실패하면, 우선 서버쪽에 리스너가 구동이 되었는지,
       오라클을 제대로 기동이 되었는지를 확인한 후 다시 테스트를 실시 해본다.)
   6) 테스트가 끝났으면, Next 를 선택한 후 , Finish 를 누른다.
   7) C:\ORANT\NET80\ADMIN\tnsnames.ora 파일의 내용을 확인하여, 위에서 등록한 내용이 제대로 기록되었는지를 확인한다.
      
      #C:\ORANT\NET80\ADMIN\TNSNMES.ORA
      #Configuration file:C:\ORANT\net80\admin\tnsnames.ora
      #Generated by Oracle Net8 Assistant
      Uxx.WORLD=
        (DESCRIPTION=
          (ADDRESS=(PROTOCOL=TCP)(HOST=kredusun2)(PORT=80xx))
          (CONNECT_DATA=(SID=Uxx))
        )

Server/Client 가 제대로 동작하는지 테스타 하시오.

c:\sqlplus system/manager@Uxx.world    --> world 는 생략 가능

3번째의 과정에서 접속에 성공하였다면, 정확한 인스턴스에 접속이 되었는지를 확인하기 위해서 "V$INSTANCE" 를 조회하여 검증하시오.

SQL> select instance_name, host_name, status
     2  from v$instance ;

Server 쪽에서 system 으로 접속하여, v$session 을 조회하여 제대로 접속이 이루어졌는지를 조회하시오.

SQL> select username, machine, terminal, program
     2  from v$session ;

이전 서버쪽 설정 과정에서 두 개의 리스너가 한 개의 데이터베이스에 대한 서비스를 하도록 설정하였다.
그렇다면, 클라이언트에서 동일한 서비스명에 두 개의 포트 번호를 지정하여 어떤 식으로 Load Balancing 이 이루어지는지 살펴보자.
아래의 과정대로 수행하여 우선 "tnsnames.ora" 의 내용을 수정하시오.

   1) Start -> Program -> Oracle for WindowsNT -> Net8 Assistant 를 시작하시오.
   2) Services 를 더블클릭하면, TNS 서비스명이 트리의 형태로 나열될 것이다.
   3) (2)에서 생성한 Uxx 를 클릭하면, 화면 우측에 해당 서비스명에 대한 자세한 정보가 보인다.
   4) "New Address" 탭을 클릭하면 새로운 입력 탭이 생성된다. Port 번호에 "81xx" 를 입력한다.
   5) 주 메뉴의 file -> Save Network configuration 을 선택하여, 변동된 사항을 저장한다.
   6) C:\orant\net80\admin\tnsnames.ora 파일의 내용을 확인하여, 위에서 등록한 내용이 제대로
      기록되었는지를 확인한다.

      Uxx.world=
        (DESCRIPTION=
          (ADDRESS_LIST=
            (ADDRESS=(PROTOCOL=TCP)(HOST=152.69.25.2)(PORT=80xx))
            (ADDRESS=(PROTOCOL=TCP)(HOST=152.69.25.2)(PORT=81xx))
          )
          (CONNECT_DATA=(SID=Uxx)
        )

   7) 위의 작업은 "Net8 Assistant" 를 사용하지 않고, 직접 "tnsnames.ora" 파일을 수정해도 무관하다.

Server/Client 가 제대로 동작하는지 테스팅하고 접속이 어느 쪽으로 이루어졌는지를 서버쪽에서 "lsnrctl" 명령어를 이용하여 확인하시오.

   1) 클라이언트 쪽에서 접속하시오.

      c:\sqlplus system/manager@Uxx.world

   2) 서버쪽에서 리스너의 상황 확인.

      $ lsnrctl serv Uxx

      $ lsnrctl serv Uxx_2


   3) 포트번호 80xx를 이용하여 Uxx 의 리스너로 접속을 하였음을 볼 수 있다.

위의 과정을 성공적으로 수행했다면, tnsnames.ora 에서 잘못된 포트 번호를 명시하거나, 잘못된 노드 이름, 데이터베이스, 또는 서비스 이름을 명시하여 에러를 유발하여 각각의 경우에 대해서 테스트를 해보시오.
(아래의 예제는 U19를 사용했을 경우이다.)

   1) 잘못된 포트 번호를 명시할 경우

      U19.world=
        (DESCRIPTION=
          (ADDRESS_LIST=
            (ADDRESS=(PROTOCOL=TCP)(HOST=152.69.25.2)(PORT=8000))
          )
          (CONNECT_DATA=(SID=U19)
        )

      $ sqlplus system/manager@U19

      Error 의 내용은 무엇인가?

   2) 잘못된 노드 이름을  명시할 경우

      U19.world=
        (DESCRIPTION=
          (ADDRESS_LIST=
            (ADDRESS=(PROTOCOL=TCP)(HOST=152.69.25.200)(PORT=8019))
          )
          (CONNECT_DATA=(SID=U19)
        )

      $ sqlplus system/manager@U19

      Error 의 내용은 무엇인가?

   3) 잘못된 데이터베이스 이름을 명시할 경우

      U19.world=
        (DESCRIPTION=
          (ADDRESS_LIST=
            (ADDRESS=(PROTOCOL=TCP)(HOST=152.69.25.2)(PORT=8019))
          )
          (CONNECT_DATA=(SID=U19AAAA)
        )

      $ sqlplus system/manager@U19

      Error 의 내용은 무엇인가?

   4) 잘못된 서비스 이름을 명시할 경우

      U19AAAA.world=
        (DESCRIPTION=
          (ADDRESS_LIST=
            (ADDRESS=(PROTOCOL=TCP)(HOST=152.69.25.2)(PORT=8019))
          )
          (CONNECT_DATA=(SID=U19)
        )

      $ sqlplus system/manager@U19

      Error 의 내용은 무엇인가? 

 

05. 멀티쓰레드 서버의 이용과 셋팅 (Multithreaded Server Usage and Configurations)

 

MTS로 구성을 하고. TCP/IP 로 우선 기본적으로 한 개의 디스패쳐와 한 개의 공유 서버를 갖는 다중 서버 환경으로 구성하고 최대 디스패쳐는 2개로 명시하고, 최대 공유 서버는 6개가 되도록 하시오. 아래의 내용을 추가하시오.

$ cd $ORACLE_HOME/dbs
$ vi initDBA220.ora

#Nultithreaded Server Environment
local_listener=DBA220.world
mts_service=DBA220
mts_dispatchers='(PRO=TCP)(DIS=1)'
mts_servers=1
mts_max_dispatchers=2
mts_max_servers=6

Server 쪽에 위치하는 tnsname.ora에 아래의 내용이 있는지를 확인하고, 없다면 추가하고 즉, 리스너에 대한 tns_service name 이 등록되어 있는지를 확인하시오. 이것이 확인되지 않으면, MTS로 기동하지 않음을 유의하시오.


$ cd $TNS_ADMIN
$ vi tnsnames.ora


DBA220.world=
   (description= 
      (address=(protocol=tcp)(host=152.69.25.2)(port=8020)) 
      (connect_data=(sid=DBA220)) ) 


리스너가 기동되어 있는지를 확인하고, 기동이 되어있지 않다면 리스너를 기동하시오.

$ lsnrctl star dba220   <-- 리스너가 기동되어 있는지 확인

TNS-01106: dba220 리스너명을 이용한 리스너는 이미 시작되었습니다

$ lsnrctl start dba220


위의 사항대로 설정이 되어 있다면 데이터베이스를 재기동한 후, 다중 슬드 서버로 구동 되었는지 프로세스를 통해 확인하시오.


$ svrmgrl


SVRMGR> connect internal
SVRMGR> startup
SVRMGR> exit


주) 위의 설정과정에서 잘못을 범하게 되면 아래와 같은 에러가 발생된다.
    (tnsnames.ora 의 서비스명이나, initSID.ora 파일의 내용이 일치하지 않을 경우)


ORA-00101: invalid specification for system parameter MTS_DISPATCHERS


$ps -ef | grep | DBA220 | sort
주) d00, s00 프로세스를 확인하시오.


서버에 접속을 한 후, system 으로 다른 세션을 오픈하여 data dictionary 를 통해서 다중 스레드 환경의 상황을 모니터링 하시오.
"v$circuit" 는 MTS 를 이용한 접속 여부를 알려준다. "v$shared_server"는 유일하게 동유된 서버가 시작된 것을 확인할 수 있을 것이다.
또한 "v$dispatcher"를 보면 얼마나 많은 디스패쳐가 시작되었는지를 보여준다.
(주: 서버쪽에서 작업을 한다면, tns_service 명을 full로 명시하시오.)


$ sqlplus system/manager@dba220.world


SQL> select * from v$circuit ;


SQL> select * from v$shared_server ;


SQL> select * from v$dispatcher ;


MTS 를 사용하여 클라이언트에서 서버로 또 다른 접속을 수행한 후, 공유 서버의 사용도를 조사하시오.
공유된 서버가 증가하였나? 증가하였다면 이유는 무엇인가, 또 증가하지 않았다면 이유는 무엇인가? 


$ sqlplus system/manager@dba220.world


SQL> select * from v$shared_server ;


- 위의 예제의 경우는 변동 사하잉 없음을 볼 수 있다. 이유는 디스패쳐를 통해서 설정된 접속들이 서버를 공유해서 사용하고 있기 때문이다.
- 공유된 서버가 증가하는 유일한 방법은 여러 요구가 동시에 처리되어야 하는데, 요구를 처리해 주기 위한 공유 서버가 충분히 없는 경우이다.

아래의 명령어를 수행하여 디스패쳐의 수를 2로 다이나믹하게 조정하시오. "v$dispatcher"를 조회하여 디스패쳐가 추가되었는지 확인하시오.

SQL> alter system set mts_dispatchers='(PRO=TCP)(DIS=2)' ;


SQL> select * from v$dispatcher ;


세 번째의 dipatcher 를 추가하시오. 가능한가? 불가능하다면 이유는 무엇이고 어떤 조치를해야 하는가?
에러 메시지를 보면 알 수 있듯이 디스패쳐의 최대수는 초기화 매개변수 mts_max_dispatchers를 초과하여 생성할 수는 없다.
그렇다면, 초기화 매개변수를 수정하여야 한다. 이 변수는 정적인 변수로 initSID.ora 에서 수정한 후 데이터베이스를 재구동해야 한다.

SQL> alter system set mts_dispatchers='(pro=tcp)(dis=3)' ;
         alter system set mts_dispatchers='(pro=tcp)(dis=3)'
       *ERROR at line 1:
ORA-00112: only created up to 2 (maximum specified) dispatchers


Connection Pooling 이 되도록 설정을 한 후, 실제 connection pooling 이 되는지 확인하시오.

 1) initDBA220.ora 파일에서 아래의 내용을 수정하시오.


     mts_dispatchers="(PRO=TCP)(DIS=1)(POO=ON)(CON=1)(SESS=3)(TIC=3)"


 2) 세 개의 세션을 공유서버를 이용하도록 오픈시키시오.


     $ sqlplus system/manager@DBA220.world
     $ sqlplus system/manager@DBA220.world
     $ sqlplus system/manager@DBA220.world

 3) 세 번재 세션이 오픈이 즉시 이루어지는가? 즉시 이루어지지 않는다면, 접속이 이루어 지는데 어느 정도의 시간이 걸리는가?

일반적으로 배치업무나, 데이터베이스의 시작과 종료를 위한 작업, 또는 "internal"로 접속을 할 경우에는 MTS Server로 접속을 할 수 없다.
그런 경우 TNS 서비스명에 서버의 형태를 지정하여 전용 서버(Dedicated Server)로 접속을 할 수 있다. 아래의 명령어를 수행하시오.
우선 전용 서버로 접속을 할 수 있도록 TNS 서비스명을 변경하시오.
그런 후, 수정된 서비스명을 이용하여 시스템에 접속을 하여 전용서버로 접속이 되었는지, 공유서버로 접속이 되었는지를 확인하시오.

$ cd $TNS_ADMIN


$ vi tnsnames.ora


DBA220dedic.world=
   (description= 
      (address=(protocol=tcp)(host=152.69.25.2)(port=8020)) 
      (connect_data=(sid=DBA220)
                    (SERVER=DEDICATED)
      )
   ) 

$ sqlplus system/manager@DBA220dedic


SQL> !


$ ps -ef | grep dba220


[b]* MTS setup 정보를 갖고 있는 data dictionary[/b]

  V$CIRCUIT
 This view contains information about virtual circuits, which are user connections to the database through dispatchers and servers.
 
 V$SHARED_SERVER
 This view contains information on the shared server processes.
 
 V$DISPATCHER
 This view provides information on the dispatcher processes.
 
 V$MTS
 This view contains information for tuning the Multithreaded Server.
 
 V$QUEUE
 This view contains information on the multithread message queues.
 
 V$SESSION
 This view lists session information for each curent session.

 

06. 네트워크 환경의 문제점 (Troubleshoot the Network Environment)

 

클라이언트에 대한 로그 작업을 활성화하기 위해서 우선 Net8 Assistant 를 이용해서 환경을 설정하시오.

   1) Oracle8 net Assistant 에서 트리 디렉토리에 있는 Profile 아이콘을 선택하시오.
   2) Pull-down 메뉴에서 "General" 을 선택하시오.
   3) "Logging" 탭을 선택하시오.
   4) 로그 디렉토리를 명시하기 위해서 "Cleint Information" 섹션의 "Log Directory" 에 로그 디렉토리를 아무 유용한 디렉토리를 입력하시오. 예를 들어 "C:\orant\net80\log" 를 입력하시오.
   5) 로그 파일명을 명시하기 위해서 "Client Information" 섹션의 "Log File"에 아무 유효한 파일명을  입력하시오. 예를 들어 "netlog" 라고 입력하시오.
   6) 구성을 저장하기 위해서 File --> Save Network Configuration 를 선택하시오.

[b]위에서 설정한 내용이 제대로 되었는지를 확인하기 위해서 클라이언트의 "sqlnet.ora" 의 내용을 확인하시오.[/b]

#C:\ORANT\NET80\ADMIN\SQLNET.ORA
#Configuration File:C:\ORANT\net80\admin\sqlnet.ora
#Generated by Oracle Net8 Assistant

LOG_FILE_CLIENT = netlog
LOG_DIRECTORY_CLIENT = C:\orant\net80\log

NAME.DEFAULT_ZONE = world
NAMES.DEFAULT_DOMAIN = world

#sqlnet.authentication_services=(nts)
SQLNET.EXPIRE_TIME=0
NAMES_DIRECTORY_PATH=(TNSNAMES.ONAMES)

클라이언트에서 네트워크를 이용하여 서버에 접속을 한 후에 로그 파일을 조회하시오.
로그파일이 생성되었나? 접속이 성공적으로 수행되었다면 아무 기록도 남지 않을 것이다.

[b]서버쪽의 리스너를 종료하시오.[/b]

$ lsnrstl stop Uxx

클라이언트 쪽에서 접속을 시도해 보고, 접속이 실패하였다면 노트 패드같은 것을 이용하여 Client 쪽으로 그 파일을 조사해 보시오.
어떤 내용들이 기록되었나?

C:\sqlplus system/manager@Uxx


[b]--netlog.log 파일의 내용 --[/b]

Fatal NI connect error 12224, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=kredusun2)(PORT=8019))
(CONNECT_DATA=(SID=Uxx)(CID=(PROGRAM=C:\ORANT\BIN\PLUS80.EXE)(HOST=MAXLEE)
(USER=maxlee))))
    VERSION INFORMATION
    TNS for 32-bit Windows: Version 8.0.5.0.0 - Production
    Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 8.0.5.0.0 - Production
    Time:27-JUL-99 20:57:04
    Tracing not turned on.
    Tns error stuct:
        nr err code: 12224
        TNS-12224: TNS: 리스너가 없습니다.
        ns main err code: 12541
        TNS-12541: TNS: 리스너가 없습니다.
        ns secondary err code: 12560
        nt main err code: 00511
        TNS-00501: TNS: 리스너가 없습니다.
        nt secondary err code: 61
        nt OS err code: 0


[b]서버쪽에서 리스너를 다시 기동하시오.[/b]

$ lsnrctl start Uxx

클라이언트의 Tracing Level 을 "Support" 로 설정하시오.
이 작업은 Net8 Assistant를 이용할 수도 있고, sqlnet.ora 파일을 직접 편집하여 수행할 수 있다.
이번에는 서버쪽에서 직접 편집을 해보자.

$ cd $TNS_ADMIN

$vi sqlnet.ora

TRACE_DIRECTORY_CLIENT = $TNS_ADMIN/log
TRACE_UNIQUE_CLIENT = on
TRACE_FILE_CLIENT = nettrc
TRACE_LEVEL_CLIENT = SUPPORT


LOG_FILE_CLIENT = netlog
LOG_DIRECTORY_CLIENT = $TNS_ADMIN/log


NAME.DEFAULT_ZONE = world
NAMES.DEFAULT_DOMAIN = world


sqlnet.authentication_services=(nts)
SQLNET.EXPIRE_TIME=0
NAMES_DIRECTORY_PATH=(TNSNAMES, HOSTNAME)


파일이 존재하지 않는다면, 위의 내용을 새롭게 작성하시오.

서버쪽으로 접속을 수행하고, 접속을 해제한 후에 trace file을 조사해 보시오.
"Trace Assistant" 유틸리티를 이용하되 Net8 과 TTC 정보를 조회하는 것이 가능하게 하기 위해서 "-o" 옵션을 이용해서 실행하고 결과를 tst.txt 파일로 전환하여 그 내용을 조사하시오.

$ sqlplus system/manager@Uxx

$ cd $TNS_ADMIN/log

$ trcasst -o nettrc_7965.trc > tst.txt

$ vi tst.txt

[b]옵션[/b]

-o : SQL*net 과 TTC 정보
-p : 내부적인 정보
-s : 통계 정보
-e : error 정보
[Top]
No.
제목
작성자
작성일
조회
8864리눅스에서 오라클 JDBC연동 [1]
정재익
2001-12-13
7192
8862Oracle 8 - Situation
정재익
2001-12-12
6099
8859Oracle 8 - Backup &amp; Recovery (1)
정재익
2001-12-12
10272
8858Oracle 8 - Network Administration
정재익
2001-12-12
12051
8854Oracle 8 - Database Administration (2)
정재익
2001-12-12
28675
8853Oracle 8 - Database Administration (1)
정재익
2001-12-12
14727
8827Oracle 8 - SQL &amp; PL/SQL (2)
정재익
2001-12-11
15766
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.019초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다