11g_Automatic_Diagnostic_Repository
Oracle 11g的目录结构有一些变化,增加了自动诊断库(Automatic Diagnostic Repository)。ADR实际上是个目录,位置由11g的新参数diagnostic_dest确定。如果设置了ORACLE_BASE环境变量,则diagnostic_dest的值就是$ORACLE_BASE,否则为$ORACLE_HOME/log。有了diagnostic_dest参数后,原先的bdump/cdump/udump等参数都失效, 此外ASM, CRS等的trace/log信息,Health Monitor报告等也都放在这里。[@more@]察看ADR信息:SQL> select * from v$diag_info;INST_ID NAME VALUE---------- ------------------------- ----------------------------
11g_DB_Replay
重播(REPLAY)是Oracle11g的一个重要新特性,能够捕捉数据库某个时段发生的所有或者特定的外部请求,并且在另外一个数据库中重现。这使得测试数据库可以比较容易模拟生产环境,做各种测试,尤其是性能方面的测试,获得更加精确的结果。Database Replay主要利用2个package: DBMS_WORKLOAD_CAPTURE 和 DBMS_WORKLOAD_REPLAY,分4个步骤:1. 捕捉产品数据库的负载。2. 预处理捕获的负载信息。3. 重播数据库负载。4. 创建报告并分析结果。[@more@]*********** 源数据库**********--创建存放负载信息的目录。SQL> create directory relay_sou
11g_Health_Monitor
健康监控检查(Health Monitor Check)也是Oracle11g中新出现的功能,用于对数据库作诊断性检查,主要包括以下检查项。[@more@]SQL> select name,INTERNAL_CHECK, OFFLINE_CAPABLE, description from v$hm_check order by 2,3; NAME INTERNAL_CHECK OFFLINE_CAPABLE DESCRIPTION--------------------------------- -------------- --------------- ---------------------------------------------Undo Segment Integrity Check N N Checks integrity of an undo segmentTr
11g_Result_Cache
11g中的Result Cache是Shared Pool中的一块内存,用来存储SQL的执行结果,使得下次运行的相同SQL能直接从内存中读取结果,极大提高性能。[@more@]Result Cache相关的参数:1. result_cache_max_size: Maximum size of the result cache (5M for 5 MB, for example). If you set this to 0, result caching will be completely turned off. 2. result_cache_max_result: Specifies the percentage of result_cache_max_size that any single result can use 3. result_cache_mode: If set to FORCE, all the queries are cached if they
11g_Dependency
下面的SQL看上去比较长,简单来说就是做了以下事情:1. 建表trans2. 建基于表trans的视图vw_trans3. 建package pkg_trans,期间调用trans表4. 建函数adjust,调用pkg_trans[@more@]SQL> create table trans ( 2 trans_id number, 3 cust_name varchar2(20), 4 trans_dt date, 5 trans_amt number(12,2), 6 store_id number(2) 7 ) 8 /
11g_Virtual_Columns
Oracle 11g的虚拟列功能,有点类似于excel的函数列功能--不存实际值,而是根据其他列的值计算得出。[@more@]==准备环境SQL> create table trans ( 2 trans_id number, 3 cust_name varchar2(20), 4 trans_dt date, 5 trans_amt number(12,2), 6 store_id number(2) 7 ) 8 / Table cr
11g_NotNull_Columns_with_Default_Values
先看以前版本中,增加有默认值的非空列有哪些影响。准备环境。建表trans,插入10万条记录SQL> create table trans ( cust_name varchar2(20), trans_dt date, trans_amt number(12,2), store_id number(2) ) /Table created.SQL> declare 2 l_stmt varchar2(2000); 3 begin 4 for ctr in 1..100000 loop 5 l_stmt := 'insert into trans values ('|| 6 ''''||dbms_random.string('U',20)||''','|| 7 'sysdate - '|| 8
11g_DDL_Lock_Timeout
DDL_LOCK_TIMEOUT是11g新引进的参数,主要特征如下:Parameter type => Integer Default value => 0 Modifiable => ALTER SESSION Range of values => 0 to 1,000,000 (in seconds) [@more@]DDL_LOCK_TIMEOUT specifies a time limit for how long DDL statements will wait in a DML lock queue. The default value of zero indicates a status of NOWAIT. The maximum value of 1,000,000 seconds will result in the DDL statement waiting forever to acquire a DML lock.If a lock is not acquired before the timeout p
11g_Password
Oracle 10g的dba_users视图里,password列显示用户加密后的密码。而Oracle 11g中,该列总是显示为空,同时该视图里多了一列PASSWORD_VERSIONS。[@more@]******************* 10g*****************SQL> select username,password from dba_users 2 where username in ('SCOTT','SYS');USERNAME PASSWORD------------------------------ ------------------------------SYS 6F1C6AF6DF44BC28SCOTT F894844C34402B67******************* 11g***************
11g_Datapump
11g中,Data Pump也有一点新功能,还挺有用的。10g中compression参数:COMPRESSION=(METADATA_ONLY | NONE)METADATA_ONLY =〉results in all metadata being written to the dump file in compressed format. This is the default.NONE =〉disables compression for the entire unload.[@more@]11g中这个参数有4个值:COMPRESSION={ALL | DATA_ONLY | METADATA_ONLY | NONE}ALL =〉 enables compression for the entire export operation.DATA_ONLY =〉 results in all data being written to the dump file in compressed format.METADAT
11g_Table_Compression
下面的表可以对所有操作实现压缩存储,而不仅仅是之前版本的direct patch insert。[@more@]create table my_compressed_table (col1 number(20),col2 varchar2(300),...)compress for all operations 在11g中,当数据插入/修改的时候,oracle会象正常表一样存储,只有当块中的重复值达到oracle自己定义的阀值时,压缩动作才会被触发,重复的值被存到Symbol Table中,然后每行中只存储相应值的标记(symbol)。取数据的时候,根据标记从Symbol Table中返回真实值。压缩和解压缩难免会消耗掉大量cpu,但是因为压缩动作的滞后性,对DML的性能
11g_Readonly_Table
如果表能直接改成只读,那要保证数据不被修改的时候,就不用建只读视图,或者只读表空间了。[@more@]SQL> select * from trans; TRANS_ID CUST_NAME TRANS_DT TRANS_AMT STORE_ID ODD_---------- -------------------- --------- ---------- ---------- ---- 101 NLVULXSEUEGDDYEMJCSQ 06-JAN-08 28429555.7 23 ODD 102 WFIZTGOYWVDTQQHHODAL 31-JUL-08 88919063.1 19 ODD 110 cust_110 10-NOV-08 3543.12 23 ODD==把表改成只读。SQL> alter table trans
11g_Calibrating_IO
11g中有个存储过程可以用来评估存储的IO性能,个人认为这是一个很好的新功能。[@more@]==前提1. timed_statistics=TRUE2. Datafile的asynch_io为ON,可以用下面的SQL确定 SQL> col name format a50SQL> SELECT name, asynch_io FROM v$datafile f,v$iostat_file i WHERE f.file# = i.file_no AND filetype_name = 'Data File';NAME ASYNCH_IO-------------------------------------------------- ---------D:APPHZ00540ORADATAORCLSYSTEM01.DBF ASYNC_OND:APPHZ00540ORADATAORCLSYSAUX01.DBF ASYNC_OND:APPHZ00540ORADATAORCLUNDOTB
用shell脚本发送带附件的email
下面的脚步,可以发送带附件的email。其中附件名称为attachment.tar,邮件正文内容包含在letter.txt文件中。此二文件要求在当前目录下(不在当前目录下稍微改点脚本当然也很容易)。$ ls -l-rw-r--r-- 1 oracle dba 34816 Aug 27 13:22 attachment.tar-rw-r--r-- 1 oraapdev1 dba 197 Aug 27 13:45 letter.txt-rwxr-xr-x 1 oraapdev1 dba 156 Aug 27 13:46 mail_att.sh[@more@]$ cat mail_att.sh#!/bin/shmaillist=zhyuh@itpub.netattachment=attachment.tar(uuencode $attachment $attachment && cat letter.txt)|mailx -s 'Hell
要找出某个文件中所有包含数字,且数字大于1000的行
要找出某个文件中所有包含数字,且数字大于1000的行[@more@]$grep -E "[1-9][0-9]{3}" file_name$/usr/xpg4/bin/grep -E '[1-9][0-9]{3}' file_name (Solaris中){3}表示前面部分重复三次,[0-9]就是0-9十个数字种的任何一个,[1-9][0-9]{3}所以就是1000以上的数字。如果要小于1000的话可以用grep -wE "[1-9][0-9]{1,3}",{1,3}是重复1-3次,-w表示整个单词匹配。还有如果只显示匹配部分,不显示整行的话可以加上-o参数。
Oracle EBS -- 编译Form时出错
XXSUP和XXDEV从同一个产品环境克隆过来。Form XXUTS_BULK_RECEIVE.fmb上传到XXSUP中编译通过,而上传到XXDEV中编译时出现错误。编译命令:$cd $XXUTS_TOP/forms/US$frmcmp_batch module=XX_BULK_RECEIVE.fmb userid=apps/****** output_file=XXUTS_BULK_RECEIVE.fmx错误:............Compiling package body APP_CUSTOM...No compilation errors.Compiling package body XXUTS_BUTTON_ACTION...Compilation error on package body XXUTS_BUTTON_ACTION:PL/SQL ERROR 49 at line 441, column 9bad bind variable 'parameter.G_query_find'
latch: cache buffers chains
最近经常碰到这个等待事件,贴个metalink上的有用文档上来。Doc ID: 163424.1[@more@]Goal How to identify blocks which cause latch contention on the 'cache buffers chains' latch. How to identify a hot block within the database buffer cache. Solution Possible hot blocks in the buffer cache normally can be identified by a high or rapid increasing wait count on the CACHE BUFFERS CHAINS latch. This latch is acquired when searching for data blocks cached in the buffer cache. Since the Buffer cach
ORACLE EBS中启动Discoverer Plus出现空白页
用户登录EBS系统后点击“Launch Discoverer Plus”, 结果出现空白页,无任何其他提示。[@more@]经核实:-1. 其他用户启动Discoverer Plus时正常2. 该用户在其他PC上启动时也正常基本确定问题出在客户的PC上。参照 Metalink文档 332748.1,做如下操作:-1. 删除所有IE的cookie和临时文件2. 在IE publishers中删除所有oracle相关项 (IE options -> Content Tab -> Under Publishers)3. 启动控制面板 -> 添加/删除程序,删除所有JRE (Java Runtime Environment)重启PC,解决。
ORACLE EBS中的bne log
EBS界面提示的错误信息:- Fatal error: Please have your system administrator view the bne.log file. oracle.apps.bne.exception.BneFatalException: A system error has occurred. Have your system administrator view the bne.log file. Please contact your support representative.[@more@]View the detail of Bne.log ( Found in location defined by profile option 'BNE Server Log Path' )
Oracle EBS中打补丁
ORACLE EBS中打补丁是一个比较简单的过程,用“adpatch options=hotpatch”可以在线打,但还是有些需要注意的地方。 1. 如果你的系统出了支持英语外,还支持其他语言,比如中文,那你在下载补丁的时候除了下载Generic Platform版本外,还要确认有没有其他语言的版本,比如ZHS版本。如果有的话也要下载。 2. EBS的补丁不像数据库的补丁那样可以回滚,一旦失败就很麻烦。所以打补丁前一定要细看readme文件,确认补丁所需的前提条件都满足。 3. 要记录和对比打补丁前后APPS Schema下的无效对象。如果因为补丁引起新的无效对象,则视为补丁失败