++ Connecting via rman to CDBROOT and running commands fail with below error showing rman is connected to PDB instead of CDBROOT :
rman target 'sys@"<scan_name>.<domain_name>:1521/<db_unique_name>.<domain_name>:DEDICATED"'
Recovery Manager: Release 12.1.0.2.0 - Production on Wed Jun 7 13:38:56 2023
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
target database Password:
connected to target database: DBA21CDB (DBID=1393061330)
RMAN> configure compression algorithm 'low';
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 06/07/2023 13:39:23
RMAN-07536: command not allowed when connected to a Pluggable Database
Cause
++ Connecting from sqlplus using same connect string shows connections are going to PDB instead of CDB$ROOT :
sqlplus 'sys@"<scan_name>.<domain_name>:1521/<db_unique_name>.<domain_name>:DEDICATED" as sysdba'
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
3 PDB1 READ WRITE NO
++ Output of below query shows service is pointing to PDB (con_id=3) instead of CDB$ROOT :
select name, network_name, con_id# from cdb_service$;
<db_unique_name>.<domain_name> <db_unique_name>.<domain_name> 3 <<<<<<<<<<<<<<<<<<<service is pointing to CON_ID 3
Solution
Drop and recreate the service for CDB
OR
- update cdb_service$ with correct container id for PDB service -
sql> update cdb_service$ set con_id#=1 where name='<db_unique_name>.<domain_name> ';
SQL> commit;
- Restart CDB using srvctl
srvctl stop databsae -db <db_unique_name>
srvctl start database -db <db_unique_name>
- After restart again check cdb_service$ is pointing to CON_ID# 1
SQL> select name, network_name, con_id# from cdb_service$
<db_unique_name>.<domain_name> <db_unique_name>.<domain_name> 1