Bo's Oracle Station

查看: 1310|回复: 0

课程第5/6/7次(2018-05-22星期二,2018-05-24星期四,2018-05-29星期二)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2018-5-22 20:17:48 | 显示全部楼层 |阅读模式
跟共享池本质相关的SQL语句:
  1. select  s.USERNAME, s.TERMINAL , s.MACHINE ,
  2.            s.SID, s.SERIAL#, s.SQL_ID,
  3.            s.PADDR , s.SADDR,s.TADDR
  4. from v_$session s
  5. where s.USERNAME='HR';
复制代码
  1. select  * from v$memory_dynamic_components ;

  2. select  name , value from v$parameter where name='log_buffer';
复制代码

理解体系结构,从两个分支上观察:
1. 一个分支是检查点位置。
2. 检查点号
SQL> select   resetlogs_change#, checkpoint_change#, current_scn from v$database;

RESETLOGS_CHANGE# CHECKPOINT_CHANGE# CURRENT_SCN
----------------- ------------------ -----------
      1594143         2185683     2215528


SQL> select   CHECKPOINT_CHANGE# from v$datafile;

CHECKPOINT_CHANGE#
------------------
       2185683
       2185683
       2185683
       2185683
       2185683


根据硬件档次,可以调的“多”进程:
  1. SQL> alter system set log_archive_max_processes=8;

  2. System altered.

  3. SQL> alter system set db_writer_processes=4 scope=spfile;
复制代码

实例恢复(归档和非归档下都能执行):基底是当前数据库,起点是检查点位置,终点是日志最后一行。
媒介恢复(一般只能在归档模式下进行):基底是备份,起点是备份的数据文件头上当时的检查点号,终点如果是日志最后一行就是完全恢复;如果停在中间就是不完全恢复。

  1. select  * from v$log;

  2. select   resetlogs_change#, checkpoint_change#, current_scn from v$database;

  3. select   name , CHECKPOINT_CHANGE# from v$datafile;

  4. alter tablespace users offline;

  5. alter tablespace example begin backup;

  6. alter tablespace users online;

  7. alter tablespace example end backup;

复制代码

控制文件多路复用:
  1. SQL> show parameter control_

  2. NAME                                     TYPE         VALUE
  3. ------------------------------------ ----------- ------------------------------
  4. control_file_record_keep_time             integer         7
  5. control_files                             string         +DATA/orcl/controlfile/current
  6.                                                  .260.832197281, +FRA/orcl/cont
  7.                                                  rolfile/current.256.832197283
  8. control_management_pack_access             string         DIAGNOSTIC+TUNING
  9. SQL> alter system set control_files='+DATA/orcl/controlfile/current.260.832197281','+FRA/orcl/controlfile/current.256.832197283','/home/oracle/control03.ctl' ;
  10. alter system set control_files='+DATA/orcl/controlfile/current.260.832197281','+FRA/orcl/controlfile/current.256.832197283','/home/oracle/control03.ctl'
  11.                  *
  12. ERROR at line 1:
  13. ORA-02095: specified initialization parameter cannot be modified


  14. SQL> alter system set control_files='+DATA/orcl/controlfile/current.260.832197281','+FRA/orcl/controlfile/current.256.832197283','/home/oracle/control03.ctl'  scope=spfile;

  15. System altered.

  16. SQL> shutdown immediate
  17. Database closed.
  18. Database dismounted.
  19. ORACLE instance shut down.
  20. SQL> exit
  21. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
  22. With the Partitioning, Automatic Storage Management, OLAP, Data Mining
  23. and Real Application Testing options
  24. [oracle@station87 ~]$ . oraenv
  25. ORACLE_SID = [orcl] ? +ASM
  26. The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is /u01/app/oracle
  27. [oracle@station87 ~]$ asmcmd cp +DATA/orcl/controlfile/current.260.832197281  /home/oracle/control03.ctl
  28. copying +DATA/orcl/controlfile/current.260.832197281 -> /home/oracle/control03.ctl
  29. [oracle@station87 ~]$ sqlplus /nolog

  30. SQL*Plus: Release 11.2.0.1.0 Production on Fri May 25 05:25:25 2018

  31. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  32. SQL> conn / as sysdba
  33. Connected.
  34. SQL> exit
  35. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
  36. With the Automatic Storage Management option
  37. [oracle@station87 ~]$ . oraenv
  38. ORACLE_SID = [+ASM] ? orcl
  39. The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
  40. [oracle@station87 ~]$ sqlplus /nolog

  41. SQL*Plus: Release 11.2.0.1.0 Production on Fri May 25 05:25:38 2018

  42. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  43. SQL> conn / as sysdba
  44. Connected to an idle instance.
  45. SQL> startup
  46. ORACLE instance started.

  47. Total System Global Area  820236288 bytes
  48. Fixed Size                    1339628 bytes
  49. Variable Size                  650120980 bytes
  50. Database Buffers          163577856 bytes
  51. Redo Buffers                    5197824 bytes
  52. Database mounted.
  53. Database opened.
  54. SQL> show parameter control

  55. NAME                                     TYPE         VALUE
  56. ------------------------------------ ----------- ------------------------------
  57. control_file_record_keep_time             integer         7
  58. control_files                             string         +DATA/orcl/controlfile/current
  59.                                                  .260.832197281, +FRA/orcl/cont
  60.                                                  rolfile/current.256.832197283,
  61.                                                   /home/oracle/control03.ctl
  62. control_management_pack_access             string         DIAGNOSTIC+TUNING
  63. SQL>

复制代码
两路归档的配置:

  1. SQL> alter system set log_archive_dest_1='location=use_db_recovery_file_dest';

  2. System altered.

  3. SQL> alter system set log_archive_dest_2='location=/home/oracle';

  4. System altered.

  5. SQL> show parameter log_archive_format

  6. NAME                                     TYPE         VALUE
  7. ------------------------------------ ----------- ------------------------------
  8. log_archive_format                     string         %t_%s_%r.dbf
复制代码




回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-4-24 14:57 , Processed in 0.041098 second(s), 24 queries .

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