<roidb01:cdb1:/home/oracle> $lsnrctl servicelsnrctl for linux:version 12.1.0.2.0-production on 06-mar-2018 06:52 : 45Copyright (c) 1991, Oracle. All rights reserved. Connecting to (Description= (address= (protocol=tcp) (HOST=ORCL)) Services port=1521 ... Service "CDB1" has 1 instance (s). Instance "CDB1", status ready, have 1 handler (s) for the This service ... Handler (s): "Dedicated" established:0 refused:0 state:ready LOCAL serverservice "Cdb1xdb" has 1 instance (s). Instance "CDB1", status ready, have 1 handler (s) for the 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, have 1 handler (s) for the This service ... Handler (s): "Dedicated" established:0 refused:0 state:ready LOCAL serverthe command completed SUCCESSFULLY<ROIDB01: Cdb1:/home/oracle> $SQL > Set line 120sql> Select NAMe,network_name,pdb from V$services;name network_name pdb--------------------------------------------------------- ---------------------------------sales sales1 pdb11pdb11 pdb11 pdb11cdb1xdb cdb1xdb cdb$rootcdb1 cdb1 cdb$rootsys$ BACKGROUND cdb$rootsys$users cdb$root6 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 pdb11sql> 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:04copyright (c) 1991, Oracle. All rights reserved. Connecting to (Description= (address= (protocol=tcp) (HOST=ORCL)) Services port=1521 ... Service "CDB1" has 1 insTance (s). Instance "CDB1", status ready, have 1 handler (s) for the This service ... Handler (s): "Dedicated" established:0 refused:0 state:ready LOCAL serverservice "Cdb1xdb" has 1 instance (s). Instance "CDB1", status ready, have 1 handler (s) for the 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, have 1 handler (s) for the This service ... Handler (s): "Dedicated" established:0 refused:0 state:ready LOCAL serverservice "Sales1" has 1 instance (s). # #服务已经通过pmon注册 Instance "cdb1", status ready, have 1 handler (s) for the This service ... Handler (s): "Dedicated" established:0 refused:0 state:ready LOCAL serverthe 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/[email Protected]:1521/sales1 as Sysdba # #通过服务名连接pdbSQL *plus:release 12.1.0.2.0 Production on Tue Mar 6 06:58:39 2018Copyright ( c) 1982, Oracle. All rights reserved. Connected to:oracle Database 12c Enterprise Edition Release 12.1.0.2.0-64bit productionwith The partitioning, OLAP, Adva nced Analytics and Real application testing optionssql> show PDBs con_id con_name OPEN MODE RESTRICTED---------------- --------------------------------------------3 PDB11 READ WRITE nosql> # #创建, start, close the service related commands, restart the service is lost, you can test your own sql> exec dbms_service.start_service (' sales ');P L/sql procedure successfully completed. sql> sql> exec dbms_service.stop_service (' sales ');P L/sql procedure successfully completed. sql> exec dbms_service.delete_service (' sales ');P L/sql procedure successfully completed. sql> exec dbms_service.create_service (' Sales ', ' Sales1 ');P L/sql procedure successfully completed.
12c connecting the PDB through the service