Linux公社论坛

 找回密码
 注册
查看: 306|回复: 0

[基础知识] Oracle新增服务名

[复制链接]

1

主题

0

听众

3

积分

新手上路

Rank: 1

pmdynasty 发表于 2019-12-10 10:22:36 |显示全部楼层
1、查看当前服务名
show parameter service_names;

SQL> show parameter service_names;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      test01
SQL>


2、修改服务名
alter system set service_names='test01,test11' scope=both;

SQL> alter system set service_names='test01,test11' scope=both;

System altered.


3、查看当前服务名
SQL> show parameter service_names;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      test01,test11


4、查看监听状态
[oracle@sv-test01 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 21-MAY-2019 16:14:56

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=sv-test01.jnpc.nux)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                19-FEB-2019 09:02:20
Uptime                    91 days 7 hr. 12 min. 36 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/oracle/product/11.2/network/admin/listener.ora
Listener Log File         /u01/oracle/diag/tnslsnr/sv-test01/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sv-test01.jnpc.nux)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "test01" has 1 instance(s).
  Instance "test01", status READY, has 1 handler(s) for this service...
Service "test01XDB" has 1 instance(s).
  Instance "test01", status READY, has 1 handler(s) for this service...
Service "test11" has 1 instance(s).
  Instance "test01", status READY, has 1 handler(s) for this service...
The command completed successfully

5、测试连接
sqlplus system/oracle@192.168.16.162/test01
sqlplus system/oracle@192.168.16.162/test11


[oracle@sv-test02 ~]$ sqlplus system/oracle@192.168.16.162/test01

SQL*Plus: Release 12.2.0.1.0 Production on Tue May 21 16:17:37 2019

Copyright (c) 1982, 2016, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
[oracle@sv-test02 ~]$ sqlplus system/oracle@192.168.16.162/test11

SQL*Plus: Release 12.2.0.1.0 Production on Tue May 21 16:17:55 2019

Copyright (c) 1982, 2016, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

6、验证连接

col paddr format a20
col Sid format 9999999
col username format a15
col service_name format a20
Select paddr,Sid,serial#,username,service_name From v$session  Where username Is Not Null;

SQL> col paddr format a20
SQL> col Sid format 9999999
SQL> col username format a15
SQL> col service_name format a20
SQL> /

PADDR                     SID    SERIAL# USERNAME        SERVICE_NAME
-------------------- -------- ---------- --------------- --------------------
00000000BF527060           24        757 SYSTEM          test01
00000000BF51D9E8          141        375 SYSTEM          test11
00000000BF52A288          150        957 SYS             SYS$USERS
00000000BF528118          151        901 SYSTEM          test11
您需要登录后才可以回帖 登录 | 注册

关注Linux公社官方微信,免费领取邀请码。

手机版|Linux公社(LinuxIDC.com)旗下网站【www.linuxidc.net】

GMT+8, 2020-2-24 06:05 , Processed in 1.043059 second(s), 13 queries , Wincache On.

Powered by Discuz! X 3.2

© 2010-2016 Comsenz Inc.

回顶部