zoukankan      html  css  js  c++  java
  • 数据库自动维护

    1  所有维护窗口的启用和禁用维护任务

    完全禁用 Automatic SQL Tuning Advisor 任务

    BEGIN
        dbms_auto_task_admin.disable(
            client_name => 'sql tuning advisor',
            operation     => NULL,
            window_name  => NULL);
    END;
    /

    再次启用自动维护任务

    BEGIN
        dbms_auto_task_admin.enable(
            client_name => 'sql tuning advisor',
            operation     => NULL,
            window_name  => NULL);
    END;
    /

    The task names to use for the client_name argument are listed in the DBA_AUTOTASK_CLIENT database dictionary view.

    select * from dba_autotask_client;

    用于 client _ name 参数的任务名称列在 dba_autotask _ client 数据库字典视图中。

    To enable or disable all automated maintenance tasks for all windows, call the ENABLE or DISABLE procedure with no arguments.

    若要启用或禁用所有窗口的所有自动维护任务,请不带参数调用 ENABLE 或 DISABLE 过程。

    EXECUTE DBMS_AUTO_TASK_ADMIN.DISABLE;

    2 特定维护窗口的启用和禁用维护任务

    禁用自动 SQL 调优顾问在 MONDAY _ window 窗口中运行

    BEGIN
        dbms_auto_task_admin.disable(
            client_name => 'sql_tuning_advisor',
            operation     => NULL,
            window_name  => 'MONDAY_WINDOW');
    END;
    /

    Configuring Maintenance Windows 配置维护窗口

    You may want to adjust the predefined maintenance windows to a time suitable to your database environment or create a new maintenance window. You can customize maintenance windows using the DBMS_SCHEDULER PL/SQL package.

     修改维护窗口(Modifying a Maintenance Window)

    The DBMS_SCHEDULER PL/SQL package includes a SET_ATTRIBUTE procedure for modifying the attributes of a window.

    下面的脚本将维护窗口 SATURDAY _ window 的持续时间改为4小时:

    BEGIN
        dbms_scheduler.disable(
            name  => 'SATURDAY_WINDOW');
        dbms_scheduler.set_attribute(
            name  => 'SATURDAY_WINDOW',
            attribute  => 'DURATION',
            value   => numtodsinterval(4, 'hour'));
        dbms_scheduler.enable(
            name  => 'SATURDAY_WINDOW');
    END;
    /

    Note that you must use the DBMS_SCHEDULER.DISABLE subprogram to disable the window before making changes to it, and then re-enable the window with DBMS_SCHEDULER.ENABLE when you are finished. If you change a window when it is currently open, the change does not take effect until the next time the window opens.

    创建新的维护窗口

    You use the DBMS_SCHEDULER.CREATE_WINDOW package procedure to create the window, and the DBMS_SCHEDULER.ADD_GROUP_MEMBER procedure to add the new window to the window group.

    创建一个名为 EARLY _ morning _ window 的维护窗口。这个窗口每天早上5点到6点运行一个小时。

    BEGIN
        DBMS_SCHEDULER.CREATE_WINDOW(
            window_name   => 'EARLY_MORNING_WINDOW',
            duration            => numtodsinterval(1, 'hour'),
            resource_plan    => 'DEFAULT_MAINTENANCE_PLAN',
            repeat_interval  => 'FREQ=DAILY;BYHOUR=5;BYMINUTE=0;BYSECOND=0');
        DBMS_SCHEDULER.ADD_GROUP_MEMBER(
            group_name      =>'MAINTENANCE_WINDOW_GROUP',
            member             =>'EARLY_MORNING_WINDOW');
    END;
    /

    删除维护窗口

    To remove an existing maintenance window, remove it from the MAINTENANCE_WINDOW_GROUP window group.

    The window continues to exist but no longer runs automated maintenance tasks. Any other Oracle Scheduler jobs assigned to this window continue to run as usual.

    从WINDOW GROUP窗口组中删除了 EARLY _ morning _ window:

    BEGIN
        DBMS_SCHEDULER.REMOVE_GROUP_MEMBER(
            group_name   => 'MAINTENANCE_WINDOW_GROUP',
            MEMBER         => 'EARLY_MORNING_WINDOW');
    END;
    /

    为自动化维护任务配置资源分配

    关于自动化维护任务的资源分配

    By default, all predefined maintenance windows use the resource plan DEFAULT_MAINTENANCE_PLAN. Automated maintenance tasks run under its subplan ORA$AUTOTASK. This subplan divides its portion of total resource allocation equally among the maintenance tasks.

    DEFAULT _ maintenance _ plan 定义了以下资源分配:

     更改自动维护任务的资源分配

    To change the resource allocation for automated maintenance tasks within a maintenance window, you must change the percentage of resources allocated to the subplan ORA$AUTOTASK in the resource plan for that window.

  • 相关阅读:
    Jquery EasyUI tabs处理
    C# ToString格式控制符
    SQL删除重复数据,保留一条
    stm32f4xx 的IWDG使用的一般步骤
    stm32f4xx 的EXTI使用的一般步骤
    STM32F4xx---EXTI 外部中断
    数组和指针 到 存储类(1)
    uCosII 从 OSStart开始到思维定势··········
    《C和指针》一书介绍操作符优先级
    OSTimeTick()函数解析
  • 原文地址:https://www.cnblogs.com/zykLove/p/13365955.html
Copyright © 2011-2022 走看看