Oracle Names Server
ONAMES는 일반적으로 TCP/IP네트웍에서 사용하는 DNS와 유사한 기능을 한다. 즉, DNS가 도메인정보를 관리하듯이, ONAMES는 NET8 서비스정보를 관리한다. ONAMES는 성능과 FAILOVER를 위해 2개이상 구성하도록 하는 것이 좋다. DNS와 같은 이유에서다.
ONAMES를 사용하면, 클라이언트들이 더이상 tnsnames.ora파일을 가지고 있을 필요가 없다. 클라이언트는 tnsnames.ora에서 얻어오던 정보를 ONAMES에 질의하여 알아낼 것이기 때문이다. ONAMES구성후, 리스너는 시작할때 자신의 서비스정보를 ONAMES에 자동으로 등록하게 된다. 사실 ONAMES를 사용하더라도 만일의 경우를 대비해서 tnsnames.ora를 지우지 않는 것이 좋다.
ONAMES는 등록된 서비스의 저장을 위해 region DB를 이용할 수도 있고, 사용하지 않을 수도 있다. 사용하지 않을 경우, Cache replication발생한다.
* region DB 규모가 클때 사용. names서버의 서비스이름 데이터베이스 저장소
ONAMES에 관련된 설정파일들은 다음과 같고, $ORACLE_HOME/network/admin/에 존재한다.
onames의 설정파일: names.ora 클라이언트 설정파일: sqlnet.ora DB서버의 설정파일: listener.ora
[기본설명] 설정파일을 수동으로 편집하고 실행해도 되지만, 여기서는 Net8 Assistant를 사용하여 구성할 것이다. 하려고 했는데, SIGSEGV로 인해 수동으로 설정했다. 오라클사의 입장은 되도록이면 Net8 Assistant를 사용해서 구성하도록 권장하고 있다. 음.. OCP에서도 이 툴에 관한 문제가 출제된다. 사실 Net8 Assistant가 자주 사용되지 않는 이유는 다음과 같다고 볼 수 있다. 개인적인 생각일 뿐이다.
대부분 오라클은 유닉스계열의 서버에 설치된다. netasst를 실행하려면 X윈도와 자바에서 돌아간다. 원격 터미널에서 X터미널을 띄우는 것은 그리 내키는 일이 아니고, 자바GUI 또한 불편하고 느려서 작업하기 번거롭다. 치명적으로 오라클에서 자바를 사용하면(특히 리눅스) SIGSEGV가 빈번히 발생한다는 것이다. 대개 유닉스 관리자나 DBA들은 텔넷세션에서 작업하고, 쉘상에서 작업하기를 선호한다.
[테스트구성] 2대의 컴퓨터를 사용하여 테스트했다. 리눅스박스가 DB서버, 윈도박스가 클라이언트로 사용될 것이다. ONAMES는 리눅스박스에 1개만 설치할 것이다.
리눅스박스(192.168.0.2) Red Hat Linux release 8.0 (Psyche) Kernel 2.4.20 on an i686 Oracle8i Enterprise Edition Release 8.1.7.0.1 - Production
윈도박스(192.168.0.1) Microsoft Windows 2000 [Version 5.00.2195] Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
[ONAMES 구성시작] 리눅스박스에 ONAMES와 DB, 리스너를 구성하고, 윈도박스는 클라이언트로 사용할 것이다. 리눅스에서 ONAMES설정을 위해 netasst을 사용하면 SIGSEGV가 발생하여 수동설정으로 진행했다.
[oracle@linux admin]$ cat names.ora
names.server_name = onames_dbakorea names.addresses = (address= (protocol=tcp)(host=192.168.0.2)(port=1575))
#names.domains = (domain= (name=)(min_ttl=86400)) [oracle@linux admin]$ cat sqlnet.ora # DIRECTORY_PATH 는 서비스정보를 조회할 곳을 지정한다. TNSNAMES, HOST, ONAMES가 올 수 있다. # PREFERRED_SERVERS는 ONAMES에 대한 정보이다. #NAMES.DEFAULT_DOMAIN = world
NAMES.DIRECTORY_PATH = (ONAMES) NAMES.PREFERRED_SERVERS = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.2)(PORT = 1575))
[oracle@linux admin]$ cat listener.ora # use_plug_and_play_리스너명 은 리스너실행시 자신의 서비스를 ONAMES에 등록하도록 한다. # NAMES.PREFERRED_SERVERS는 ONAMES에 대한 정보이다.
use_plug_and_play_db = on
NAMES.PREFERRED_SERVERS = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.2)(PORT = 1575)) ) )
db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.2)(PORT = 1521)) )
SID_LIST_db = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = db.world) (ORACLE_HOME = /u01/app/oracle/product/8.1.7) (SID_NAME = db) ) )
[oracle@linux admin]$ namesctl start
Oracle Names Control for Linux: Version 8.1.7.0.0 - Production on 01-AUG-2003 03:55:29
(c) Copyright 1997 Oracle Corporation. All rights reserved.
NNL-00018: warning: could not contact default name server Starting "/u01/app/oracle/product/8.1.7/bin/names"...server successfully started
Currently managing name server "onames_dbakorea" Version banner is "Oracle Names for Linux: Version 8.1.7.0.0 - Production"
Server name: onames_dbakorea Server has been running for: 0.04 seconds Request processing enabled: yes Request forwarding enabled: yes Requests received: 0 Requests forwarded: 0 Foreign data items cached: 0 Region data next checked for reload in: not set Region data reload check failures: 0 Cache next checkpointed in: not set Cache checkpoint interval: not set Cache checkpoint file name: /u01/app/oracle/product/8.1.7/network/names/ckpcch.ora Statistic counters next reset in: not set Statistic counter reset interval: not set Statistic counters next logged in: not set Statistic counter logging interval: not set Trace level: 0 Trace file name: /u01/app/oracle/product/8.1.7/network/trace/names_2653.trc Log file name: /u01/app/oracle/product/8.1.7/network/log/names.log System parameter file name: /u01/app/oracle/product/8.1.7/network/admin/names.ora Command-line parameter file name: "" Administrative region name: "" Administrative region description: "" ApplTable Index: 0 Contact "" Operational Status 0 Save Config on Stop no [oracle@linux admin]$ lsnrctl start db
LSNRCTL for Linux: Version 8.1.7.0.0 - Production on 01-AUG-2003 03:55:37
(c) Copyright 1998 Oracle Corporation. All rights reserved.
Starting /u01/app/oracle/product/8.1.7/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 8.1.7.0.0 - Production System parameter file is /u01/app/oracle/product/8.1.7/network/admin/listener.ora Log messages written to /u01/app/oracle/product/8.1.7/network/log/db.log Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.2)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.2)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias db Version TNSLSNR for Linux: Version 8.1.7.0.0 - Production Start Date 01-AUG-2003 03:55:37 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security OFF SNMP OFF Listener Parameter File /u01/app/oracle/product/8.1.7/network/admin/listener.ora Listener Log File /u01/app/oracle/product/8.1.7/network/log/db.log Services Summary... db has 1 service handler(s) The command completed successfully [oracle@linux admin]$ svrmgrl
Oracle Server Manager Release 3.1.7.0.0 - Production
Copyright (c) 1997, 1999, Oracle Corporation. All Rights Reserved.
Oracle8i Enterprise Edition Release 8.1.7.0.1 - Production With the Partitioning option JServer Release 8.1.7.0.1 - Production
SVRMGR> connect internal Connected. SVRMGR> startup ORACLE instance started. Total System Global Area 30064800 bytes Fixed Size 73888 bytes Variable Size 13041664 bytes Database Buffers 16777216 bytes Redo Buffers 172032 bytes Database mounted. Database opened. SVRMGR> quit Server Manager complete.
tnsnames.ora파일 없이 제대로 연결할 수 있는지 테스트해본다. [oracle@linux admin]$ tnsping db.world
TNS Ping Utility for Linux: Version 8.1.7.0.0 - Production on 01-AUG-2003 03:56:01
(c) Copyright 1997 Oracle Corporation. All rights reserved.
Attempting to contact (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.2)(PORT=1521)) OK (10 msec)
연결테스트가 성공하면 실제 접속하여 간단한 질의를 던져보자. [oracle@linux admin]$ sqlplus kang/xxxxxx@db.world
SQL*Plus: Release 8.1.7.0.0 - Production on Fri Aug 1 03:56:09 2003
(c) Copyright 2000 Oracle Corporation. All rights reserved.
Connected to: Oracle8i Enterprise Edition Release 8.1.7.0.1 - Production With the Partitioning option JServer Release 8.1.7.0.1 - Production
SQL> select sysdate from dual;
SYSDATE --------- 01-AUG-03
SQL> quit Disconnected from Oracle8i Enterprise Edition Release 8.1.7.0.1 - Production With the Partitioning option JServer Release 8.1.7.0.1 - Production
종료하기 [oracle@linux admin]$ svrmgrl
Oracle Server Manager Release 3.1.7.0.0 - Production
Copyright (c) 1997, 1999, Oracle Corporation. All Rights Reserved.
Oracle8i Enterprise Edition Release 8.1.7.0.1 - Production With the Partitioning option JServer Release 8.1.7.0.1 - Production
SVRMGR> connect internal Connected. SVRMGR> shutdown Database closed. Database dismounted. ORACLE instance shut down. SVRMGR> quit Server Manager complete. [oracle@linux admin]$ lsnrctl stop db
LSNRCTL for Linux: Version 8.1.7.0.0 - Production on 01-AUG-2003 03:56:48
(c) Copyright 1998 Oracle Corporation. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.2)(PORT=1521))) The command completed successfully [oracle@linux admin]$ namesctl stop
Oracle Names Control for Linux: Version 8.1.7.0.0 - Production on 01-AUG-2003 03:56:53
(c) Copyright 1997 Oracle Corporation. All rights reserved.
Currently managing name server "onames_dbakorea" Version banner is "Oracle Names for Linux: Version 8.1.7.0.0 - Production"
Confirm [yes or no]: yes Server shutting down [oracle@linux admin]$
윈도박스에서 테스트 D:>type C:oracleora81
etworkADMINsqlnet.ora # NAMES설정 #NAMES.DEFAULT_DOMAIN = world NAMES.DIRECTORY_PATH=(ONAMES, TNSNAMES) NAMES.PREFERRED_SERVERS = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.2)(PORT = 1575)) ) ) D:>tnsping db.world
TNS Ping Utility for 32-bit Windows: Version 8.1.7.0.0 - Production on 01-AUG-2003 04:04:06
(c) Copyright 1997 Oracle Corporation. All rights reserved.
Attempting to contact (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.2)(PORT=1521)) OK (10 msec)
D:>sqlplus kang/xxxxxx@db.world
SQL*Plus: Release 8.1.7.0.0 - Production on 금 Aug 1 04:04:14 2003
(c) Copyright 2000 Oracle Corporation. All rights reserved.
Connected to: Oracle8i Enterprise Edition Release 8.1.7.0.1 - Production With the Partitioning option JServer Release 8.1.7.0.1 - Production
SQL> select sysdate from dual;
SYSDATE -------- 03/08/01
SQL> quit Oracle8i Enterprise Edition Release 8.1.7.0.1 - Production With the Partitioning option JServer Release 8.1.7.0.1 - Production에서 분리되었습니다.
D:>
간단히 설정방법에 대해 실습위주로 설명했다. 자세한 개념이나 사용방법이 미흡한데 차후 기회가 되면 다시 자세히 적도록 하겠다.
참고사항 onames에 등록된 서비스정보는 checkpoint파일이라고 하는 캐쉬파일에 저장된다. $ORACLE_HOME/network/names/이하에 ckcfg.ora, ckpcch.ora, ckpreg.ora onames.ora파일을 설정하다 잘못될 경우, $ORACLE_HOME/network/names/이하의 캐쉬파일들을 모두 지우고 다시한다.
사실 오라클사는 Oracle name server보다는 미래에 directory server로 변경될 것이라고 한다. 배울 필요가 있으려나.. 흠..
도메인을 지정하여 테스트 내부 사설망에 company.com이라는 도메인(192.168.0.*)을 지정하고 해봤다. DNS를 구성하지 않고 호스트파일을 이용하여 다음과 같이 설정했다. /etc/hosts, $ORACLE_HOME/dbs/initdb.ora, names.ora, sqlnet.ora, listener.ora파일을 편집하고, global_name명을 적절히 변경해주었다.
[oracle@linux admin]$ cat /etc/hosts 127.0.0.1 linux localhost.localdomain localhost 192.168.0.1 win.company.com 192.168.0.2 linux.company.com db.company.com linux db
SVRMGR> alter database rename global_name to db.company.com; Statement processed. SVRMGR> select * from global_name; GLOBAL_NAME -------------------------------------------------------------------------------- DB.COMPANY.COM 1 row selected. SVRMGR>
[oracle@linux oracle]$ cat $ORACLE_HOME/dbs/initdb.ora db_name = "db" db_domain = company.com
instance_name = db
service_names = db.company.com 이하생략..
[oracle@linux oracle]$ cd $ORACLE_HOME/network/admin [oracle@linux admin]$ rm $ORACLE_HOME/network/names/*
[oracle@linux admin]$ cat names.ora names.server_name = onames_dbakorea names.addresses = (address= (protocol=tcp)(host=db.company.com)(port=1575)) names.domains = ( domain_list = (domain= (name=)(min_ttl=86400)) (domain= (name=company.com)(min_ttl=86400)) )
[oracle@linux admin]$ cat sqlnet.ora NAMES.DEFAULT_DOMAIN = company.com NAMES.DIRECTORY_PATH = (ONAMES) NAMES.PREFERRED_SERVERS = (ADDRESS = (PROTOCOL = TCP)(HOST = db.company.com)(PORT = 1575))
[oracle@linux admin]$ cat listener.ora use_plug_and_play_db = on
NAMES.PREFERRED_SERVERS = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = db.company.com)(PORT = 1575)) ) )
db = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = db.company.com)(PORT = 1521)) )
SID_LIST_db = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = db.company.com) (ORACLE_HOME = /u01/app/oracle/product/8.1.7) (SID_NAME = db) ) )
[oracle@linux admin]$ namesctl start [oracle@linux admin]$ lsnrctl start ..
윈도 D:>type c:winntsystem32driversetchosts 127.0.0.1 localhost 192.168.0.1 win.company.com win 192.168.0.2 linux.company.com db.company.com linux db
D:>type c:oracleora81
etworkadminsqlnet.ora # NAMES설정 #NAMES.DEFAULT_DOMAIN = company.com NAMES.DIRECTORY_PATH=(ONAMES, TNSNAMES) NAMES.PREFERRED_SERVERS = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = db.company.com)(PORT = 1575)) ) )
D:>tnsping db.company.com
TNS Ping Utility for 32-bit Windows: Version 8.1.7.0.0 - Production on 01-AUG-2003 14:38:12
(c) Copyright 1997 Oracle Corporation. All rights reserved.
Attempting to contact (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.2)(PORT=1521)) OK (10 msec)
D:>sqlplus kang/xxxxxx@db.company.com
참고 사이트 http://www.dbazine.com/liu1.html http://homepages.tig.com.au/~jmsalvo/linux/oracle8i-5.html
| This article comes from dbakorea.pe.kr (Leave this line as is)
|