设为首页收藏本站

Botang唐波's Oracle Station

查看: 253|回复: 0

课程第42/43/44次(2018-05-13星期日上下午,2018-05-14星期一)

[复制链接]

719

主题

1081

帖子

7844

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
7844
发表于 2018-5-13 09:34:09 | 显示全部楼层 |阅读模式
  1. [oracle@station90 online]$ /u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch  lsinventory  
  2. Invoking OPatch 11.2.0.1.7

  3. Oracle 中间补丁程序安装程序版本 11.2.0.1.7
  4. 版权所有 (c) 2011, Oracle Corporation。保留所有权利。


  5. Oracle Home       : /u01/app/oracle/product/11.2.0/dbhome_1
  6. Central Inventory : /u01/app/oraInventory
  7.    from           : /etc/oraInst.loc
  8. OPatch version    : 11.2.0.1.7
  9. OUI version       : 11.2.0.3.0
  10. Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2018-05-13_09-30-35上午.log

  11. Lsinventory Output file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2018-05-13_09-30-35上午.txt

  12. --------------------------------------------------------------------------------
  13. 已安装的顶级产品 (1):

  14. Oracle Database 11g                                                  11.2.0.3.0
  15. 此 Oracle 主目录中已安装 1 个产品。


  16. 此 Oracle 主目录中未安装任何中间补丁程序。


  17. --------------------------------------------------------------------------------

  18. OPatch succeeded.
复制代码

如果是热补丁:
  1. [oracle@station90 online]$ /u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch  query -is_online_patch
  2. Invoking OPatch 11.2.0.1.7

  3. Oracle 中间补丁程序安装程序版本 11.2.0.1.7
  4. 版权所有 (c) 2011, Oracle Corporation。保留所有权利。


  5. Oracle Home       : /u01/app/oracle/product/11.2.0/dbhome_1
  6. Central Inventory : /u01/app/oraInventory
  7.    from           : /etc/oraInst.loc
  8. OPatch version    : 11.2.0.1.7
  9. OUI version       : 11.2.0.3.0
  10. Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2018-05-13_09-32-39上午.log

  11. --------------------------------------------------------------------------------
  12. Patch is an online patch: true


  13. OPatch succeeded.
复制代码
如果是冷补丁:

  1. [oracle@station90 13906496]$ /u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch  query -is_online_patch
  2. Invoking OPatch 11.2.0.1.7

  3. Oracle 中间补丁程序安装程序版本 11.2.0.1.7
  4. 版权所有 (c) 2011, Oracle Corporation。保留所有权利。


  5. Oracle Home       : /u01/app/oracle/product/11.2.0/dbhome_1
  6. Central Inventory : /u01/app/oraInventory
  7.    from           : /etc/oraInst.loc
  8. OPatch version    : 11.2.0.1.7
  9. OUI version       : 11.2.0.3.0
  10. Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2018-05-13_09-34-29上午.log

  11. --------------------------------------------------------------------------------
  12. Patch is an online patch: false


  13. OPatch succeeded.
复制代码

热补丁的选项:
-connectString
              This option can be used to specify the list of database
              instances on which the patch needs to be applied. The
              value for this option is specified as per the following
              syntax "SID:Userasswd:Node". The SID is a must, others
              can be ignored, OPatch takes default values for it.
              Ex: oracle:dba:dba:mymachine,oracle1:::
              NOTE: If the system is not part of RAC setup, then to
              patch just the local node, provide the node name as
              empty string.

  1. [oracle@station90 online]$ /u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch  apply  -connectString  orcl:::   -connectString  rcat:::
  2. Invoking OPatch 11.2.0.1.7

  3. Oracle 中间补丁程序安装程序版本 11.2.0.1.7
  4. 版权所有 (c) 2011, Oracle Corporation。保留所有权利。


  5. Oracle Home       : /u01/app/oracle/product/11.2.0/dbhome_1
  6. Central Inventory : /u01/app/oraInventory
  7.    from           : /etc/oraInst.loc
  8. OPatch version    : 11.2.0.1.7
  9. OUI version       : 11.2.0.3.0
  10. Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2018-05-13_09-40-37上午.log


  11. 补丁程序只应在 '-all_nodes' 模式下应用/回退。
  12. 将 RAC 模式转换为 '-all_nodes' 模式。
  13. Applying interim patch '13906496' to OH '/u01/app/oracle/product/11.2.0/dbhome_1'
  14. Verifying environment and performing prerequisite checks...

  15. 是否继续? [y|n]
  16. y
  17. User Responded with: Y
  18. All checks passed.
  19. Backing up files...

  20. 正在为组件 oracle.rdbms, 11.2.0.3.0 打补丁...
  21. The patch will be installed on active database instances.
  22. 正在数据库 'rcat' 上安装和启用联机补丁程序 'bug13906496.pch'。

  23. Patch 13906496 successfully applied
  24. Log file location: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2018-05-13_09-40-37上午.log

  25. OPatch succeeded.
复制代码
  1. [oracle@station90 online]$ /u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch  lsinventory
  2. Invoking OPatch 11.2.0.1.7

  3. Oracle 中间补丁程序安装程序版本 11.2.0.1.7
  4. 版权所有 (c) 2011, Oracle Corporation。保留所有权利。


  5. Oracle Home       : /u01/app/oracle/product/11.2.0/dbhome_1
  6. Central Inventory : /u01/app/oraInventory
  7.    from           : /etc/oraInst.loc
  8. OPatch version    : 11.2.0.1.7
  9. OUI version       : 11.2.0.3.0
  10. Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2018-05-13_09-41-46上午.log

  11. Lsinventory Output file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2018-05-13_09-41-46上午.txt

  12. --------------------------------------------------------------------------------
  13. 已安装的顶级产品 (1):

  14. Oracle Database 11g                                                  11.2.0.3.0
  15. 此 Oracle 主目录中已安装 1 个产品。


  16. 中间补丁程序 (1) :

  17. Patch (online) 13906496: applied on Sun May 13 09:40:48 CST 2018
  18. Unique Patch ID:  17324986
  19.    Created on 22 Jul 2014, 12:09:07 hrs PST8PDT
  20.    Bugs fixed:
  21.      13906496



  22. --------------------------------------------------------------------------------

  23. OPatch succeeded.
复制代码
回退热补丁:

  1. [oracle@station90 online]$ /u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch  rollback -id  13906496  -connectString orcl:::  -connectString  rcat:::
  2. Invoking OPatch 11.2.0.1.7

  3. Oracle 中间补丁程序安装程序版本 11.2.0.1.7
  4. 版权所有 (c) 2011, Oracle Corporation。保留所有权利。


  5. Oracle Home       : /u01/app/oracle/product/11.2.0/dbhome_1
  6. Central Inventory : /u01/app/oraInventory
  7.    from           : /etc/oraInst.loc
  8. OPatch version    : 11.2.0.1.7
  9. OUI version       : 11.2.0.3.0
  10. Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2018-05-13_09-44-02上午.log

  11. RollbackSession 从 OH '/u01/app/oracle/product/11.2.0/dbhome_1' 回退中间补丁程序 '13906496'

  12. 补丁程序只应在 '-all_nodes' 模式下应用/回退。
  13. 将 RAC 模式转换为 '-all_nodes' 模式。

  14. 正在为组件 oracle.rdbms, 11.2.0.3.0 打补丁...
  15. The patch will be removed from active database instances.
  16. 正在数据库 'rcat' 上禁用和删除联机补丁程序 'bug13906496.pch'

  17. RollbackSession 从产品清单中删除中间补丁程序 '13906496'
  18. Log file location: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2018-05-13_09-44-02上午.log

  19. OPatch succeeded.
复制代码
  1. [oracle@station90 online]$ /u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch  lsinventory
  2. Invoking OPatch 11.2.0.1.7

  3. Oracle 中间补丁程序安装程序版本 11.2.0.1.7
  4. 版权所有 (c) 2011, Oracle Corporation。保留所有权利。


  5. Oracle Home       : /u01/app/oracle/product/11.2.0/dbhome_1
  6. Central Inventory : /u01/app/oraInventory
  7.    from           : /etc/oraInst.loc
  8. OPatch version    : 11.2.0.1.7
  9. OUI version       : 11.2.0.3.0
  10. Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2018-05-13_09-44-57上午.log

  11. Lsinventory Output file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2018-05-13_09-44-57上午.txt

  12. --------------------------------------------------------------------------------
  13. 已安装的顶级产品 (1):

  14. Oracle Database 11g                                                  11.2.0.3.0
  15. 此 Oracle 主目录中已安装 1 个产品。


  16. 此 Oracle 主目录中未安装任何中间补丁程序。


  17. --------------------------------------------------------------------------------

  18. OPatch succeeded.
复制代码
打冷补丁:
  1. [oracle@station90 13906496]$ /u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch apply
  2. Invoking OPatch 11.2.0.1.7

  3. Oracle 中间补丁程序安装程序版本 11.2.0.1.7
  4. 版权所有 (c) 2011, Oracle Corporation。保留所有权利。


  5. Oracle Home       : /u01/app/oracle/product/11.2.0/dbhome_1
  6. Central Inventory : /u01/app/oraInventory
  7.    from           : /etc/oraInst.loc
  8. OPatch version    : 11.2.0.1.7
  9. OUI version       : 11.2.0.3.0
  10. Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2018-05-13_09-47-09上午.log

  11. Applying interim patch '13906496' to OH '/u01/app/oracle/product/11.2.0/dbhome_1'
  12. Verifying environment and performing prerequisite checks...

  13. 是否继续? [y|n]
  14. y
  15. User Responded with: Y
  16. All checks passed.

  17. 请关闭本地系统上在此 ORACLE_HOME 之外运行的 Oracle 实例。
  18. (Oracle 主目录 = '/u01/app/oracle/product/11.2.0/dbhome_1')


  19. 本地系统是否已准备打补丁? [y|n]
  20. y
  21. User Responded with: Y
  22. Backing up files...

  23. 正在为组件 oracle.rdbms, 11.2.0.3.0 打补丁...
  24. Patch 13906496 successfully applied
  25. Log file location: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2018-05-13_09-47-09上午.log

  26. OPatch succeeded.
复制代码

从11.2.0.3grid升到12.1.0.2grid的日志:
Screenshot.png


精确控制通道和输入(一般是输入文件多于通道数考虑):
  1. RMAN> run {
  2. 2> allocate channel c1 device type sbt ;
  3. 3> allocate channel c2 device type sbt ;
  4. 4> backup ( datafile 1,5 channel c1) ( datafile 2,3,4 channel c2 ) ;
  5. 5> release channel c1;
  6. 6> release channel c2;
  7. 7> }

  8. using target database control file instead of recovery catalog
  9. allocated channel: c1
  10. channel c1: SID=247 device type=SBT_TAPE
  11. channel c1: Oracle Secure Backup

  12. allocated channel: c2
  13. channel c2: SID=9 device type=SBT_TAPE
  14. channel c2: Oracle Secure Backup

  15. Starting backup at 13-MAY-18
  16. channel c1: starting full datafile backup set
  17. channel c1: specifying datafile(s) in backup set
  18. input datafile file number=00001 name=+DATADG/orcl/datafile/system.256.973363899
  19. input datafile file number=00005 name=+DATADG/orcl/datafile/example.266.973363999
  20. channel c1: starting piece 1 at 13-MAY-18
  21. channel c2: starting full datafile backup set
  22. channel c2: specifying datafile(s) in backup set
  23. input datafile file number=00002 name=+DATADG/orcl/datafile/sysaux.257.973363901
  24. input datafile file number=00003 name=+DATADG/orcl/datafile/undotbs1.258.973363901
  25. input datafile file number=00004 name=+DATADG/orcl/datafile/users.259.973363901
  26. channel c2: starting piece 1 at 13-MAY-18
  27. channel c2: finished piece 1 at 13-MAY-18
  28. piece handle=14t2pkp1_1_1 tag=TAG20180513T113600 comment=API Version 2.0,MMS Version 10.4.0.4
  29. channel c2: backup set complete, elapsed time: 00:01:05
  30. channel c1: finished piece 1 at 13-MAY-18
  31. piece handle=13t2pkp1_1_1 tag=TAG20180513T113600 comment=API Version 2.0,MMS Version 10.4.0.4
  32. channel c1: backup set complete, elapsed time: 00:01:15
  33. Finished backup at 13-MAY-18

  34. Starting Control File and SPFILE Autobackup at 13-MAY-18
复制代码

rman 会话定位:
  1. SELECT s.sid, p.spid, s.client_info ,s.terminal
  2.    FROM v$process p, v$session s
  3.     WHERE p.addr = s.paddr
  4.    AND  s.terminal in ( SELECT s.terminal
  5.    FROM v$process p, v$session s
  6.     WHERE p.addr = s.paddr
  7.    AND CLIENT_INFO LIKE '%botang%');


  8. SELECT  s.sid, OPNAME, CONTEXT, SOFAR, TOTALWORK,
  9.     ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"
  10.     FROM V_$SESSION_LONGOPS s
  11.     WHERE OPNAME LIKE 'RMAN%'
  12.     AND OPNAME NOT LIKE '%aggregate%'
  13.    AND TOTALWORK != 0
  14.    AND SOFAR <> TOTALWORK
  15.    and s.sid in ( SELECT s.sid
  16.    FROM v$process p, v$session s
  17.     WHERE p.addr = s.paddr
  18.    AND  s.terminal in ( SELECT s.terminal
  19.    FROM v$process p, v$session s
  20.     WHERE p.addr = s.paddr
  21.    AND CLIENT_INFO LIKE '%botang%'));


复制代码

-----------------------------------
同步和异步IO(磁带机)

  1.    
  2.    
  3. select  a.IO_COUNT ,a.LONG_WAITS  ,a.SHORT_WAIT_TIME_TOTAL
  4. ,a.LONG_WAIT_TIME_TOTAL  from v_$backup_async_io  a
  5.   where  a.sid  in  ( SELECT s.sid
  6.    FROM v$session s
  7.     WHERE   s.terminal in ( SELECT s.terminal
  8.    FROM v$session s
  9.     WHERE  CLIENT_INFO LIKE '%botang%'));
  10.       
  11. select  * from v_$backup_sync_io  a
  12. where  a.sid  in  ( SELECT s.sid
  13.    FROM v$session s
  14.     WHERE   s.terminal in ( SELECT s.terminal
  15.    FROM v$session s
  16.     WHERE  CLIENT_INFO LIKE '%botang%'));
复制代码

maxopenfiles和filesperset语法:
  1. RMAN> run {
  2. 2> allocate channel c1 device type sbt maxopenfiles 1;
  3. 3> allocate channel c2 device type sbt maxopenfiles 1;
  4. 4> backup database filesperset 1;
  5. 5> }

  6. allocated channel: c1
  7. channel c1: SID=711 device type=SBT_TAPE
  8. channel c1: Oracle Secure Backup

  9. allocated channel: c2
  10. channel c2: SID=483 device type=SBT_TAPE
  11. channel c2: Oracle Secure Backup

  12. Starting backup at 14-MAY-18
  13. channel c1: starting full datafile backup set
  14. channel c1: specifying datafile(s) in backup set
  15. input datafile file number=00001 name=+DATA/ORCL2/DATAFILE/system.266.976031403
  16. channel c1: starting piece 1 at 14-MAY-18
  17. channel c2: starting full datafile backup set
  18. channel c2: specifying datafile(s) in backup set
  19. input datafile file number=00002 name=+DATA/ORCL2/DATAFILE/sysaux.269.976031405
  20. channel c2: starting piece 1 at 14-MAY-18
  21. channel c1: finished piece 1 at 14-MAY-18
  22. piece handle=10t2t69h_1_1 tag=TAG20180514T195321 comment=API Version 2.0,MMS Version 10.4.0.4
  23. channel c1: backup set complete, elapsed time: 00:00:26
  24. channel c1: starting full datafile backup set
  25. channel c1: specifying datafile(s) in backup set
  26. input datafile file number=00003 name=+DATA/ORCL2/DATAFILE/undotbs1.270.976031403
  27. channel c1: starting piece 1 at 14-MAY-18
  28. channel c2: finished piece 1 at 14-MAY-18
  29. piece handle=11t2t69h_1_1 tag=TAG20180514T195321 comment=API Version 2.0,MMS Version 10.4.0.4
  30. channel c2: backup set complete, elapsed time: 00:00:26
  31. channel c2: starting full datafile backup set
  32. channel c2: specifying datafile(s) in backup set
  33. input datafile file number=00005 name=+DATA/ORCL2/DATAFILE/example.267.976031415
  34. channel c2: starting piece 1 at 14-MAY-18
  35. channel c1: finished piece 1 at 14-MAY-18
  36. piece handle=12t2t6ab_1_1 tag=TAG20180514T195321 comment=API Version 2.0,MMS Version 10.4.0.4
  37. channel c1: backup set complete, elapsed time: 00:00:25
  38. channel c1: starting full datafile backup set
  39. channel c1: specifying datafile(s) in backup set
  40. input datafile file number=00004 name=+DATA/ORCL2/DATAFILE/users.268.976031411
  41. channel c1: starting piece 1 at 14-MAY-18
  42. channel c2: finished piece 1 at 14-MAY-18
  43. piece handle=13t2t6ab_1_1 tag=TAG20180514T195321 comment=API Version 2.0,MMS Version 10.4.0.4
  44. channel c2: backup set complete, elapsed time: 00:00:25

复制代码

backup duration:
  1. backup duration   00:05 minimize load tablespace users ;
复制代码

-----------------------------多租户体系结构:
1. 从V$视图开始熟悉(不要从数据字典视图开始),相同的v$视图要在根容器和插件数据库之一上分别查一遍。注意从(v$database,v$instance)之后查询结果就会不一样。要特别注意con_id这一列(0或1)。

2. 两个V$视图的连接,一定要加上a.con_id=b.con_id。

  1. select   d.CON_ID,d.NAME,d.OPEN_MODE,d.CDB
  2. from v$database d;

  3. select i.INSTANCE_MODE, i.INSTANCE_NAME,i.CON_ID
  4.   from v$instance i;
  5.   
  6.   select s.CON_ID,s.NAME,s.PDB
  7.    from v$services s;
  8.    
  9.     select  p.CON_ID,p.NAME,p.OPEN_MODE
  10.   from v$pdbs p;
  11.   
  12.   alter pluggable database pdb1_1 close;
  13.   
  14.       select  p.CON_ID,p.NAME,p.OPEN_MODE
  15.   from v$pdbs p;
  16.   
  17.   alter pluggable database pdb1_1 open ;
  18.   
  19.     alter pluggable database pdb1_1 close immediate;
  20.    
  21.     select  c.CON_ID,c.DBID,c.PDB_ID, c.GUID  , c.PDB_NAME,c.STATUS
  22.    from cdb_pdbs c;
  23.    
  24.     select  * from v$logfile;
  25.    
  26.      select * from v$controlfile;
  27.      
  28.       select  c.CON_ID,c.FILE_NAME,c.STATUS from
  29.   cdb_data_files c order by c.CON_ID;
  30.   
  31.              select c.FILE_NAME,c.STATUS from
  32.   dba_data_files c;
  33.      
  34.     select  d.CON_ID,d.NAME,d.STATUS
  35.   from v$datafile d order by 1;
  36.   
  37.   -----------------
  38.     select t.NAME,t.STATUS,t.CON_ID
  39.    from v$tempfile t;
  40.   
  41.   --------------------
  42.    select t.CON_ID,t.NAME,d.NAME,d.STATUS
  43.   from v$tablespace t, v$datafile d
  44.   where t.TS#=d.TS#  and t.CON_ID=d.CON_ID
  45.   order by 1,2;
  46.   
  47.   
复制代码









回复

使用道具 举报

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

本版积分规则

QQ|手机版|Botang唐波's Oracle Station   

GMT+8, 2018-9-19 07:16 , Processed in 0.206346 second(s), 27 queries .

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