创建PDB时会自动创建它的默认service,名字与pdb名相同,此servcie是用于DBA管理的,尽量不要用于应用连接,因为没有SERIVE属性,用也无所谓

PDB数据库是以动态监听连接的,PDB无法使用静态服务( 因为PDB不是一个实例,无法使用SID作实例名)

When a PDB is created, a new default service for the PDB is created automatically, and this service has the same name as the PDB. You cannot manage this service, and it should only be used for administrative tasks. Do not use this default PDB service for applications. Always use user-defined services for applications because you can customize user-defined services to fit the requirements of your applications.

Note:

  1. Each database service name must be unique in a CDB, and each database service name must be unique within the scope of all the CDBs whose instances are reached through a specific listener.

When two or more CDBs on the same computer system use the same listener and two or more PDBs have the same service name in these CDBs, a connection that specifies this service name connects randomly to one of the PDBs with the service name. To avoid incorrect connections, ensure that all service names for PDBs are unique on the computer system, or configure a separate listener for each CDB on the computer system.

  1. When you unplug or drop a PDB, the services of the unplugged or dropped PDB are not removed automatically. You can remove these services manually.
  2. Do not associate a service with a proxy PDB.

Creating, Modifying, or Removing a Service for a PDB

You can create, modify, or remove a service with a PDB property.

You can do so in the following ways:

  1. If your single-instance database is being managed by Oracle Restart or your Oracle RAC database is being managed by Oracle Clusterware, then use the Server Control (SRVCTL) utility to create, modify, or remove the service.

To create a service for a PDB using the SRVCTL utility, use the add service command and specify the PDB in the -pdb parameter. If you do not specify a PDB in the -pdb parameter when you create a service, then the service is associated with the root.

You can use other SRVCTL commands to manage the service, such as the start service and stop service commands, even if they do not include the -pdb parameter.

  1. If your database is not being managed by Oracle Restart or Oracle Clusterware, then use the DBMS_SERVICE package to create or remove a database service.

To create a service with a PDB property set to a specific PDB using the DBMS_SERVICE package, run the CREATE_SERVICE procedure when the current container is that PDB. If you create a service using the CREATE_SERVICE procedure when the current container is the root, then the service is associated with the root.

Note: If your database is being managed by Oracle Restart or Oracle Clusterware, then use the SRVCTL utility to manage services. Do not use the DBMS_SERVICE package.

查看SERVICE:

col name format a20

col pdb format a20

select con_id,name, PDB from cdb_services;

COL NAME FORMAT A30

COL CON_NAME FORMAT A20

SELECT NAME,CON_NAME, CON_ID FROM V$ACTIVE_SERVICES;

  1. USING SRVCTL Utility

This example adds the salesrep service for the PDB salespdb in the CDB with DB_UNIQUE_NAME mycdb:

srvctl add service -db mycdb -service salesrep -pdb salespdb

Modifying the PDB Property of a Service Using the SRVCTL Utility

This example modifies the salesrep service in the CDB with DB_UNIQUE_NAME mycdb to associate the service with the hrpdb PDB:

$ srvctl modify service -db mycdb -service salesrep -pdb hrpdb

Removing a Service Using the SRVCTL Utility

$ srvctl remove service -db mycdb -service salesrep

  1. USING DBMS_SERVICE

SQL> Alter session set container=pdb1;

SQL> EXEC DBMS_SERVICE.CREATE_SERVICE(service_name => 'hr', network_name => 'hr');

SQL> EXEC DBMS_SERVICE.START_SERVICE(service_name => 'hr');

SQL> ALTER SYSTEM REGISTER;

连接PDB1:

$ lsnrctl status

$ sqlplus scott/tiger@127.0.0.1/hr

$ sqlplus scott/tiger@127.0.0.1/pdb1

SQL> EXEC DBMS_SERVICE.DISCONNECT_SESSION(

service_name => 'hr', disconnect_option=>DBMS_SERVICE.NOREPLAY);

SQL> EXEC DBMS_SERVICE.STOP_SESSION(service_name => 'hr');

SQL> Exec DBMS_SERVICE.DELETE_SERVICE('hr');

  1. PARAMETER SERVICE_NAMES

PDB是无法更改SERVICE_NAMES参数的,即此方法配置服务只能用于CDB$ROOT.

CDB$ROOT中使用ALTER SYSTEM SET SERVICE_NAMES会隐式在数据字典创建service,并自动开始此服务,可以使用dbms_service或srvctl来start/stop/modify/disconnect更改此服务,但不能删除它

Managing Services Associated with PDBs相关推荐

  1. 【跟我学oracle18c】第二十五天:Multitenant :15 管理PDBs

    15 Administering PDBs 管理PDBs包括连接到PDB.修改PDB和管理与PDBs关联的服务等任务. Note: 您可以使用SQL*Plus或Oracle SQL Developer ...

  2. 【跟我学oracle18c】第二十九天:Multitenant :19 Monitoring CDBs and PDBs

    全是数据字典 19 Monitoring CDBs and PDBs You can view information about CDBs and PDBs using SQL*Plus or SQ ...

  3. 快速了解Kubernetes微服务中的通信

    by Adam Henson 亚当·汉森(Adam Henson) 快速了解Kubernetes微服务中的通信 (A quick look at communication in Kubernetes ...

  4. Ansible 七(ad hoc任务)

    Ansible 七(ad hoc任务) ansible任务 ad hoc任务就是执行shell命令.或shell脚本. ansible ad-hoc命令 可以执行一些简单的命令,不需要将这些执行的命令 ...

  5. oracle clusterware 11g,Oracle11gR2clusterware启动顺序

    从1gR2起Oracle引入init.ohasd,将其配置在/etc/inittab中,用以启动和管理clusterware相关资源 Pre 11R2 /etc/inittab h1:2:res 从1 ...

  6. The World is Flat 世界是平坦的

    The World is Flat Thomas L Friedman To Matt and Kay and to Ron 世界是平坦的 --二十一世纪简史 作者:托马斯 L 弗里德曼 翻译:段胜全 ...

  7. Ambari 操作指南 (Ambari Operations) 之一

    1. Ambari 操作指南: 概述 (Ambari Operations: Overview) Hadoop 是用在商业主机网络集群上的大规模.分布式的数据存储和处理基础架构.监控和管理如此复杂的分 ...

  8. oracle clusterware 11g,Oracle 11gR2 clusterware启动顺序

    从1gR2起Oracle引入init.ohasd,将其配置在/etc/inittab中,用以启动和管理clusterware相关资源 Pre 11R2 /etc/inittab h1:2:respaw ...

  9. 如何使用Stunnel和redis-cli通过TLS连接到托管Redis实例

    介绍 (Introduction) A managed Redis instance can provide benefits like high availability and automated ...

最新文章

  1. 面试官问:Integer 如何实现节约内存和提升性能的?
  2. “秒杀”谷歌!这个生物科研工具,可爬取全网中外文献
  3. 2018人工智能前沿报告:深度学习的应用和价值
  4. P1903-[国家集训队]数颜色/维护队列【带修莫队】
  5. 【Linux分享】Linux常用命令+教程分享
  6. 独立版TP空间内核|知识付费小程序源码
  7. 固定资产拆分比例怎么计算_固定资产加速折旧优惠扩围!怎么计算、申报?这篇说全了...
  8. python全套完整教程-Python语言基础50课 全套完整版(含doc版)
  9. Redis主从复制知识点
  10. 【您还有心跳吗?超时机制分析 】
  11. 一本shell编程书籍上的有bug的shell程序,看谁能找出问题所在。
  12. Linux学习笔记(六) -- Anjuta软件主界面介绍
  13. 华为路由器IPv6 over IPv4 GRE隧道配置详解
  14. 移动网络安全_徐州市“移动杯”网络安全技能竞赛 即将开始!
  15. win10打开计算机加载很慢,解析为何win10系统中我的电脑打开速度很慢
  16. 知足知不足 有为有不为
  17. 创始人、CEO、总裁和董事长到底谁更大?
  18. Windows 环境搭建 git 服务
  19. 人类一败涂地怎么正在连接服务器,人类一败涂地联机显示正在连接服务器解决办法...
  20. 薛之谦丨当初不以他盛名而来,如今也不会因为诋毁而离开

热门文章

  1. rc.local简介
  2. 什么是DDD(领域驱动设计)? 这是我见过最容易理解的一篇关于DDD 的文章了
  3. 2021年最新Spring面试题,常见面试题及答案汇总
  4. python写彩票预测软件_python入门教程NO.6 用python做个简单的彩票号码统计分析工具...
  5. idea远程连接hive
  6. 基于C++MFC的网络安全扫描器的设计与实现
  7. 3D建模需要学多久可以学会?
  8. 爬虫(成都58同城所有房价,Python实现)
  9. 基于STM32的录音机设计(STM32F103+VS1053B)
  10. QTP脚本运行次数的设置