天天看点

pdb service管理数据库关闭之后,新建的service不能自动启动.启动触发器相关视图:

日常维护命令,建立和启动

SQL> EXEC DBMS_SERVICE.CREATE_SERVICE('jerome.cn.oracle.com','jerome.cn.oracle.com');

PL/SQL procedure successfully completed.


SQL> EXEC DBMS_SERVICE.START_SERVICE('jerome.cn.oracle.com');

PL/SQL procedure successfully completed.

SQL>
SQL> select NAME, NETWORK_NAME from v$services;

NAME NETWORK_NAME
------------------------------ --------------------------------------------------
orclXDB orclXDB
SYS$BACKGROUND
SYS$USERS
jerome.cn.oracle.com jerome.cn.oracle.com <<<<< New services
orcl.cn.oracle.com orcl.cn.oracle.com            

数据库关闭之后,新建的service不能自动启动.

查询未启动的service

select * from dba_services where SERVICE_ID not in (select SERVICE_ID from V$ACTIVE_SERVICES);            

启动触发器

create or replace trigger open_services
after startup on database
begin
DBMS_SERVICE.START_SERVICE('jerome.cn.oracle.com');
end open_services;
/            

相关视图:

Database Service Data Dictionary Views

You can query data dictionary views to find information about database services.

You can find information about database services in the following views:

    DBA_SERVICES

    ALL_SERVICES or V$SERVICES

    V$ACTIVE_SERVICES

    V$SERVICE_STATS

    V$SERVICE_EVENT

    V$SERVICE_WAIT_CLASS

    V$SERV_MOD_ACT_STATS

    V$SERVICEMETRIC

    V$SERVICEMETRIC_HISTORY

The following additional views also contain some information about database services:

    V$SESSION

    V$ACTIVE_SESSION_HISTORY

    DBA_RSRC_GROUP_MAPPINGS

    DBA_SCHEDULER_JOB_CLASSES

    DBA_THRESHOLDS

The ALL_SERVICES view includes a GLOBAL_SERVICE column, and the V$SERVICES and V$ACTIVE_SERVICES views contain a GLOBAL column. These views and columns enable you to determine whether a database service is a global service.

Parent topic: Managing Application Workloads with Database Services
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/admin/creating-and-configuring-an-oracle-database.html#GUID-E2D6D197-0733-45D2-AE9B-98F9736DC1B8