To create a custom service name, use the DBMS_SERVICE package. After the Oracle database restarts, turn on the auto-start of the created custom service. For more information, see DBMS_SERVICE on the Oracle website.
Note: You can create custom service names for application connections to an Amazon RDS for Oracle database. To deliver a managed service, you don't have permission to alter the SERVICE_NAMES parameter or have server access to use srvctl to create the service. As a result, the custom service doesn't start when the database restarts. Instead, you must manually restart the database.
Create a startup trigger to start the service after a database restart so that you don't have to manually start the custom service:
1. Create a new service, and then start the service:
Note: Replace example-service-name with the name of your new service.
2. Check the status of the new service:
select * from dba_services;
3. Use Oracle client tools, such as sqlplus and SQL developer, to test the database connectivity with the new service.
4. Create a trigger to start the services automatically after a database restart.
To create the trigger, complete the following steps:
1. Grant access to the owner of a procedure or trigger to run dbms_service:
Note: Replace example-username to the procedure or trigger owner's name.
2. Create the custom procedure to start the service that's in the stopped state after a database restart:
Note: Replace example-procedure-name with the name of the custom procedure.
CREATE OR REPLACE PROCEDURE example-procedure-name
cursor tempvar is select name from sys.service$ where network_name is not null and name not in (select value from v$parameter where name='service_names');
fetch tempvar into loopvar;
EXIT WHEN tempvar%NOTFOUND;
3. Create a startup trigger to start the database services at the database startup time:
Note: Replace example-trigger-name with the name of the startup trigger. Replace example-procedure-name with the name of the custom procedure.
CREATE OR REPLACE TRIGGER example-trigger-name
after startup on database