当前位置:数据库 > Oracle >>

Oracle 12cR1 RAC Creating Services with PDBs

Oracle 12cR1 RAC Creating Services with PDBs
 
OracleOracle RACOracle Database 12c
check the open modes of all the PDBs on a RAC instance when you connect to the CDB root
[oracle@zhongwc1 ~]$ cat /etc/redhat-release   
Red Hat Enterprise Linux Server release 6.4 (Santiago)  
[oracle@zhongwc1 ~]$ sqlplus  / as sysdba  
  
SQL*Plus: Release 12.1.0.1.0 Production on Mon Oct 14 20:12:25 2013  
  
Copyright (c) 1982, 2013, Oracle.  All rights reserved.  
  
  
Connected to:  
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production  
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,  
Advanced Analytics and Real Application Testing options  
  
SQL> select name,open_mode from v$pdbs;  
  
NAME                           OPEN_MODE  
------------------------------ ----------  
PDB$SEED                       READ ONLY  
ZHONGWC1                       READ WRITE  
ZHONGWC2                       READ WRITE  
  
SQL>   

The default database service with the same name as the PDB is created automatically during PDB creation. You should only use this default service to connect to the PDB for administrative tasks. For applications to access the PDB, you need to create user-defined services for the PDB. In Oracle 12c, the database service has an optional PDB property which allows you to create a database service that is associated with a PDB.
[oracle@zhongwc1 ~]$ srvctl add service -db zwc -service crm -pdb zhongwc1 -preferred zwc1  
[oracle@zhongwc1 ~]$ srvctl add service -db zwc -service erp -pdb zhongwc1 -preferred zwc2  
SQL> select name,pdb from dba_services;  
  
NAME                 PDB  
-------------------- --------------------  
SYS$BACKGROUND       CDB$ROOT  
SYS$USERS            CDB$ROOT  
zwcXDB               CDB$ROOT  
zwc                  CDB$ROOT  
  
SQL> conn sys/oracle10gOCP@zhongwc-cluster-scan:1521/zhongwc1 as sysdba  
Connected.  
SQL> select name,pdb from dba_services;  
  
NAME                 PDB  
-------------------- --------------------  
zhongwc1             ZHONGWC1  
  
SQL> show pdbs  
  
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED  
---------- ------------------------------ ---------- ----------  
         3 ZHONGWC1                       READ WRITE NO  

Start service
[oracle@zhongwc1 ~]$ srvctl config service -db zwc  
Service name: crm  
Service is enabled  
Server pool: zwc_crm  
Cardinality: 1  
Disconnect: false  
Service role: PRIMARY  
Management policy: AUTOMATIC  
DTP transaction: false  
AQ HA notifications: false  
Global: false  
Commit Outcome: false  
Failover type:   
Failover method:   
TAF failover retries:   
TAF failover delay:   
Connection Load Balancing Goal: LONG  
Runtime Load Balancing Goal: NONE  
TAF policy specification: NONE  
Edition:   
Pluggable database name: zhongwc1  
Maximum lag time: ANY  
SQL Translation Profile:   
Retention: 86400 seconds  
Replay Initiation Time: 300 seconds  
Session State Consistency:   
Preferred instances: zwc1  
Available instances:   
Service name: erp  
Service is enabled  
Server pool: zwc_erp  
Cardinality: 1  
Disconnect: false  
Service role: PRIMARY  
Management policy: AUTOMATIC  
DTP transaction: false  
AQ HA notifications: false  
Global: false  
Commit Outcome: false  
Failover type:   
Failover method:   
TAF failover retries:   
TAF failover delay:   
Connection Load Balancing Goal: LONG  
Runtime Load Balancing Goal: NONE  
TAF policy specification: NONE  
Edition:   
Pluggable database name: zhongwc1  
Maximum lag time: ANY  
SQL Translation Profile:   
Retention: 86400 seconds  
Replay Initiation Time: 300 seconds  
Session State Consistency:   
Preferred instances: zwc2  
Available instances:   
[oracle@zhongwc1 ~]$ srvctl status service -db zwc -service erp  
Service erp is not running.  
[oracle@zhongwc1 ~]$ srvctl status service -db zwc -service crm  
Service crm is not running.  
[oracle@zhongwc1 ~]$ srvctl start service -db zwc -service erp  
[oracle@zhongwc1 ~]$ srvctl start service -db zwc -service crm  
[oracle@zhongwc1 ~]$   
[oracle@zhongwc1 ~]$   
[oracle@zhongwc1 ~]$ srvctl status service -db zwc -service crm  
Service crm is running on instance(s) zwc1  
[oracle@zhongwc1 ~]$ srvctl status service -db zwc -service erp  
Service erp is running on instance(s) zwc2  

Check the status of the zhongwc1 PDB
[oracle@zhongwc1 ~]$ sqlplus  / as sysdba  
  
SQL*Plus: Release 12.1.0.1.0 Production on Mon Oct 14 20:31:14 2013  
  
Copyright (c) 1982, 2013, Oracle.  All rights reserved.  
  
  
Connected to:  
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production  
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,  
Advanced Analytics and Real Application Testing options  
  
SQL> col pdb for a20  
SQL> col name for a20  
SQL> show con_name  
  
CON_NAME  
------------------------------  
CDB$ROOT  
SQL> select name,pdb from dba_services;  
  
NAME                 PDB  
-------------------- --------------------  
SYS$BACKGROUND       CDB$ROOT  
SYS$USERS            CDB$ROOT  
zwcXDB               CDB$ROOT  
zwc                  CDB$ROOT  
  
SQL>   
SQL>   
SQL>   
SQL> conn sys/oracle10gOCP@zhongwc-cluster-scan:1521/zhongwc1 as sysdba  
Connected.  
SQL> select name,pdb from dba_services;  
  
NAME                 PDB  
-------------------- --------------------  
zhongwc1             ZHONGWC1  
erp                  ZHONGWC1  
crm                  ZHONGWC1  
  
SQL>   
[root@zhongwc2 ~]# crsctl stat res ora.zwc.erp.svc  
NAME=ora.zwc.erp.svc  
TYPE=ora.service.type  
TARGET=ONLINE  
STATE=ONLINE on zhongwc2  
  
[root@zhongwc2 ~]#   
[root@zhongwc2 ~]#   
[root@zhongwc2 ~]#   
[root@zhongwc2 ~]# crsctl stat res ora.zwc.crm.svc  
NAME=ora.zwc.crm.svc  
TYPE=ora.service.type  
TARGET=ONLINE  
STATE=ONLINE on zhongwc1  
[oracle@zhongwc1 ~]$ lsnrctl status  
  
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 14-OCT-2013 20:33:47  
  
Copyright (c) 1991, 2013, Oracle.  All rights reserved.  
  
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))  
STATUS of the LISTENER  
------------------------  
Alias                     LISTENER  
Version                   TNSLSNR for Linux: Version 12.1.0.1.0 - Production  
Start Date                14-OCT-2013 19:38:33  
Uptime                    0 days 0 hr. 55 min. 14 sec  
Trace Level               off  
Security                  ON: Local OS Authentication  
SNMP                      OFF  
Listener Parameter File   /u01/app/12.1.0/grid/network/admin/listener.ora  
Listener Log File         /u01/app/grid/diag/tnslsnr/zhongwc1/listener/alert/log.xml  
Listening Endpoints Summary...  
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))  
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.31)(PORT=1521)))  
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.131)(PORT=1521)))  
Services Summary...  
Service "+ASM" has 1 instance(s).  
  Instance "+ASM1", status READY, has 1 handler(s) for this service...  
Service "-MGMTDBXDB" has 1 instance(s).  
  Instance "-MGMTDB", status READY, has 1 handler(s) for this service...  
Service "_mgmtdb" has 1 instance(s).  
  Instance "-MGMTDB", status READY, has 2 handler(s) for this service...  
Service "crm" has 1 instance(s).  
  Instance "zwc1", status READY, has 1 handler(s) for this service...  
Service "zhongwc1" has 1 instance(s).  
  Instance "zwc1", status READY, has 1 handler(s) for this service...  
Service "zhongwc2" has 1 instance(s).  
  Instance "zwc1", status READY, has 1 handler(s) for this service...  
Service "zwc" has 1 instance(s).  
  Instance "zwc1", status READY, has 1 handler(s) for this service...  
Service "zwcXDB" has 1 instance(s).  
  Instance &q
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,