HiveBrain v1.2.0
Get Started
← Back to all entries
debugMinor

Cannot change service name for Oracle

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
cannotservicenamefororaclechange

Problem

I'm trying to change the service name of an Oracle 11.2.0.3 installation on a Windows 2003 server.

During installation the service name was defined with the default domain, but we'd like to get rid of that.

What I have done so far (and what has worked before) to change the service name mydb.foo.bar to mydb only:

alter system set service_names = 'mydb' scope = both;
alter database rename global_name to mydb;


Which seems to have worked:

SQL> show parameter name

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string mydb
db_unique_name string mydb
global_names boolean FALSE
instance_name string mydb
service_names string mydb
SQL>

(I removed some properties from the above output which are not relevant)

Then use alter system register to re-register with the listener.

This showed no effect so I restarted the database and the listener, still no luck.

The current situation is as follows:

select name from v$active_services returns:

SERVICE_ID | NAME | NETWORK_NAME
-----------+-----------------+--------------------
1 | SYS$BACKGROUND |
2 | SYS$USERS |
3 | mydb | mydb
5 | mydbXDB | mydbXDB
6 | mydb.foo.bar | mydb.foo.bar

So for some reason the old service name is still there and running.

When trying to stop the service using

SQL> exec dbms_service.stop_service('mydb.foo.bar');
PL/SQL procedure successfully completed.

no error is reported, but when trying to delete the service, Oracle won't let me:

SQL> exec dbms_service.delete_service('mydb.foo.bar');
BEGIN dbms_service.delete_service('mydb.foo.bar'); END;

*
ERROR at line 1:
ORA-44305: service mydb.foo.ba

Solution

I'm sure I'm missing something pretty obvious, but I can't figure out what it is.

Yes it was something very obvious...

The parameter DB_DOMAIN still contained foo.bar and therefore the instance registered itself using mydb.foo.bar.

After doing a

alter system set db_domain='' scope=spfile;


and bouncing the database everything is working as expected now.

Code Snippets

alter system set db_domain='' scope=spfile;

Context

StackExchange Database Administrators Q#49245, answer score: 8

Revisions (0)

No revisions yet.