Tag Archives: create service

Create Service using DBMS_SERVICE

Create Service using DBMS_SERVICE

AIM: We want to create new service (TEST) in database POCNDEV without using NETCA/NETMGR

[oracle@rac2 ~]$ ps -ef | grep tns
root         9     2  0 05:10 ?        00:00:00 [netns]
oracle    3468     1  0 05:13 ?        00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER -inherit
oracle    5301  3976  0 05:38 pts/1    00:00:00 grep tns
[oracle@rac2 ~]$ lsnrctl status LISTENER | grep -i TEST <-- no output
[oracle@rac2 ~]$

SQL> select name, open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
POCNDEV   READ WRITE

SQL>

SQL> exec dbms_service.CREATE_SERVICE(SERVICE_NAME=>'TEST', NETWORK_NAME=>'TEST');

PL/SQL procedure successfully completed.

SQL> exec dbms_service.START_SERVICE('TEST');

PL/SQL procedure successfully completed.

SQL>

[oracle@rac2 ~]$ . oraenv
ORACLE_SID = [POCNDEV] ? +ASM
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@rac2 ~]$ lsnrctl status LISTENER | grep -i TEST
Service "TEST.rajasekhar.com" has 1 instance(s). <----
[oracle@rac2 ~]$

[oracle@rac2 ~]$ lsnrctl status LISTENER
..
..
Service "TEST.rajasekhar.com" has 1 instance(s).
  Instance "POCNDEV", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@rac2 ~]$

[oracle@rac2 ~]$ cd /u01/app/oracle/product/11.2.0.4/db_1/network/admin/
[oracle@rac2 admin]$ cat tnsnames.ora | grep -i TEST
[oracle@rac2 admin]$

-- dbms_service.CREATE_SERVICE will not add TNS entry to tnsnames.ora file.

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

Thank you,
Rajasekhar