实验四 在tnsname.ora里添加默认监听代号
[oracle@oracle01 admin]$ vi tnsnames.ora
添加一行
PORT1528=(ADDRESS = (PROTOCOL = TCP)(HOST = oracle01)(PORT = 1528))
Sqlplus / as sysdba
SYS@KINGSQL>alter system set local_listener=PORT1528;
Lsnrctl stop lsnr2关闭监听
Lsnrctl start lsnr2启动监听
Lsnrctl status lsnr2查看监听状态 发现没有services
SYS@KINGSQL>alter system register;将数据库注册到监听
Lsnrctl status lsnr2查看监听状态
此时已经有了
Service "KINGSQL" has 1 instance(s).
Instance "KINGSQL", status READY, has 1 handler(s) for this service...
Service "KINGSQLXDB" has 1 instance(s).
Instance "KINGSQL", status READY, has 1 handler(s) for this service...
添加LSNR2的静态监听
[oracle@oracle01 admin]$ vi listener.ora
添加
SID_LIST_LSNR2 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = VDEDU02)
(ORACLE_HOME = /u01/app/oracle/product/11.2.4/dbhome_1)
(SID_NAME=KINGSQL)
))
Lsnrctl reload lsnr2重新加载LSNR2监听
sqlplus scott/oracle@oracle01:1528/VDEDU02
限定用户访问实验
[oracle@linux01 admin]$ cat sqlnet.ora
TCP.VALIDNODE_CHECKING=yes
TCP.EXCLUDED_NODES=(192.168.1.88)
TCP.INVITED_NODES=(192.168.1.129,192.168.193.148)
加密监听器实验
在listener.ora文件中加入
LOCAL_OS_AUTHENTICATION_lISTENER = OFF
[oracle@oracle01 admin]$ lsnrctl
LSNRCTL> change_password
LSNRCTL> set password
LSNRCTL> save_config
[oracle@oracle01 admin]$ lsnrctl reload listener
接下来监听任何操作都会报错
[oracle@oracle01 admin]$ lsnrctl status listener
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 04-JUN-2018 15:16:24
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle01)(PORT=1521)))
TNS-01169: The listener has not recognized the password
[oracle@oracle01 admin]$ lsnrctl 进入监听
LSNRCTL> set password 输入密码
便可以执行监听的任何操作
若想删去密码,进入Lsnrctl,输入change_password,新密码为空即可
如果忘记了密码ps -ef|grep lsnr_查看进程杀死进程,重新启动监听
而且要在listener.ora文件里删去密码相关的内容
LSNRCTL> set log_status off 关闭监听日志
实验七:将数据库服务推送到两个端口的监听
首先在listener.ora文件里加入两个新的监听分别对应两个端口
LSNR1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle01)(PORT = 1526))
(ADDRESS = (PROTOCOL = IPC)(KEY =EXTPROC1526))
)
)
LSNR2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle01)(PORT = 1528))
(ADDRESS = (PROTOCOL = IPC)(KEY =EXTPROC1528))
)
)
lsnrctl start lsnr1 启动lsnr1
lsnrctl start lsnr2 启动lsnr2
在tnsname.ora里写入端口代码
PORT_1526_1528 = (ADDRESS_LIST=
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle01)(PORT = 1528))
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle01)(PORT = 1526))
)
SQL> alter system set local_listener=PORT_1526_1528;
System altered.
SQL>shutdown immediate
SQL>startup
SQL>alter system register;
此时再查看lsnr1和lsnr2的状态,发现都已经有了实例