标签云
asm恢复 bbed bootstrap$ dul In Memory kcbzib_kcrsds_1 kccpb_sanity_check_2 kfed MySQL恢复 ORA-00312 ORA-00607 ORA-00704 ORA-01110 ORA-01555 ORA-01578 ORA-08103 ORA-600 2131 ORA-600 2662 ORA-600 2663 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 Oracle 恢复 ORACLE恢复 ORACLE数据库恢复 oracle 比特币 OSD-04016 YOUR FILES ARE ENCRYPTED 勒索恢复 比特币加密文章分类
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (102)
- 数据库 (1,666)
- DB2 (22)
- MySQL (73)
- Oracle (1,528)
- Data Guard (51)
- EXADATA (8)
- GoldenGate (21)
- ORA-xxxxx (159)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (14)
- ORACLE 21C (3)
- Oracle 23ai (7)
- Oracle ASM (65)
- Oracle Bug (8)
- Oracle RAC (52)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (28)
- Oracle备份恢复 (559)
- Oracle安装升级 (90)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (77)
- PostgreSQL (18)
- PostgreSQL恢复 (6)
- SQL Server (27)
- SQL Server恢复 (8)
- TimesTen (7)
- 达梦数据库 (2)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (37)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (20)
-
最近发表
- 清空redo,导致ORA-27048: skgfifi: file header information is invalid
- A_H_README_TO_RECOVER勒索恢复
- 通过alert日志分析客户自行对一个数据库恢复的来龙去脉和点评
- ORA-12514: TNS: 监听进程不能解析在连接描述符中给出的SERVICE_NAME
- ORA-01092 ORA-00604 ORA-01558故障处理
- ORA-65088: database open should be retried
- Oracle 19c异常恢复—ORA-01209/ORA-65088
- ORA-600 16703故障再现
- 数据库启动报ORA-27102 OSD-00026 O/S-Error: (OS 1455)
- .[metro777@cock.li].Elbie勒索病毒加密数据库恢复
- 应用连接错误,初始化mysql数据库恢复
- RAC默认服务配置优先节点
- Oracle 19c RAC 替换私网操作
- 监听报TNS-12541 TNS-12560 TNS-00511错误
- drop tablespace xxx including contents恢复
- Linux 8 修改网卡名称
- 如何修改集群的公网信息(包括 VIP) (Doc ID 1674442.1)
- 如何在 oracle 集群环境下修改私网信息 (Doc ID 2103317.1)
- ORA-600 [kcvfdb_pdb_set_clean_scn: cleanckpt] 相关bug
- ORA-600 krhpfh_03-1210故障处理
标签归档:ORACLE 12C
Oracle 12C Active Data Guard Far Sync 配置
Active Data Guard Far Sync是Oracle 12c的新功能(也称为Far Sync Standby),Far Sync功能的实现是通过在距离主库(Primary Database)相对较近的地点配置Far Sync实例,主库(Primary Database) 同步(synchronous)传输redo到Far Sync实例,然后Far Sync实例再将redo异步(asynchronous)传输到终端备库(Standby Database)。这样既可以保证零数据丢失又可以降低主库压力。Far Sync实例只有密码文件,init参数文件和控制文件,而没有数据文件。 如果redo 传输采用Maximum Availability模式,我们可以在距离生产中心(Primary Database)相对较近的地点配置Far Sync实例,主库(Primary Database)同步(synchronous)传输redo到Far Sync实例,保证零数据丢失(zero data loss),同时主库和Far Sync距离较近,网络延时很小,因此对主库性能影响很小。然后Far Sync实例再将redo异步(asynchronous)发送到终端备库(Standby Database)。 如果redo 传输采用Maximum Performance模式,我们可以在距离生产中心(Primary Database)相对较近的地点配置Far Sync实例,主库(Primary Database) 异步传输redo到Far Sync实例,然后Far Sync实例再负责传输redo到其他多个终端备库(Standby Database)。这样可以减少主库向多个终端备库(Standby Database)传输redo的压力(offload)。 Far Sync配置对于Data Guard 角色转换(role transitions)是透明的,即switchover/failover命令方式与12c之前相同。
1.主库配置fra
SQL> alter system set DB_RECOVERY_FILE_DEST_SIZE=200G; System altered. SQL> alter system set db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'; System altered.
2.启用归档模式和强制日志
SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total System Global Area 2516582400 bytes Fixed Size 4585912 bytes Variable Size 671090248 bytes Database Buffers 1828716544 bytes Redo Buffers 12189696 bytes Database mounted. SQL> alter database archivelog; Database altered. SQL> alter database force logging; Database altered. SQL> alter database open; Database altered.
3.主机规划
192.168.137.121 ora1221 --->主库(ORCL12C) 192.168.137.122 ora1222 --->Far Sync实例(ORCL12CFS) 192.168.137.123 ora1223 --->备库(ORCL12CDG)
4.tns配置
ORCL12C = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ora1221)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl12c) ) ) ORCL12CDG = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ora1223)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl12c) ) ) ORCL12CFS = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ora1222)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl12c) ) )
5.参数文件配置
--主库 db_unique_name='orcl12c' service_names='orcl12c' log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=orcl12c' log_archive_dest_2='service=orcl12cfs lgwr sync AFFIRM MAX_FAILURE=1 ALTERNATE=LOG_ARCHIVE_DEST_3 valid_for=(online_logfiles,primary_role) db_unique_name=orcl12cfs' LOG_ARCHIVE_DEST_3='SERVICE=orcl12cdg lgwr ASYNC ALTERNATE=LOG_ARCHIVE_DEST_2 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl12cdg' LOG_ARCHIVE_DEST_STATE_3=ALTERNATE log_archive_config='dg_config=(orcl12c,orcl12cdg,orcl12cfs)' standby_file_management=auto db_file_name_convert='/u01/app/oracle/oradata/orcl12c/','/u01/app/oracle/oradata/orcl12c/' log_file_name_convert='/u01/app/oracle/oradata/orcl12c/','/u01/app/oracle/oradata/orcl12c/' fal_server='orcl12cdg','orcl12cfs' --Far Sync实例 db_unique_name='orcl12cfs' service_names='orcl12c' log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=orcl12cfs' log_archive_dest_2='service=orcl12cdg lgwr async valid_for=(STANDBY_LOGFILES,STANDBY_ROLE) db_unique_name=orcl12cdg' log_archive_config='dg_config=(orcl12c,orcl12cdg,orcl12cfs)' standby_file_management=manual fal_server='orcl12c' --备库 db_unique_name='orcl12cdg' service_names='orcl12c' log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=orcl12cdg' log_archive_dest_2='service=orcl12c lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=orcl12c' log_archive_config='dg_config=(orcl12c,orcl12cdg,orcl12cfs)' standby_file_management=auto db_file_name_convert='/u01/app/oracle/oradata/orcl12c/','/u01/app/oracle/oradata/orcl12c/' log_file_name_convert='/u01/app/oracle/oradata/orcl12c/','/u01/app/oracle/oradata/orcl12c/' fal_server='orcl12c','orcl12cfs'
6.密码文件
拷贝主库的密码文件到Far Sync实例和备库$ORACLE_HOME/dbs下(如果是win在%ORACLE_HOME%/database中)
7.创建Far Sync实例
创建和参数文件匹配的fra,adump目录
--主库 ALTER DATABASE CREATE FAR SYNC INSTANCE CONTROLFILE AS '/tmp/controlfs01.ctl'; 拷贝到Far Sync实例对应的控制文件位置 --Far Sync实例 startup pfile='/tmp/pfile' mount ALTER DATABASE ADD STANDBY LOGFILE thread 1 GROUP 10 '/u01/app/oracle/oradata/orcl12c/std_redo10.log' size 50m reuse; ALTER DATABASE ADD STANDBY LOGFILE thread 1 GROUP 11 '/u01/app/oracle/oradata/orcl12c/std_redo11.log' size 50m reuse; ALTER DATABASE ADD STANDBY LOGFILE thread 1 GROUP 12 '/u01/app/oracle/oradata/orcl12c/std_redo12.log' size 50m reuse; ALTER DATABASE ADD STANDBY LOGFILE thread 1 GROUP 13 '/u01/app/oracle/oradata/orcl12c/std_redo13.log' size 50m reuse; ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
8.创建备库
创建和参数文件匹配的fra,adump目录
--主库备份(传输至备库) backup database format '/tmp/ora12c_%U'; --主库创建standby ctl(传输至备库和备库参数文件路径一致) alter database create standby controlfile as '/tmp/controlst.ctl'; --启动备库至mount startup pfile='/tmp/pfile' mount; --备库注册备份 catalog start with '/tmp/xifenfei/'; --备库还原数据文件并恢复 restore database; recover database; --增加standby redo ALTER DATABASE ADD STANDBY LOGFILE thread 1 GROUP 10 '/u01/app/oracle/oradata/orcl12c/std_redo10.log' size 50m reuse; ALTER DATABASE ADD STANDBY LOGFILE thread 1 GROUP 11 '/u01/app/oracle/oradata/orcl12c/std_redo11.log' size 50m reuse; ALTER DATABASE ADD STANDBY LOGFILE thread 1 GROUP 12 '/u01/app/oracle/oradata/orcl12c/std_redo12.log' size 50m reuse; ALTER DATABASE ADD STANDBY LOGFILE thread 1 GROUP 13 '/u01/app/oracle/oradata/orcl12c/std_redo13.log' size 50m reuse; --备库开启mrp进程 ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION; --主库增加standby redo ALTER DATABASE ADD STANDBY LOGFILE thread 1 GROUP 10 '/u01/app/oracle/oradata/orcl12c/std_redo10.log' size 50m reuse; ALTER DATABASE ADD STANDBY LOGFILE thread 1 GROUP 11 '/u01/app/oracle/oradata/orcl12c/std_redo11.log' size 50m reuse; ALTER DATABASE ADD STANDBY LOGFILE thread 1 GROUP 12 '/u01/app/oracle/oradata/orcl12c/std_redo12.log' size 50m reuse; ALTER DATABASE ADD STANDBY LOGFILE thread 1 GROUP 13 '/u01/app/oracle/oradata/orcl12c/std_redo13.log' size 50m reuse;
9.配置结果
SQL> select * from V$DATAGUARD_CONFIG; DB_UNIQUE_NAME PARENT_DBUN DEST_ROLE CURRENT_SCN CON_ID ------------------------------ ------------------------------ ----------------- ----------- ---------- orcl12c NONE PRIMARY DATABASE 1950551 0 orcl12cfs orcl12c FAR SYNC INSTANCE 1950390 0 orcl12cdg orcl12cfs PHYSICAL STANDBY 1950390 0 SQL> select group#, status, thread#, sequence#, first_change#, next_change# from v$standby_log; GROUP# STATUS THREAD# SEQUENCE# FIRST_CHANGE# NEXT_CHANGE# ---------- ---------- ---------- ---------- ------------- ------------ 10 ACTIVE 1 27 1863140 11 UNASSIGNED 1 0 12 UNASSIGNED 1 0 13 UNASSIGNED 1 0 SQL> select PROTECTION_MODE,PROTECTION_LEVEL from v$database; PROTECTION_MODE PROTECTION_LEVEL -------------------- -------------------- MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
10.调整保护级别
从MAXIMUM PERFORMANCE调整为MAXIMUM AVAILABILITY
--主库 SQL> startup mount; ORACLE instance started. Total System Global Area 2516582400 bytes Fixed Size 4585912 bytes Variable Size 671090248 bytes Database Buffers 1828716544 bytes Redo Buffers 12189696 bytes Database mounted. SQL> alter database set standby database to maximize availability; Database altered. SQL> select PROTECTION_MODE,PROTECTION_LEVEL from v$database; PROTECTION_MODE PROTECTION_LEVEL -------------------- -------------------- MAXIMUM AVAILABILITY UNPROTECTED SQL> alter database open; Database altered. SQL> select PROTECTION_MODE,PROTECTION_LEVEL from v$database; PROTECTION_MODE PROTECTION_LEVEL -------------------- -------------------- MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY --Far Sync实例 SQL> select PROTECTION_MODE,PROTECTION_LEVEL from v$database; PROTECTION_MODE PROTECTION_LEVEL -------------------- -------------------- MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY --备库 SQL> select PROTECTION_MODE,PROTECTION_LEVEL from v$database; PROTECTION_MODE PROTECTION_LEVEL -------------------- -------------------- MAXIMUM AVAILABILITY RESYNCHRONIZATION
Oracle 12C TABLE ACCESS BY INDEX ROWID BATCHED
从Oracle 12C开始执行计划中可能会出现TABLE ACCESS BY INDEX ROWID BATCHED,官方的解释:TABLE ACCESS BY INDEX ROWID BATCHED:means that the database retrieves a few rowids from the index, and then attempts to access rows in block order to improve the clustering and reduce the number of times that the database must access a block.主要意思:对于一个块中多个rowid,通过批量减少访问快的次数.而作为12.1的新特性,数据库是通过_optimizer_batch_table_access_by_rowid来控制的
数据库版本12.1
SQL> select * from v$version; BANNER CON_ID -------------------------------------------------------------------------------- ---------- Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production 0 PL/SQL Release 12.1.0.2.0 - Production 0 CORE 12.1.0.2.0 Production 0 TNS for IBM/AIX RISC System/6000: Version 12.1.0.2.0 - Production 0 NLSRTL Version 12.1.0.2.0 - Production 0
TABLE ACCESS BY INDEX ROWID BATCHED执行计划
SQL> set autot traceonly exp stat; SQL> var b1 number; SQL> set lines 150 SQL> set pages 10000 SQL> exec :b1:=18868701138; PL/SQL procedure successfully completed. SQL> SELECT BRAND_ID FROM T_USERTYPE_FULLNO WHERE BILL_ID= LTRIM(:B1 ,'0') AND ROWNUM < 2; Execution Plan ---------------------------------------------------------- Plan hash value: 942613467 ----------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ----------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 15 | 2 (0)| 00:00:01 | |* 1 | COUNT STOPKEY | | | | | | | 2 | TABLE ACCESS BY INDEX ROWID BATCHED| XIFENFEI | 1 | 15 | 2 (0)| 00:00:01 | |* 3 | INDEX RANGE SCAN | IND_XIFENFEI | 1 | | 2 (0)| 00:00:01 | ----------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - filter(ROWNUM<2) 3 - access("BILL_ID"=LTRIM(:B1,'0')) Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 5 consistent gets 0 physical reads 0 redo size 559 bytes sent via SQL*Net to client 552 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed
_optimizer_batch_table_access_by_rowid参数为true
SQL> col name for a32 SQL> col value for a24 col description for a70 set linesize 150 select a.ksppinm name,b.ksppstvl value,a.ksppdesc description SQL> SQL> SQL> 2 from x$ksppi a,x$ksppcv b 3 where a.inst_id = USERENV ('Instance') 4 and b.inst_id = USERENV ('Instance') 5 and a.indx = b.indx 6 and upper(a.ksppinm) LIKE upper('%¶m%') 7 order by name 8 / Enter value for param: _optimizer_batch_table_access_by_rowid old 6: and upper(a.ksppinm) LIKE upper('%¶m%') new 6: and upper(a.ksppinm) LIKE upper('%_optimizer_batch_table_access_by_rowid%') NAME VALUE DESCRIPTION ------------------------------------- ------------------------ ---------------------------------------------- _optimizer_batch_table_access_by_rowid TRUE enable table access by ROWID IO batching
设置_optimizer_batch_table_access_by_rowid为false,执行计划由TABLE ACCESS BY INDEX ROWID BATCHED变为TABLE ACCESS BY INDEX ROWID
SQL> set autot traceonly exp stat; SQL> var b1 number; SQL> set lines 150 SQL> set pages 10000 SQL> exec :b1:=18868701138; PL/SQL procedure successfully completed. SQL> alter session set "_optimizer_batch_table_access_by_rowid"=false; Session altered. SQL> SELECT BRAND_ID FROM XIFENFEI WHERE BILL_ID= LTRIM(:B1 ,'0') AND ROWNUM < 2; Execution Plan ---------------------------------------------------------- Plan hash value: 2797551150 --------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | --------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 15 | 2 (0)| 00:00:01 | |* 1 | COUNT STOPKEY | | | | | | | 2 | TABLE ACCESS BY INDEX ROWID| XIFENFEI | 1 | 15 | 2 (0)| 00:00:01 | |* 3 | INDEX RANGE SCAN | IND_XIFENFEI | 1 | | 2 (0)| 00:00:01 | --------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - filter(ROWNUM<2) 3 - access("BILL_ID"=LTRIM(:B1,'0')) Statistics ---------------------------------------------------------- 1 recursive calls 0 db block gets 5 consistent gets 0 physical reads 0 redo size 559 bytes sent via SQL*Net to client 552 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed
optimizer_features_enable修改为11.2之后,_optimizer_batch_table_access_by_rowid会联锁变为fasle
SQL> alter session set optimizer_features_enable = '11.2.0.3'; Session altered. SQL> col name for a52 col value for a24 col description for a50 set linesize 150 select a.ksppinm name,b.ksppstvl value,a.ksppdesc description from x$ksppi a,x$ksppcv b where a.inst_idSQL> SQL> SQL> SQL> 2 3 = USERENV ('Instance') and b.inst_id = USERENV ('Instance') and a.indx = b.indx and upper(a.ksppinm) LIKE upper('%¶m%') order by name 4 5 6 7 8 / Enter value for param: _optimizer_batch_table_access_by old 6: and upper(a.ksppinm) LIKE upper('%¶m%') new 6: and upper(a.ksppinm) LIKE upper('%_optimizer_batch_table_access_by%') NAME VALUE DESCRIPTION ------------------------------------------ -------------- ----------------------------------------- _optimizer_batch_table_access_by_rowid FALSE enable table access by ROWID IO batching
这里可以看出来,在调整optimizer_features_enable参数后,会直接影响某些数据库相关的优化器参数,例如:_optimizer_batch_table_access_by_rowid
InMemory评估利器—Oracle Database InMemory Advisor
我想大家都可能有一个疑问,数据库从以前版本升级到12C,计划使用in-memory特性,那我怎么评估哪些表放进去合适,放进去后,整体性能又会提升多少,需要in-memory内存为多大?这些问题如果人工去判断不一定准确,而且可能有很多遗落,Oracle也考虑到了这一点,因此发布了Oracle Database InMemory Advisor,从而来比较简单的实现数据库使用In-Memory简单配置.Oracle Database InMemory Advisor主要通过DBMS_INMEMORY_ADVISOR包分析 Active Session History (ASH), Automatic Workload Repository (AWR) and SQL Tuning Sets (STS)信息进行分析,给出建议.
Oracle Database InMemory Advisor使用前提
1.数据库版本为11.2.0.3及其以上版本(compatibility>=11.2.0.3)
2.需要有Database Tuning pack liscense支持(仅仅是liscense,不是功能)
安装Oracle Database InMemory Advisor
[oracle@localhost xff]$ unzip imadvisor.zip Archive: imadvisor.zip inflating: instimadv.sql inflating: dbmsimadv.sql inflating: prvtimadv.plb inflating: dbmsimadvint.plb inflating: prvtimadvint.plb inflating: schmimadv.sql inflating: imadvisor_version.sql inflating: imadvisor_load_report_templates.sql inflating: imadvisor_clone_view.sql inflating: imadvisor_analyze_and_report.sql inflating: imadvisor_spool_debug.sql inflating: imadvisor_export.sql inflating: imadvisor_DataPump.sql inflating: imadvisor_awr_augment_export.sql inflating: imadvisor_awr_augment_import.sql inflating: imadvisor_awr_augment_tables.sql inflating: imadvisor_fetch_recommendations.sql [oracle@localhost xff]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 18 16:21:08 2015 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> @instimadv Welcome to the Oracle Database In-Memory Advisor (DBMS_INMEMORY_ADVISOR) installation. The Oracle Database In-Memory Advisor is licensed as part of the Oracle Tuning Pack. Do you currently have a valid Oracle Tuning Pack license with this database (Y/N)? Y DBMS_INMEMORY_ADVISOR uses Active Session History (ASH), Automatic Workload Repository (AWR) and optionally SQL Tuning Sets (STS) to determine which tables, partitions and subpartitions to place In Memory for optimized analytics processing performance. DBMS_INMEMORY_ADVISOR produces a recommendation report and a SQLPlus script to implement its recommendations. This installation script will create user IMADVISOR and add object definitions to the schema including the DBMS_INMEMORY_ADVISOR package. This installation script creates user IMADVISOR using the IDENTIFIED BY password method. If you prefer to use either the IDENTIFIED EXTERNALLY or IDENTIFIED GLOBALLY method, abort this installation by pressing ^C. Then create user IMADVISOR using your preferred method. Add no objects to the IMADVISOR schema. Then run this installation script again. These actions will be taken on the database to which you are currently connected. Please enter the connection ID for the current database? qsng This installation script creates a new Oracle database user and schema named IMADVISOR for the operation of DBMS_INMEMORY_ADVISOR... Please enter the password for user IMADVISOR? For confirmation, please re-enter the password for user IMADVISOR? Available tablespaces: TABLESPACE_NAME ------------------------------ FSDATA MYDATA SYSAUX SYSTEM TEMP UNDOTBS1 USERS Please enter the default tablespace name for user IMADVISOR? users The In-Memory Advisor uses the Oracle directory object IMADVISOR_DIRECTORY by default. If you wish to create the IMADVISOR_DIRECTORY object, please enter an OS host directory path for the IMADVISOR_DIRECTORY object. If not, please press ENTER to continue. ? /tmp/xff Connecting to IMADVISOR @ qsng.. Enter password: Connected. No errors. No errors. No errors. No errors. No errors. No errors. DBMS_INMEMORY_ADVISOR installation successful. Users who will use the DBMS_INMEMORY_ADVISOR package must be GRANTed EXECUTE on the DBMS_INMEMORY_ADVISOR package. Please enter a comma separated list of Oracle Database users to whom you wish EXECUTE on the DBMS_INMEMORY_ADVISOR package to be GRANTed? SYS GRANT EXECUTE ON dbms_inmemory_advisor TO SYS While logged in as IMADVISOR or with sufficient privileges, you can GRANT EXECUTE ON DBMS_INMEMORY_ADVISOR to additional users as needed. DBMS_INMEMORY_ADVISOR installation and setup complete. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
Oracle Database InMemory Advisor生成报告
[oracle@localhost xff]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 18 16:30:57 2015 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> @imadvisor_analyze_and_report Specify the IM task name The IM Advisor generates a report as imadvisor_<taskname>.html file in the current working directory The sql file is generated as imadvisor_sql_<taskname>.sql Enter value for im_task_name: xifenfei IM Task name Specified: xifenfei Enter begin time for report: -- Valid input formats: -- To specify absolute begin time: -- [MM/DD[/YY]] HH24:MI[:SS] -- Examples: 02/23/03 14:30:15 -- 02/23 14:30:15 -- 14:30:15 -- 14:30 -- To specify relative begin time: (start with '-' sign) -- -[HH24:]MI -- Examples: -1:15 (SYSDATE - 1 Hr 15 Mins) -- -25 (SYSDATE - 25 Mins) Enter value for begin_time: -3 Report begin time specified: -3 old 102: lbtime_in := nvl('&&begin_time', '-60'); new 102: lbtime_in := nvl('-3', '-60'); old 104: :btime := to_char( begin_time, '&&imadvisor_time_format' ); new 104: :btime := to_char( begin_time, 'YYYY-MON-DD HH24:MI:SS.FF' ); Enter duration in minutes starting from begin time: Defaults to SYSDATE - begin_time Enter value for duration: Report duration specified: old 8: begin_time := to_timestamp(:btime, '&&imadvisor_time_format'); new 8: begin_time := to_timestamp(:btime, 'YYYY-MON-DD HH24:MI:SS.FF'); old 18: duration := nvl('&&duration', since_begin_time); new 18: duration := nvl('', since_begin_time); old 29: :etime := to_char( end_time, '&&imadvisor_time_format' ); new 29: :etime := to_char( end_time, 'YYYY-MON-DD HH24:MI:SS.FF' ); Using 2015-MAR-18 16:28:22.000000000 as report begin time Using 2015-MAR-18 16:31:22.000000000 as report end time IM Advisor: Adding Statistics.. IMADVISOR: Finished Adding Statistics IMADVISOR: Finished Executing the task IM Advisor: Generating Recommendations.. imadvisor_xifenfei.html imadvisor_sql_xifenfei.html imadvisor_object_xifenfei.html imadvisor_xifenfei.sql 'Fetching recommendation files for task xifenfei' IM Advisor generated report in imadvisor_xifenfei.html IM Advisor genreated DDL script in imadvisor_xifenfei.sql SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@localhost xff]$ ls -ltr *xifenfei* -rw-r--r-- 1 oracle oinstall 887 Mar 18 16:33 imadvisor_xifenfei.sql -rw-r--r-- 1 oracle oinstall 30175 Mar 18 16:33 imadvisor_xifenfei.html -rw-r--r-- 1 oracle oinstall 13576 Mar 18 16:33 imadvisor_sql_xifenfei.html -rw-r--r-- 1 oracle oinstall 8931 Mar 18 16:33 imadvisor_object_xifenfei.html -rw-r--r-- 1 oracle oinstall 3405 Mar 18 16:33 imadvisor_auxiliary_xifenfei.html
这里输入的Task name为:xifenfei,Oracle Database InMemory Advisor结果
imadvisor_xifenfei.html是InMemory Advisor的一个整体描述
imadvisor_xifenfei.sql是InMemory Advisor生成的表级别的INMEMORY语句,可以直接通过@方式执行,或者修改后执行
imadvisor_sql_xifenfei.html主要是InMemory Advisor中关于sql的分析报告
imadvisor_object_xifenfei.html是InMemory Advisor中建议InMemory处理的对象分析报告
imadvisor_auxiliary_xifenfei.html 是一个辅助的总结
卸载Oracle Database InMemory Advisor
[oracle@localhost ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 18 21:55:49 2015 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> drop user imadvisor cascade; User dropped.
补充内容
1.在某些情况下,可能无法直接创建用户imadvisor,或者创建目录imadvisor_directory,可以通过类似命令创建,并修改instimadv.sql脚本屏蔽掉交互式安装
create user IMADVISOR identified by Oracle_123 DEFAULT TABLESPACE system; CREATE OR REPLACE DIRECTORY imadvisor_directory AS '/tmp/xff/txt'; GRANT READ, WRITE ON DIRECTORY imadvisor_directory TO IMADVISOR;
2.在执行@imadvisor_analyze_and_report生成报告,可能会遇到ORA-24817: Unable to allocate the given chunk for current lob operation,解决方案为:
1. Copy the original script to a new location to serve as a backup. 2. Edit the script imadvisor_fetch_recommendations.sql and change the line in the script: SET LONGCHUNKSIZE 2000000000 to SET LONGCHUNKSIZE 32767 3. Save and run the script.
参考文档
Oracle Database InMemory Advisor (Doc ID 1965343.1)
Using Inmemory Advisor Errors When Running Imadvisor_analyze_and_report (Doc ID 1987462.1)