Discussions
Categories
- 17.9K All Categories
- 3.4K Industry Applications
- 3.3K Intelligent Advisor
- 62 Insurance
- 536K On-Premises Infrastructure
- 138.2K Analytics Software
- 38.6K Application Development Software
- 5.7K Cloud Platform
- 109.4K Database Software
- 17.5K Enterprise Manager
- 8.8K Hardware
- 71.1K Infrastructure Software
- 105.2K Integration
- 41.5K Security Software
Prevent creating a service named the same as an existing one in the same cluster

In one database cluster, you can accidentally create a service for database B and name the service the same as one for database A:
$ srvctl add service -d epmm -s yongtest -r epmm1,epmm2
$ srvctl start service -d epmm -s yongtest
$ srvctl add service -d epm -s yongtest -r epm1,epm2
$ srvctl start service -d epm -s yongtest
$ srvctl status service -d epm
Service yongtest is running on instance(s) epm1,epm2
$ srvctl status service -d epmm
Service yongtest is running on instance(s) epmm1,epmm2
The danger with two services named the same but run in two different databases is that a TNS entry that specifies the SCAN of the cluster and this service name (plus port, typically 1521) allows the client to try connecting to either of the databases. If the same user account happens to exist in both databases with the same password, the client could make changes to a wrong database some but not all the time when he connects.
The tool srvctl should check to see if the name of the service to be created already exists but runs in another database on this cluster. Although this doesn't prevent the problem if you run PL/SQL procedure dbms_service.create_service in one database which cannot check for existence of the service in another database, you almost always need to add the new service to GI anyway (if you created it with dbms_service earlier). You use srvctl to add service to GI, which can catch this error if srvctl is enhanced to detect that.