Some situations, you need different service name/ database connection name for your pluggable database ( RAC & Non-RAC). You can follow below steps to complete the task.
Steps for Creating a new Service for a PDB
Step 1. Change to pdb container;
alter session set container=pdb1;
Step 2. Create service for current pdb using name and new network service name.
ALTER SESSION SET CONTAINER=PAUENO;
exec dbms_service.create_service('<service_name>','<network_name>');
exec dbms_service.create_service('pdb1svc','pdb1svc');
Step 3. Start the new service.
exec dbms_service.start_service('pdb1svc');
alter system register;
To Verify:
COLUMN name FORMAT A30
COLUMN network_name FORMAT A30
SELECT name,
network_name
FROM dba_services
ORDER BY 1;
Step 4. Check the listener services and try to make a new connection to the newly created services.
lsnrctl services
Step 5. Save the state for PDB.
Need to save the state for pluggable for the new pdb service. Otherwise, you need to manually start the service after you restart the pdb or bounce the CDB ROOT database.
alter pluggable database save state;