网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

12c通过service连接pdb


$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 
         (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
$

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> 

$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 
         (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
$

$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.

文章名称:12c通过service连接pdb
文章起源:http://bjjierui.cn/article/jehgdi.html

其他资讯