Forum Stats

  • 3,825,247 Users
  • 2,260,486 Discussions
  • 7,896,465 Comments

Discussions

Prevent creating a service named the same as an existing one in the same cluster

User51642 Yong Huang
User51642 Yong Huang Member Posts: 164 Bronze Badge
edited Sep 30, 2021 7:44PM in Database Ideas - Ideas

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.

User51642 Yong Huangsdstuber
2 votes

Active · Last Updated