Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

18

积分

0

好友

0

主题
1#
发表于 2012-3-14 16:30:49 | 查看: 6775| 回复: 3
For Oracle version 11.2 onwards setting job_queue_processes=0 disables all jobs (dbms_scheduler and dbms_job).

10g中,job_queue_processes=0对dbms_scheduler类job无效。

begin
dbms_scheduler.set_scheduler_attribute('MAX_JOB_SLAVE_PROCESSES', value);
end;

value要大于0.

还有其他方法没?


谢谢
2#
发表于 2012-3-14 19:11:12
ODM Finding:
  1. /*************************************************************
  2. * Special Scheduler Administrative Procedures
  3. *************************************************************
  4. */

  5. -- There are several scheduler attributes that control the behavior of the
  6. -- scheduler. These have defaults but a DBA may wish to change the default
  7. -- settings or view the current settings. These two functions are provided for
  8. -- this purpose.
  9. -- Even though the scheduler attributes have different types (e.g. strings,
  10. -- numbers) all the values are passed as string literals. The set
  11. -- procedure requires the MANAGE SCHEDULER privilege.
  12. -- This takes effect immediately, but the resulting changes may not be seen
  13. -- immediately.
  14. -- Attributes which may be set are:
  15. -- 'MAX_SLAVE_PROCESSES'(pls_integer), 'DEFAULT_LOG_PURGE_POLICY'(varchar2),
  16. -- 'LOG_HISTORY' (pls_integer)

  17. -- Set the value of a scheduler attribute. This takes effect immediately,
  18. -- but the resulting changes may not be seen immediately.
  19. PROCEDURE set_scheduler_attribute(
  20.   attribute          IN VARCHAR2,
  21.   value              IN VARCHAR2);
复制代码
Let's Test This procedure:


SQL> exec dbms_scheduler.set_scheduler_attribute('SCHEDULER_DISABLED','TRUE');

PL/SQL procedure successfully completed.


SQL>  select * from DBA_SCHEDULER_GLOBAL_ATTRIBUTE ;

ATTRIBUTE_NAME                           VALUE
---------------------------------------- ----------------------------------------
MAX_JOB_SLAVE_PROCESSES
LOG_HISTORY                              30
DEFAULT_TIMEZONE                         EST5EDT
EMAIL_SERVER
EMAIL_SERVER_ENCRYPTION                  NONE
EMAIL_SERVER_CREDENTIAL
EMAIL_SENDER
LAST_OBSERVED_EVENT
EVENT_EXPIRY_TIME
FILE_WATCHER_COUNT                       0
CURRENT_OPEN_WINDOW                      WEDNESDAY_WINDOW
SCHEDULER_DISABLED                       TRUE

12 rows selected.


SQL> select * from dba_objects where object_name='SCHEDULER_DISABLED';

OWNER
------------------------------
OBJECT_NAME
--------------------------------------------------------------------------------
SUBOBJECT_NAME                  OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
------------------------------ ---------- -------------- -------------------
CREATED   LAST_DDL_ TIMESTAMP           STATUS  T G S  NAMESPACE
--------- --------- ------------------- ------- - - - ----------
EDITION_NAME
------------------------------
SYS
SCHEDULER_DISABLED
                                    81917                UNDEFINED
14-MAR-12 14-MAR-12 2012-03-14:23:11:58 VALID   N N N         51

SQL>
SQL> DECLARE
  2   x VARCHAR2(100);
  3  BEGIN
  4    dbms_scheduler.get_scheduler_attribute('DEFAULT_TIMEZONE', x);
  5    dbms_output.put_line('DTZ: ' || x);
  6    dbms_scheduler.get_scheduler_attribute('EVENT_EXPIRY_TIME', x);
  dbms_output.put_line('EET: ' || x);
  7    8    dbms_scheduler.get_scheduler_attribute('LOG_HISTORY', x);
  9    dbms_output.put_line('LH: ' || x);
10    dbms_scheduler.get_scheduler_attribute('MAX_JOB_SLAVE_PROCESSES', x);
11    dbms_output.put_line('MJSP: ' || x);
12    dbms_scheduler.get_scheduler_attribute('SCHEDULER_DISABLED', x);
13    dbms_output.put_line('SCHEDULER_DISABLED: ' || x);
14  END;
15  /
DTZ: EST5EDT
EET:
LH: 30
MJSP:
SCHEDULER_DISABLED: TRUE

PL/SQL procedure successfully completed.


SQL> BEGIN
  2    dbms_scheduler.create_job(
  3    job_name => 'NULL_JOB',
  4    job_type=>'PLSQL_BLOCK',
  5    job_action=>' begin NULL; end;',
  6    start_date => dbms_scheduler.stime,
  7    repeat_interval => 'FREQ=MINUTELY;INTERVAL=1',
  8    end_date => dbms_scheduler.stime+1,
  9    enabled => TRUE,
10    auto_drop => FALSE,
11    comments => 'MacleanS JOB');
12  END;
13  /


SQL> select * from dba_scheduler_job_log where job_name='NULL_JOB';

no rows selected

SQL> /

no rows selected


SQL> exec dbms_scheduler.set_scheduler_attribute('SCHEDULER_DISABLED','FALSE');

PL/SQL procedure successfully completed.


SQL> select * from dba_objects where object_name='SCHEDULER_DISABLED';

no rows selected


SQL> select count(*) from dba_scheduler_job_log where job_name='NULL_JOB';

  COUNT(*)
----------
         1


SQL> select count(*) from dba_scheduler_job_log where job_name='NULL_JOB';

  COUNT(*)
----------
         2

回复 只看该作者 道具 举报

3#
发表于 2012-3-14 19:12:55
ODM Finding:

  1. To Ensure that the Repository DBMS_Jobs are always Executed:

  2. 1. Set the job_queue_processes initialization parameter to a value > 0. For a Grid Control repository, the recommended value is 10. This should be set to a higher value if there are other user-defined dbms_job's in the same database.

  3. 2. Verify that the CJQ0 process / Scheduler is not disabled. Login to the database as a DBA user and execute:
  4. SQL> select * from dba_objects where object_name='SCHEDULER_DISABLED';

  5. If this returns:

  6. OWNER                         OBJECT_NAME
  7. -----------------------       ---------------------------------
  8. SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
  9. ------------------------------ ---------- -------------- -------------------
  10. CREATED LAST_DDL_ TIMESTAMP STATUS              T G S
  11. --------- --------- ------------------- ------- - - -
  12. SYS                           SCHEDULER_DISABLED
  13. 379669 UNDEFINED
  14. 02-AUG-10 02-AUG-10 2010-08-02:13:46:20 VALID N N N

  15. then the CJQ process will not be started automatically with the Database startup. To rectify this,

  16. SQL> exec dbms_scheduler.set_scheduler_attribute('SCHEDULER_DISABLED','FALSE');

  17. Verify that the CJQ is now running:

  18. SQL> select program, username from v$process;

  19. PROGRAM USERNAME
  20. -----------------------------------  ---------------
  21. ...
  22. oracle@em11gc.idc.oracle.com (CJQ0)  oracle
  23. ...

  24. -  In case of a RAC database, ensure that the value of the job_queue_processes initialization parameter is the same across all the instances.  Use the query:

  25. SQL> SELECT a.instance_name AS sid, b.value AS jobqueue
  26. FROM gv$instance a, gv$parameter b
  27. WHERE a.inst_id = b.inst_id
  28. AND b.name='job_queue_processes';
复制代码

回复 只看该作者 道具 举报

4#
发表于 2012-3-15 08:59:50
非常感谢LIU      !

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-12-24 00:14 , Processed in 0.048246 second(s), 21 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569