文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

12c通过service 连接pdb

2024-04-02 19:55

关注

<roidb01:cdb1:/home/oracle>$lsnrctl service

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 06-MAR-2018 06:52:45

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orcl)(PORT=1521)))
Services Summary...
Service "cdb1" has 1 instance(s).
  Instance "cdb1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "cdb1XDB" has 1 instance(s).
  Instance "cdb1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: roidb01, pid: 2787>
         (ADDRESS=(PROTOCOL=tcp)(HOST=roidb01)(PORT=17408))
Service "pdb11" has 1 instance(s).
  Instance "cdb1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
The command completed successfully
<roidb01:cdb1:/home/oracle>$

SQL> set line 120
SQL> select name,network_name,pdb from v$services;

NAME                           NETWORK_NAME                   PDB
------------------------------ ------------------------------ ------------------------------
sales                          sales1                         PDB11
pdb11                          pdb11                          PDB11
cdb1XDB                        cdb1XDB                        CDB$ROOT
cdb1                           cdb1                           CDB$ROOT
SYS$BACKGROUND                                                CDB$ROOT
SYS$USERS                                                     CDB$ROOT

6 rows selected.

SQL> 

SQL> alter session set container=pdb11;

Session altered.

SQL> select name,network_name,pdb from v$services;

NAME                           NETWORK_NAME                   PDB
------------------------------ ------------------------------ ------------------------------
sales                          sales1                         PDB11     ##手动创建的服务
pdb11                          pdb11                          PDB11

SQL> exec dbms_service.start_service('sales');   ##启动服务

PL/SQL procedure successfully completed.

SQL> 

<roidb01:cdb1:/u01/app/oracle/product/12.1.0/dbhome_1/network/admin>$lsnrctl service;

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 06-MAR-2018 06:58:04

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orcl)(PORT=1521)))
Services Summary...
Service "cdb1" has 1 instance(s).
  Instance "cdb1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "cdb1XDB" has 1 instance(s).
  Instance "cdb1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: roidb01, pid: 2787>
         (ADDRESS=(PROTOCOL=tcp)(HOST=roidb01)(PORT=17408))
Service "pdb11" has 1 instance(s).
  Instance "cdb1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "sales1" has 1 instance(s).    ##服务已经通过pmon注册
  Instance "cdb1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
The command completed successfully
<roidb01:cdb1:/u01/app/oracle/product/12.1.0/dbhome_1/network/admin>$

<roidb01:cdb1:/u01/app/oracle/product/12.1.0/dbhome_1/network/admin>$sqlplus sys/oracle@roidb01:1521/sales1 as sysdba   ##通过服务名连接pdb

SQL*Plus: Release 12.1.0.2.0 Production on Tue Mar 6 06:58:39 2018

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         3 PDB11                          READ WRITE NO
SQL> 

##创建、启动、关闭服务的相关命令,重启后服务丢失,大家可以自己测试
SQL> exec dbms_service.start_service('sales');

PL/SQL procedure successfully completed.

SQL> 
SQL> exec dbms_service.stop_service('sales');

PL/SQL procedure successfully completed.

SQL> exec dbms_service.delete_service('sales');

PL/SQL procedure successfully completed.

SQL> exec dbms_service.create_service('sales','sales1');

PL/SQL procedure successfully completed.
阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-数据库
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯