Bo's Oracle Station

查看: 1437|回复: 0

课程第42次

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2019-8-18 08:42:04 | 显示全部楼层 |阅读模式
  1. SQL> show parameter service

  2. NAME                                 TYPE        VALUE
  3. ------------------------------------ ----------- ------------------------------
  4. service_names                        string      orcl.example.com
  5. SQL> alter system set service_names='orcl.example.com','serv1';

  6. System altered.

  7. SQL> exit
  8. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64                                                                             bit Production
  9. With the Partitioning, Automatic Storage Management, OLAP, Data Mining
  10. and Real Application Testing options
  11. [oracle@station76 ~]$ cd /u01/app/oracle/product/
  12. [oracle@station76 product]$ ls
  13. 11.2.0
  14. [oracle@station76 product]$ cd 11.2.0/
  15. [oracle@station76 11.2.0]$ ls
  16. dbhome_1  grid
  17. [oracle@station76 11.2.0]$ cd dbhome_1/
  18. [oracle@station76 dbhome_1]$ ls
  19. apex         emcli          mgw          rdbms
  20. assistants   EMStage        network      relnotes
  21. bin          has            nls          root.sh
  22. ccr          hs             oc4j         scheduler
  23. cdata        ide            odbc         slax
  24. cfgtoollogs  install        olap         sqldeveloper
  25. clone        instantclient  OPatch       sqlj
  26. config       inventory      OPatch.ori   sqlplus
  27. crs          j2ee           opmn         srvm
  28. csmig        javavm         oracore      station76.example.com_orcl
  29. css          jdbc           oraInst.loc  suptools
  30. ctx          jdev           ord          sysman
  31. cv           jdk            oui          timingframework
  32. dbs          jlib           owb          ucp
  33. dc_ocm       ldap           owm          uix
  34. deinstall    lib            perl         usm
  35. demo         log            plsql        utl
  36. diagnostics  md             precomp      wwg
  37. dv           mesg           racg         xdk
  38. [oracle@station76 dbhome_1]$ cd network/
  39. [oracle@station76 network]$ ls
  40. admin  doc  install  jlib  lib  log  mesg  tools  trace
  41. [oracle@station76 network]$ cd admin/
  42. [oracle@station76 admin]$ ls
  43. samples  shrept.lst  sqlnet.ora  sqlnet.ora.ori  tnsnames.ora
  44. [oracle@station76 admin]$ vim tnsnames.ora
  45. [oracle@station76 admin]$ lsnrctl services

  46. LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 17-AUG-2019 11:54:58

  47. Copyright (c) 1991, 2013, Oracle.  All rights reserved.

  48. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
  49. Services Summary...
  50. Service "+ASM" has 1 instance(s).
  51.   Instance "+ASM", status READY, has 1 handler(s) for this service...
  52.     Handler(s):
  53.       "DEDICATED" established:638 refused:0 state:ready
  54.          LOCAL SERVER
  55. Service "dbtest.example.com" has 1 instance(s).
  56.   Instance "dbtest", status UNKNOWN, has 1 handler(s) for this service...
  57.     Handler(s):
  58.       "DEDICATED" established:0 refused:0
  59.          LOCAL SERVER
  60. Service "mydb2" has 1 instance(s).
  61.   Instance "mydb2", status UNKNOWN, has 1 handler(s) for this service...
  62.     Handler(s):
  63.       "DEDICATED" established:0 refused:0
  64.          LOCAL SERVER
  65. Service "orcl.example.com" has 1 instance(s).
  66.   Instance "orcl", status READY, has 1 handler(s) for this service...
  67.     Handler(s):
  68.       "DEDICATED" established:3 refused:0 state:ready
  69.          LOCAL SERVER
  70. Service "rcat.example.com" has 1 instance(s).
  71.   Instance "rcat", status READY, has 1 handler(s) for this service...
  72.     Handler(s):
  73.       "DEDICATED" established:0 refused:0 state:ready
  74.          LOCAL SERVER
  75. Service "rcatXDB.example.com" has 1 instance(s).
  76.   Instance "rcat", status READY, has 1 handler(s) for this service...
  77.     Handler(s):
  78.       "D000" established:0 refused:0 current:0 max:1022 state:ready
  79.          DISPATCHER <machine: station76.example.com, pid: 8268>
  80.          (ADDRESS=(PROTOCOL=tcp)(HOST=station76.example.com)(PORT=42142))
  81. Service "serv1.example.com" has 1 instance(s).
  82.   Instance "orcl", status READY, has 1 handler(s) for this service...
  83.     Handler(s):
  84.       "DEDICATED" established:3 refused:0 state:ready
  85.          LOCAL SERVER
  86. The command completed successfully
  87. [oracle@station76 admin]$
复制代码
分服务,分模块和分行动:
  1. declare
  2. v1 number;
  3. begin
  4.   dbms_application_info.set_module(module_name => 'GL',action_name => 'DEBIT_CAL');
  5.   select count(*)  into v1 from t04209_uname a, t04209_uname b, t04209_uname c;
  6. end;
复制代码

QQ图片20190818085602.png



  1. select s.sid, s.username, n."NAME", se."VALUE"
  2. from v$session s, v$sesstat se , v$statname n
  3. where s.sid=se.sid  and
  4.        se.statistic#=n.statistic#  and
  5.        s.terminal='pts/0'  and n."NAME"  like '%redo%';
复制代码


   SIDUSERNAMENAMEVALUE
1202HRredo blocks read for recovery0
2202HRredo k-bytes read for recovery0
3202HRredo k-bytes read for terminal recovery0
4202HRredo entries26197
5202HRredo size7916968
6202HRredo entries for lost write detection0
7202HRredo size for lost write detection0
8202HRredo size for direct writes0
9202HRredo buffer allocation retries0
10202HRredo wastage0
11202HRredo writes0
12202HRredo blocks written0
13202HRredo write time0
14202HRredo blocks checksummed by FG (exclusive)0
15202HRredo blocks checksummed by LGWR0
16202HRredo log space requests0
17202HRredo log space wait time0
18202HRredo ordering marks0
19202HRredo subscn max counts1301

上完了1Z0-052:0、1、2、3、4、5、6、9、10、12、13、14、15、16、18;上完了1Z0-053:0、1、2、3、4、5、6、7、8、9、10、11、12、13、14、15、19、20

  1. select t.table_name, t.buffer_pool
  2.   from dba_Tables t where t.owner='HR';

  3. alter table hr.t17018  storage ( buffer_pool  keep );


  4. select  i.index_name, i.buffer_pool, i.table_name
  5. from dba_indexes i where i.owner='HR';

  6. alter index hr.i17018 storage ( buffer_pool  keep );
复制代码
  1. SQL>  create or replace function func1
  2.   2   return number
  3.   3  as
  4.   4    v1  number;
  5.   5  begin
  6.   6   select  max(a)  into v1  from t17018;
  7.   7   return v1;
  8.   8  end;
  9.   9  /
复制代码
  1. select  * from v$db_object_cache doc
  2. where doc."OWNER"='HR'  and doc."NAME"='FUNC1';


  3. begin
  4.     dbms_shared_pool.keep(name => 'HR.FUNC1');
  5. end;
复制代码
默认cursor_sharing是exact,所以要去编程。
  1. select  to_char(q."SQL_FULLTEXT"), q."SQL_ID",
  2.         s."SQL_HASH_VALUE"
  3.   from v$session s, v$sql q
  4.   where s."SQL_ID"=q."SQL_ID"
  5.   and s."TERMINAL"='pts/0';
  6.   
复制代码
   TO_CHAR(Q."SQL_FULLTEXT")SQL_IDSQL_HASH_VALUE
1update hr.t04209_uname set uvalue=7689 where uname='a7688'02h6hbspdt4jd719098413

改成similar以后:
   TO_CHAR(Q."SQL_FULLTEXT")SQL_IDSQL_HASH_VALUE
1update hr.t04209_uname set uvalue=:"SYS_B_0" where uname=:"SYS_B_1"dh73w3ss300hp808452629

自顶向下 (从源头,抓大头)
  1. select s.sid, s.username,ev."EVENT"
  2. from v$session s, v$session_event ev
  3. where
  4.        ev."SID"=s."SID"
  5.        and s."TERMINAL"='pts/0';
  6.       
复制代码


回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-9 14:44 , Processed in 0.151102 second(s), 27 queries .

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