Bo's Oracle Station

查看: 2083|回复: 0

最后一次71次:2014-11-25

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2014-11-27 16:13:51 | 显示全部楼层 |阅读模式
本帖最后由 botang 于 2014-11-29 10:40 编辑

2014-11-25:
  1. select  * from dba_scheduler_external_dests;
  2. select * from dba_scheduler_dests;
  3. select  * from dba_scheduler_db_dests;


  4. begin
  5.    dbms_scheduler.create_database_destination(destination_name => 'DB_2',agent => 'agent_1',
  6.    tns_name => '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.199)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = utforcl.example.com)))');
  7.    end;
  8.    
  9. begin
  10.    dbms_scheduler.create_database_destination(destination_name => 'DB_1',agent => 'agent_1',
  11.    tns_name => '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.199)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl.example.com)))');
  12.    end;
  13.    
  14.    
  15. select  * from dba_scheduler_credentials;  
  16.    
  17.    BEGIN
  18. sys.dbms_scheduler.create_job(
  19. job_name => '"HR"."JOB_REMOTE_DB_ORCL"',
  20. job_type => 'PLSQL_BLOCK',
  21. job_action => 'begin
  22.    update employees set salary=salary+1  where employee_id=100;
  23.    commit;
  24. end;',
  25. start_date => systimestamp at time zone 'Asia/Shanghai',
  26. job_class => '"DEFAULT_JOB_CLASS"',
  27. comments => 'JOB_REMOTE_DB2',
  28. auto_drop => FALSE,
  29. credential_name =>'"SYS"."CREDENTIAL2"' ,destination_name =>'SYS.DB_1' ,
  30. enabled => true);
  31. END;

  32.    BEGIN
  33. sys.dbms_scheduler.create_job(
  34. job_name => '"HR"."JOB_REMOTE_DB_UTFORCL"',
  35. job_type => 'STORED_PROCEDURE',
  36. job_action => 'HR.PROC1',
  37. start_date => systimestamp at time zone 'Asia/Shanghai',
  38. job_class => '"DEFAULT_JOB_CLASS"',
  39. comments => 'JOB_REMOTE_DB2',
  40. auto_drop => FALSE,
  41. credential_name =>'"SYS"."CREDENTIAL2"' ,destination_name =>'SYS.DB_2' ,
  42. enabled => true);
  43. END;


  44. select  * from dba_scheduler_groups;
  45. select  * from dba_scheduler_group_members;

  46. BEGIN
  47.   DBMS_SCHEDULER.create_group(
  48.     group_name    => 'hr.group1',
  49.     group_type    => 'DB_DEST',member => 'LOCAL,DB_1,DB_2'
  50.     );
  51. END;


  52. select  * from dba_scheduler_groups  g where g.group_name='GROUP1';
  53. select  * from dba_scheduler_group_members  gm where gm.group_name='GROUP1';


  54. BEGIN
  55. sys.dbms_scheduler.create_job(
  56. job_name => '"HR"."JOB_REMOTE_DB_GROUP"',
  57. job_type => 'PLSQL_BLOCK',
  58. job_action => 'begin
  59.    update employees set salary=9999  where employee_id=100;
  60.    commit;
  61. end;',
  62. start_date => systimestamp at time zone 'Asia/Shanghai',
  63. job_class => '"DEFAULT_JOB_CLASS"',
  64. comments => 'JOB_REMOTE_GROUP',
  65. auto_drop => FALSE,
  66. credential_name =>'"SYS"."CREDENTIAL2"' ,destination_name =>'HR.GROUP1' ,
  67. enabled => true);
  68. END;

  69. select  *  from  dba_SCHEDULER_JOB_RUN_DETAILS;
复制代码
  1. select  * from dba_scheduler_db_dests;
  2. select  * from dba_scheduler_external_dests;
  3. select * from dba_scheduler_dests;

  4. begin
  5.    dbms_scheduler.create_database_destination(destination_name => 'DB_2',agent => 'agent_1',
  6.    tns_name => '');
  7.    end;
  8.    
  9.    
  10. BEGIN
  11. sys.dbms_scheduler.create_job(
  12. job_name => '"HR"."JOB_REMOTE_DB3"',
  13. job_type => 'PLSQL_BLOCK',
  14. job_action => 'begin
  15.    update employees set salary=salary+1  where employee_id=100;
  16.    commit;
  17. end;',
  18. start_date => systimestamp at time zone 'Asia/Shanghai',
  19. job_class => '"DEFAULT_JOB_CLASS"',
  20. comments => 'JOB_REMOTE_DB2',
  21. auto_drop => FALSE,
  22. credential_name =>'"SYS"."CREDENTIAL2"' ,destination_name =>'SYS.DB_2' ,
  23. enabled => true);
  24. END;



  25.    
复制代码
  1. select  * from DBA_TAB_STAT_PREFS;

  2. select   t.num_rows   from dba_tables t where t.owner='HR' and t.table_name='T05314';

  3. select   *   from   dba_tab_col_statistics tc where tc.owner='HR'  and tc.table_name='T05314';

  4. select  * from dba_tab_histograms th where th.owner='HR' and th.table_name='T05314';

  5. begin
  6. dbms_Stats.gather_table_stats('HR','T05314');
  7. end;
  8. ---prefer
  9. begin
  10.    dbms_Stats.gather_table_stats('HR','T05314');
  11.    end;
  12.    
  13.    ---no prefer
  14.    
  15.    begin
  16.        dbms_stats.gather_table_stats(ownname => 'HR',
  17.        tabname => 'T05314',
  18.        estimate_percent => 99,method_opt => 'for columns a size 80');
  19.        end;

  20. ----
  21. begin
  22.    dbms_Stats.gather_table_stats('HR','T05314');
  23.    end;
  24. ---
  25. begin
  26.    dbms_stats.set_table_prefs(ownname => 'HR',tabname => 'T05314',pname => 'estimate_percent',pvalue => 100);
  27.    end;
  28.    
  29. begin
  30.    dbms_stats.set_table_prefs(ownname => 'HR',tabname => 'T05314',pname => 'method_opt',pvalue => 'for columns a size 254');
  31.    end;
  32.    
  33.    select  * from DBA_TAB_STAT_PREFS;
  34. ----

  35. begin
  36.    dbms_Stats.gather_table_stats('HR','T05314');
  37.    end;
  38.    
  39.    ---
  40.    ----
  41.    select  * from dba_tables  t where  t.owner='SYS' and t.tablespace_name='SYSAUX'  and t.table_name  like 'WRH%';
  42.    
  43.    -----
  44.    
  45.    select * from dba_sql_profiles;
  46.    
  47.    
复制代码


回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-12-4 16:41 , Processed in 0.049671 second(s), 25 queries .

快速回复 返回顶部 返回列表