|
跟共享池本质相关的SQL语句:
- select s.USERNAME, s.TERMINAL , s.MACHINE ,
- s.SID, s.SERIAL#, s.SQL_ID,
- s.PADDR , s.SADDR,s.TADDR
- from v_$session s
- where s.USERNAME='HR';
复制代码- select * from v$memory_dynamic_components ;
-
- 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
根据硬件档次,可以调的“多”进程:
- SQL> alter system set log_archive_max_processes=8;
- System altered.
- SQL> alter system set db_writer_processes=4 scope=spfile;
复制代码
实例恢复(归档和非归档下都能执行):基底是当前数据库,起点是检查点位置,终点是日志最后一行。
媒介恢复(一般只能在归档模式下进行):基底是备份,起点是备份的数据文件头上当时的检查点号,终点如果是日志最后一行就是完全恢复;如果停在中间就是不完全恢复。
- select * from v$log;
- select resetlogs_change#, checkpoint_change#, current_scn from v$database;
- select name , CHECKPOINT_CHANGE# from v$datafile;
- alter tablespace users offline;
- alter tablespace example begin backup;
- alter tablespace users online;
- alter tablespace example end backup;
复制代码
控制文件多路复用:
- SQL> show parameter control_
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- control_file_record_keep_time integer 7
- control_files string +DATA/orcl/controlfile/current
- .260.832197281, +FRA/orcl/cont
- rolfile/current.256.832197283
- control_management_pack_access string DIAGNOSTIC+TUNING
- SQL> alter system set control_files='+DATA/orcl/controlfile/current.260.832197281','+FRA/orcl/controlfile/current.256.832197283','/home/oracle/control03.ctl' ;
- alter system set control_files='+DATA/orcl/controlfile/current.260.832197281','+FRA/orcl/controlfile/current.256.832197283','/home/oracle/control03.ctl'
- *
- ERROR at line 1:
- ORA-02095: specified initialization parameter cannot be modified
- SQL> alter system set control_files='+DATA/orcl/controlfile/current.260.832197281','+FRA/orcl/controlfile/current.256.832197283','/home/oracle/control03.ctl' scope=spfile;
- System altered.
- SQL> shutdown immediate
- Database closed.
- Database dismounted.
- ORACLE instance shut down.
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
- With the Partitioning, Automatic Storage Management, OLAP, Data Mining
- and Real Application Testing options
- [oracle@station87 ~]$ . oraenv
- ORACLE_SID = [orcl] ? +ASM
- The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is /u01/app/oracle
- [oracle@station87 ~]$ asmcmd cp +DATA/orcl/controlfile/current.260.832197281 /home/oracle/control03.ctl
- copying +DATA/orcl/controlfile/current.260.832197281 -> /home/oracle/control03.ctl
- [oracle@station87 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Fri May 25 05:25:25 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
- With the Automatic Storage Management option
- [oracle@station87 ~]$ . oraenv
- ORACLE_SID = [+ASM] ? orcl
- The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
- [oracle@station87 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Fri May 25 05:25:38 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected to an idle instance.
- SQL> startup
- ORACLE instance started.
- Total System Global Area 820236288 bytes
- Fixed Size 1339628 bytes
- Variable Size 650120980 bytes
- Database Buffers 163577856 bytes
- Redo Buffers 5197824 bytes
- Database mounted.
- Database opened.
- SQL> show parameter control
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- control_file_record_keep_time integer 7
- control_files string +DATA/orcl/controlfile/current
- .260.832197281, +FRA/orcl/cont
- rolfile/current.256.832197283,
- /home/oracle/control03.ctl
- control_management_pack_access string DIAGNOSTIC+TUNING
- SQL>
复制代码 两路归档的配置:
- SQL> alter system set log_archive_dest_1='location=use_db_recovery_file_dest';
- System altered.
- SQL> alter system set log_archive_dest_2='location=/home/oracle';
- System altered.
- SQL> show parameter log_archive_format
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- log_archive_format string %t_%s_%r.dbf
复制代码
|
|