Friday, February 12, 2016

12c: creating service on PDB

Update local_listener parameter for container database 

SQL> alter system set local_listener='tnc63.sfdc.sbc.com:1521';
System altered.

SQL> show parameter local_listener
NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener     string tnc63.sfdc.sbc.com:1521

 To create new service, alter session to Pluggable database "NSPDBA"

SQL> alter session set container=nspdba;
Session altered.

SQL> show con_name;
CON_NAME
------------------------------
NSPDBA

SQL> show parameter local_listener

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener     string tnc63.sfdc.sbc.com:1521


Create and start Service using DBMS_SERVICE as follows 

SQL> exec dbms_service.create_service('ovals','ovals');
PL/SQL procedure successfully completed.

SQL> exec dbms_service.start_service('ovals');
PL/SQL procedure successfully completed.

when ever new service is created on pluggable database, Background process PMON register's with database  listener 

[admind@tnc63 ~]$ lsnrctl status
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 12-FEB-2016 11:02:40
Copyright (c) 1991, 2014, 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.2.0 - Production
Start Date                12-FEB-2016 10:50:04
Uptime                    0 days 0 hr. 12 min. 36 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/admind/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/admind/diag/tnslsnr/tnc63/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=tnc63.sfdc.sbc.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=tnc63.sfdc.sbc.com)(PORT=5500))(Security=(my_wallet_directory=/u01/app/admind/product/12.1.0/dbhome_1/admin/admin/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "admin" has 1 instance(s).
  Instance "admin", status READY, has 1 handler(s) for this service...
Service "adminXDB" has 1 instance(s).
  Instance "admin", status READY, has 1 handler(s) for this service...
Service "nspdba" has 1 instance(s).
  Instance "admin", status READY, has 1 handler(s) for this service...
Service "ovals" has 1 instance(s).
  Instance "admin", status READY, has 1 handler(s) for this service...
The command completed successfully

Add following Entry in tnsnames.ora

OVALS =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.0.140)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ovals)
    )
  )

Try to connect to pluggable database using new service "ovals" created on pluggable database 

[admind@tnc63 ~]$ sqlplus nspdba/nspdba@ovals

SQL*Plus: Release 12.1.0.2.0 Production on Fri Feb 12 10:38:15 2016
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> 
SQL> show con_name;
CON_NAME
------------------------------
NSPDBA

Note: when ever you bounce the CDB ROOT database, you need to restart the service created on pluggable database 

---Nikhil Tatineni--
---12c: Pluggable database--

Querys to monitor RAC

following few  Query's will help to find out culprits-  Query to check long running transaction from last 8 hours  Col Sid Fo...