cd $ORACLE_HOME/network/admin/sample
配置监听
# LISTENER =
# (ADDRESS_LIST=
# (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))
# (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
# (ADDRESS_LIST=
# (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))
# (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
# SID_LIST_
# List of services the listener knows about and can connect
# clients to. There is no default. See the Net8 Administrator's
# Guide for more information.
#
# SID_LIST_LISTENER=
# (SID_LIST=
# (SID_DESC=
# #BEQUEATH CONFIG
# (GLOBAL_DBNAME=salesdb.mycompany)
# (SID_NAME=sid1)
# (ORACLE_HOME=/private/app/oracle/product/8.0.3)
# #PRESPAWN CONFIG
# (PRESPAWN_MAX=20)
# (PRESPAWN_LIST=
# (PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1))
# )
# )
# )
# List of services the listener knows about and can connect
# clients to. There is no default. See the Net8 Administrator's
# Guide for more information.
#
# SID_LIST_LISTENER=
# (SID_LIST=
# (SID_DESC=
# #BEQUEATH CONFIG
# (GLOBAL_DBNAME=salesdb.mycompany)
# (SID_NAME=sid1)
# (ORACLE_HOME=/private/app/oracle/product/8.0.3)
# #PRESPAWN CONFIG
# (PRESPAWN_MAX=20)
# (PRESPAWN_LIST=
# (PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1))
# )
# )
# )
把sample 下的 上面的东西CP 到 listener.ora
修改
1. 去掉
# #PRESPAWN CONFIG
# (PRESPAWN_MAX=20)
# (PRESPAWN_LIST=
# (PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1))
# )
# (PRESPAWN_MAX=20)
# (PRESPAWN_LIST=
# (PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1))
# )
2. 修改
(SID_NAME=sid1) ----修改为 (SID_NAME=orcl)
(GLOBAL_DBNAME=salesdb.mycompany) ----修改为 (GLOBAL_DBNAME=orcl)
(ORACLE_HOME=/private/app/oracle/product/8.0.3) ----修改为 (ORACLE_HOME=/oracle/product/10.2.0)
3. 去掉
# SID_LIST_
# List of services the listener knows about and can connect
# clients to. There is no default. See the Net8 Administrator's
# Guide for more information.
#
# List of services the listener knows about and can connect
# clients to. There is no default. See the Net8 Administrator's
# Guide for more information.
#
4. 修改
HOST=localhost ---修改为 HOST=192.168.1.10
HOST=localhost ---修改为 HOST=192.168.1.10
5. 把所有的# 去掉
:%s/#//g
:%s/#//g
stty erase 按住 ctl 加 vh 就可以用退格键代替DELETE
配置 tnsnames.ora
(DESCRIPTION=
[ (SDU=2048) ] # Optional, defaults to 2048
# Can take values between 512 and 32K
[ (ADDRESS_LIST= # Optional depending on whether u have
# one or more addresses
# If there is just one address, unnecessary ]
(ADDRESS=
[ (COMMUNITY=) ]
(PROTOCOL=tcp)
(HOST=)
(PORT=)
)
[ (CONNECT_DATA=
(SID=)
[ (GLOBAL_NAME=) ]
)
]
1. 把 tnsnames.ora 上面的文件 CP 过来
[ (SDU=2048) ] # Optional, defaults to 2048
# Can take values between 512 and 32K
[ (ADDRESS_LIST= # Optional depending on whether u have
# one or more addresses
# If there is just one address, unnecessary ]
(ADDRESS=
[ (COMMUNITY=) ]
(PROTOCOL=tcp)
(HOST=)
(PORT=)
)
[ (CONNECT_DATA=
(SID=)
[ (GLOBAL_NAME=) ]
)
]
1. 把 tnsnames.ora 上面的文件 CP 过来
vi tnsnames.ora
ORCL =
(DESCRIPTION=
[ (SDU=2048) ] # Optional, defaults to 2048
# Can take values between 512 and 32K
[ (ADDRESS_LIST= # Optional depending on whether u have
# one or more addresses
# If there is just one address, unnecessary ]
(ADDRESS=
[ (COMMUNITY=) ]
(PROTOCOL=tcp)
(HOST=)
(PORT=)
)
[ (CONNECT_DATA=
(SID=)
[ (GLOBAL_NAME=) ]
)
]
(DESCRIPTION=
[ (SDU=2048) ] # Optional, defaults to 2048
# Can take values between 512 and 32K
[ (ADDRESS_LIST= # Optional depending on whether u have
# one or more addresses
# If there is just one address, unnecessary ]
(ADDRESS=
[ (COMMUNITY=) ]
(PROTOCOL=tcp)
(HOST=)
(PORT=)
)
[ (CONNECT_DATA=
(SID=)
[ (GLOBAL_NAME=) ]
)
]
去掉一下几个
[ (SDU=2048) ] # Optional, defaults to 2048
# Can take values between 512 and 32K
# Can take values between 512 and 32K
# one or more addresses
# If there is just one address, unnecessary ]
[ (COMMUNITY=) ]
ORCL =
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=192.168.1.10)
(PORT=1521)
)
)
(CONNECT_DATA=
(SID=orcl)
)
)
ORCL =
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=tcp) (HOST=192.168.1.10)(PORT=1521)
)
)
(CONNECT_DATA=(SID=orcl) )
)
我们可以看出有以下规律
=========================================================
第一部分
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=tcp) (HOST=192.168.1.10)(PORT=1521)
)
)
========================================================
第二部分
(CONNECT_DATA=(SID=orcl) )
==========================================
第三部分
(DESCRIPTION=
)
====================================================
orcl =
(DECRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=192.168.1.10)
(PORT=1521)
)
)
(CONNECT_DATA=
(SID=orcl)
)
)
# If there is just one address, unnecessary ]
[ (COMMUNITY=) ]
ORCL =
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=192.168.1.10)
(PORT=1521)
)
)
(CONNECT_DATA=
(SID=orcl)
)
)
ORCL =
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=tcp) (HOST=192.168.1.10)(PORT=1521)
)
)
(CONNECT_DATA=(SID=orcl) )
)
我们可以看出有以下规律
=========================================================
第一部分
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=tcp) (HOST=192.168.1.10)(PORT=1521)
)
)
========================================================
第二部分
(CONNECT_DATA=(SID=orcl) )
==========================================
第三部分
(DESCRIPTION=
)
====================================================
orcl =
(DECRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=192.168.1.10)
(PORT=1521)
)
)
(CONNECT_DATA=
(SID=orcl)
)
)
ORCL =
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=tcp) (HOST=192.168.1.10)(PORT=1521)
)
)
(CONNECT_DATA=(SID=orcl) )
)
在配置的时候,需要注意以下几个问题 :
1. 保证开头的ORCL 中没有空格
SQL> alter system set local_listener='(ADDRESS=(PROTOCOL=tcp)(HOST=node1)(PORT=1522))';
System altered.
[oracle@node1 admin]$ more listener.ora
LISTENER =
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1522))
(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
LISTENER =
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1522))
(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=orcl)
(SID_NAME=orcl)
(ORACLE_HOME=/oracle/product/10.2.0)
)
)
[oracle@node1 admin]$ lsnrctl start
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=orcl)
(SID_NAME=orcl)
(ORACLE_HOME=/oracle/product/10.2.0)
)
)
[oracle@node1 admin]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 24-MAR-2011 12:23:23
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Starting /oracle/product/10.2.0/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.4.0 - Production
System parameter file is /oracle/product/10.2.0/network/admin/listener.ora
Log messages written to /oracle/product/10.2.0/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1522)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
System parameter file is /oracle/product/10.2.0/network/admin/listener.ora
Log messages written to /oracle/product/10.2.0/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1522)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1522))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 24-MAR-2011 12:23:23
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/10.2.0/network/admin/listener.ora
Listener Log File /oracle/product/10.2.0/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@node1 admin]$
[oracle@node1 admin]$
[oracle@node1 admin]$
[oracle@node1 admin]$
[oracle@node1 admin]$
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 24-MAR-2011 12:23:23
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/10.2.0/network/admin/listener.ora
Listener Log File /oracle/product/10.2.0/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@node1 admin]$
[oracle@node1 admin]$
[oracle@node1 admin]$
[oracle@node1 admin]$
[oracle@node1 admin]$
SQL> startup
ORACLE instance started.
Total System Global Area 524288000 bytes
Fixed Size 2085256 bytes
Variable Size 155192952 bytes
Database Buffers 360710144 bytes
Redo Buffers 6299648 bytes
Database mounted.
Database opened.
SQL>
Fixed Size 2085256 bytes
Variable Size 155192952 bytes
Database Buffers 360710144 bytes
Redo Buffers 6299648 bytes
Database mounted.
Database opened.
SQL>
[oracle@node1 admin]$ more tnsnames.ora
orcl =
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=192.168.1.10)
(PORT=1522)
)
)
(CONNECT_DATA=
(SID=orcl)
)
)
[oracle@node1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Mar 24 12:26:12 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter local
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string
log_archive_local_first boolean TRUE
SQL> alter system set local_listener='(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1522))';
------------------------------------ ----------- ------------------------------
local_listener string
log_archive_local_first boolean TRUE
SQL> alter system set local_listener='(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1522))';
System altered.
SQL>
[oracle@node1 admin]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 24-MAR-2011 12:36:43
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1522))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 24-MAR-2011 12:32:00
Uptime 0 days 0 hr. 4 min. 43 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/10.2.0/network/admin/listener.ora
Listener Log File /oracle/product/10.2.0/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
Services Summary...
Service "orcl" has 2 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl_XPT" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 24-MAR-2011 12:32:00
Uptime 0 days 0 hr. 4 min. 43 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/10.2.0/network/admin/listener.ora
Listener Log File /oracle/product/10.2.0/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
Services Summary...
Service "orcl" has 2 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl_XPT" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
UNKNOWN 状态是静态注册
READY 状态是动态注册
READY 状态是动态注册
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/66233/viewspace-690395/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/66233/viewspace-690395/