Saturday, 11 March 2017

ORA-65149: PDB name conflicts with existing service name

During my recent non-CDB to PDB conversion, I got the error:

ORA-65149: PDB name conflicts with existing service name in the CDB or the PDB

Its a bit weird because the non-CDB database was still not plugged-in and was just checked for compatibility using procedure..



SET SERVEROUTPUT ON
DECLARE
compatible CONSTANT VARCHAR2(3) :=
CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
pdb_descr_file => '/tmp/noncdb_pdb.xml',
pdb_name => 'PINDBA')
WHEN TRUE THEN 'YES'
ELSE 'NO'
END;
BEGIN
DBMS_OUTPUT.PUT_LINE(compatible);
END;
/

With this error in plugging-in database, I could see there was this warning appearing in PDB_PLUG_IN_VIOLATIONS view

NAME    CAUSE                    TYPE  
------- --------------------- -------
IONDBA  Service Name Conflict WARNING

MESSAGE                         
---------------------------------
Service name or network name of 
service IONDBA in the PDB is
invalid or conflicts with an
existing service name or network
name in the CDB.


The message is pretty clear that the service name IONDBA in PDB conflicts with service name in CDB.

So I checked what services are listed in CDB (root container):

SELECT name,
network_name
FROM   dba_services
ORDER BY name
/

NAME                 NETWORK_NAME
-------------------- ------------
IONDBA               IONDBA
SYS$BACKGROUND
SYS$USERS


There it is, lets delete this service and try CREATE PLUGGABLE DATABASE:

SQL> exec DBMS_SERVICE.DELETE_SERVICE('IONDBA');

PL/SQL procedure successfully completed.


Ran compatibility check again and the warning disappeared from PDB_PLUG_IN_VIOLATIONS.

This time the database was plugged-in without issues:

SQL> CREATE PLUGGABLE DATABASE IONDBA USING '/tmp/noncdb_pdb.xml'
NOCOPY TEMPFILE REUSE;

Pluggable Database Created.

Seems like the problem was because I migrated the listener.ora from old 11g home and it dynamically registered its services to CDB. Also updated listener.ora afterwards.

Cheers!
Anurag

Thursday, 9 March 2017

Oracle 12c Agent Blocked due to Plugin Mismatch [NOT_FOUND_IN_INPUT]

I recently ran into this problem when Oracle Management Agent 12c was in blocked state and was showing below errors:

Run below query as SYSMAN on repository database. Provide hostname of blocked agent when prompted:



SQL> select * from mgmt_blocked_agents where TARGET_GUID in (select target_guid from mgmt_targets where lower(target_name) like '%&hostname%');

TARGET_GUID                      BLOCKED_T
-------------------------------- ---------
BLOCKED_BY
------------------------------------------------------------------------------------------------------------------------------------------------------
BLOCKED_REASON_MSG
------------------------------------------------------------------------------------------------------------------------------------------------------
BLOCKED_REASON_NLS_ID
----------------------------------------------------------------
BLOCKED_REASON_NLS_PARAMS
------------------------------------------------------------------------------------------------------------------------------------------------------
016FFE88BD675EE4DBD5E5ACD779314B 08-MAR-17
SYSMAN
Plugin mismatches between agent and repository. Check plugin:[ The plug-in is oracle.sysman.db
Version in pla inventory : 12.1.0.2.0
Version on agent : null
Content type : AGENT
Error code : NOT_FOUND_IN_INPUT
Error Msg : This plug-in is present in the inventory for the given agent but has not been provided in the input,  The plug-in is oracle.sysman.oh
Version in pla inventory : 12.1.0.2.0
Version on agent : null
Content type : AGENT
Error code : NOT_FOUND_IN_INPUT
Error Msg : This plug-in is present in the inventory for the given agent but has not been provided in the input,  The plug-in is oracle.sysman.db
Version in pla inventory : 12.1.0.2.0
Version on agent : null
Content type : DISCOVERY
Error code : NOT_FOUND_IN_INPUT
Error Msg : This plug-in is present in the inventory for the given agent but has not been provided in the input,  The plug-in is oracle.sysman.oh
Version in pla inventory : 12.1.0.2.0
Version on agent : null
Content type : DISCOVERY
Error code : NOT_FOUND_IN_INPUT
Error Msg : This plug-in is present in the inventory for the given agent but has not been provided in the input]
BLK_AGENT_FOR_MISMATCH


The problem actually started when agent had gone out-of-sync from repository:



INFO - Reason the OMS blocked the agent: Agent is out-of-sync with repository. This most likely means that the agent was reinstalled or recovered. Please contact an EM administrator to unblock the agent by performing an agent resync from the console.


This should be resolved by re-synchronizing the agent via OEM or command-line:

1. Using OEM Console
   Navigate to All Targets > Agent Running on Host >Agent Menu > Resynchronization
   This would submit the job for resync

OR

2. Using command-line
   Set environment for OMS on host where OMS is running
   $ emcli login -username=SYSMAN
   $ emcli sync
   $ emcli resyncAgent -Agent="Agent_Hostname:Port"


However, in my case the resync resulted in success but still the agent was not unblocked and errors were still appearing in EM.

I went ahead and investigated resync logfiles on agent host under "/<Agent_Dir>/agent_inst/install/logs" and found

below errors in: agentplugindeploy_29.log
--------------------------------------------------------
The attachhome /usr/oracle/agent12c/core/12.1.0.2.0/oui/bin/runInstaller  -attachHome -silent -waitforcompletion
-invPtrLoc /usr/oracle/agent12c/core/12.1.0.2.0/oraInst.loc ORACLE_HOME=/usr/oracle/agent12c/core/12.1.0.2.0/../../plugins/oracle.sysman.oh.discovery.plugin_12.1.0.2.0
ORACLE_HOME_NAME=oracle_sysman_oh_12_1_0_2_0_discovery_Home4 "HOME_DEPENDENCY_LIST={/usr/oracle/agent12c/core/12.1.0.2.0/../../plugins/oracle.sysman.oh.discovery.plugin_12.1.0.2.0:/usr/oracle/agent12c/core/12.1.0.2.0}" 
-force -ignoreSysPrereqs   failed : trying for 1 time  return value is : 65280

--------------------------------------------------------
 
and more errors in: agentplugindeploy_29.log.err
--------------------------------------------------------
You do not have sufficient permissions to access the inventory '/usr/oracle/11.2.0.1'.
Installation cannot continue. Make sure that you have read/write permissions to the inventory directory and restart the installer.:
The file access permissions do not allow the specified action.
--------------------------------------------------------



This error indicates that resync operation is not able to access local inventory of an Oracle Home (/usr/oracle/11.2.0.1). The home was actually empty and owned by root:system. This must have been left out due to improper deinstallation of old home.

$ ls -a /usr/oracle/11.2.0.1
.   ..

$ ls -ld /usr/oracle/11.2.0.1
drwxr-xr-x    2 root     system          256 29 Nov 2012  /usr/oracle/11.2.0.1


Since the ownership was not correct and the directory wasn't accessible, this needed to be fixed.

$ chown oracle:dba /usr/oracle/11.2.0.1
$ ls -ld /usr/oracle/11.2.0.1
drwxr-xr-x    2 oracle     dba          256 29 Nov 2012  /usr/oracle/11.2.0.1

I re-submitted resync job and the problem was resolved.

Cheers!
Anurag