Mintrans and Maxtrans
Mintrans and MaxtransMintrans 和Maxtrans 是Segment 的物理属性。当transcation队列作用于 data block 上时,队列的大小由创建此table 时的Minitrans 参数决定。如果有多个Trans 需要访问此Block 并且此Block有足够的空间,这个队列的数量将会增长到maxtrans.如果已经到了maxtrans 的数量但仍然有trans 访问此block.那么大于maxtrans 的trans 只能等前面的trans 提交后才能进行trans 操作,否则只能等待。Example: Session 1: create table t_ (a number) initrans 1 maxtrans 2; insert into t_ values (1); insert into t_ values
Redo log Corrupt 恢复
周五晚 工厂ITS 打电话,得知Oracle DB 不能启动。发现是redo log Corrupt 将解决步骤发上来大家看看。案例: [XXX ENV] Redo log Corrupt 恢复软件版本:Hpunix 11.11Oracle 9.2.0.6现场人员:省略。。。。 发生问题原因:对DB 到处大量数据后,delete 一大table.在Delete 过程中Shutdown abort db,后Startup db 报如下错误:ORA-00354: corrupt redo log block headerORA-00353: log corruption near block 1 (当时没有记录下来)ORA-00312: online log 2 thread 1: '/oracledata/picstest/redo02.log'数据库无法打开。解决方法:0: 备份
Uninstall Oracle 9i
The simplest way to remove Oracle is to run the Oracle installer:Start > Programs > Oracle Installation Products > Universal InstallerOn the first screen click on "Deinstall Products..." Expand the tree view (just so that the second level is visible) and make sure you select everything that is selectable. Click on "Remove..." On the confirmation screen click "Yes" When it has finished click "Close" and then "Exit" to quit the installer W
限制End User Session数量
限制End User Session数量如何限制中断用户只有=<N个Session 连接到Oracle? 《以限制2 个Session 为例》1: 创建一个 Profile create profile limite_session limit sessions_per_user 2; 2: 将需要限制的用户profile 修改为 limite_session alter user lis profile limite_session; 3: 设置Database Resource_limite=true alter system set resource_limit=true; 结果是用户可以无限制的连接到 Database,但当达到限制时新增加的连接会使上一个有效连接中断。总量保持不变(如上面Example total=2) [@more@]
Optimizer index_caching and Index_Cost_adj tuning
OPTIMIZER_INDEX_CACHING 这个初始化参数代表一个百分比,取值范围在0到99之间.缺省值是0,代表当CBO使用索引访问数据时,在内存中发现数据的比率是0%,这意味着通过索引访问数据将需要产生物理读取,代价昂贵。如果使用缺省设置,Oracle评估成本的时候,很多时候就会错误的选择全表扫描。 OPTIMIZER_INDEX_COST_ADJ 这个初始化参数代表一个百分比,取值范围在1到10000之间.该参数表示索引扫描和全表扫描成本的表较。缺省值100表示索引扫描成本等于全表扫描。这些参数对于CBO的执行具有重大影响,其缺省值对于数据库来说通常需要调整。 一般
Oracle Common Function Library 参考文档
所有函数都是基于Oracle base function 之上进行二次开发。各函数都是我们在PL/SQL 开发和基于Oracle ERP 开发中经常用到的函数功能。主要目的是使我们开发过程中避免重复多次开发相同的函数功能。也希望能对我们开发人员提供一个通用的函数库。日期处理类字符串处理类 数字类 用户参数类用户对象属性类File 类XML 类以后会将整理的结果陆续放到我的Blog 上面供大家参考。[@more@]
oracle Distinct|Unique 异同
oracle Distinct|Unique这边我查了一些资料看了看,Distinct|Unique 返回select 出来的重复数据的一笔(distinct/unique 可认为互为同义词)重复行数数据必须和select 出来的每一个表达式匹配。限制: 1: 当你指定Distinct或者Unique 时,总共能显示在Select 后面表达式的Bytes 限制是 oracle的DB_block_size 减去 一些"头部"字节. (即Select list 中出来的Bytes 数不能大于 DB_block_Size) 2: Distinct 后面不能跟 Lob栏位。Examplecreate table uni_dis(colu1 varchar2(4000), colu2
Trim() 函数的介绍
Trim() 很多人对Trim()函数的用法仅仅限于去掉两边空格。下面让大家看看Trim()到底能帮我们作些什么/TRIM 可以去掉字符串中开头或结尾(或全部)的字符的某个字符。必须要将去掉的字符放在'' 之间。如果不写某些字符则会字符串两边的空格(space) 去掉。INSERT into demo values('weather',1,'lis',N'天气')insert into demo values('waiwai',1,'lis',N'外外')insert into demo values('waiwai11w',1,'lis',N'外外')select name,trim(leading 'w' from name) for_test from demo "NAME" "FOR_TEST" &
Oracle Date Function 讲解和事例
请大家记住 1 year=1*12 months1 day=24 hours=24*(1*60mins)=24*60*(1*60 seconds)1 week =7 days注意:黑色字体是 oracle 8i,9i都可以使用的函数,蓝色字体是 Oracle9i新增的部分。请大家在使用时,注意版本限制。add_monthscurrent_datecurrent_timestampdatimezoneextract(datetime)last_daymonths_betweennew_timenext_dayroundSYSDATEsystimestampTO_DATEtrunc()1: Add_Months 语法: Add_Months(d,n) 函数 -- n可正可负 作用: Add_Months(d,n) 返回日期 D 加上n 月的日期Example:A:下个月的今天 select add_months(sysdate,1)
保护你的 PL/SQL 代码!
How to protect PL/SQL Source Code ? PL/SQL V-2.2, available with Oracle 7.2, implements a binary wrapper for PL/SQL to protect the source code. This is done via a standalone utility that transforms the PL/SQL source code into portable binary object code (somewhat larger than the original). This way you can distribute software without having worry about exposing your proprietary algorithms and methods. SQLPLUS and SVRMGRL will still understand and know to execute such scripts. Just be careful, th
Oracle可变参数的优化
Oracle可变参数的优化在对Oracle数据库进行优化时,需要用到许多的参数,其中有一部分参数对系统性能影响较大,这部分参数叫可变参数。可变参数按其作用可以分为两大类: 一大类是起限制作用的,如OPEN_CURSORS; 另一大类是影响系统性能的,如DB_BLOCK_BUFFERS。在进行数据库系统性能优化时,需要熟练掌握和了解一些可变参数。本文讨论了一些对系统性能有较大影响的参数。限制类可变参数(1)DML_LOCKS该参数表明多少个用户,可同时能修改多少张表。例如:有三个用户同时修改二张表,则要求表上的总数为6。若置为0,则组织队列不起作用,其性
ora -03232 问题解决
今天在执行一个大SQL 时,系统报 ORA-03232: unable to allocate an extent of blocks from tablespace 3 错误select * from v$tablespace where ts#=3结果是temp tablespace 不能扩展。检查alterlog 没有任何错误信息--- 这点没有想通 :(一般解决方法有两种:1: 增加Temp 表空间 ---此法不行我的 temp 表空间 2G 现在只使用 280M,显然不是Temp tablespace 小的缘故2: 修改 hash_multiblock_io_count=1(oracle default =1)经检查我的 hash_multiblock_io_count =8 . HASH_MULTIBLOCK_IO_COUNT = integerspecifies the number of data b
oracle Database Event trace 设置
通常设置那些 oracle Database Event? 下面的Event 经常被DBA 和Oracle support 用来诊断问题: • 10046 trace name context forever, level 4 追踪 SQL statements 和 显示trace 输出的绑定变量值 • 10046 trace name context forever, level 8 显示在SQL trace files 中的等待事件 • 10046 trace name context forever, level 12 显示在SQL trace files中的绑定变量名和等待事件 • 1401 trace name errorstack, level 12
设置 oracle event trace
通过下面SQL 可以列出所有 Oracle EventsSELECT * FROM V$EVENT_NAME;Oracle跟踪事件对调试Oracle Database 服务器非常有用。下面是两个比较简单的事例语法。参考后面的注释具体的讲述如何操作。有三种种方法可以将事件激活。第一种是在 init.ora 参数文件中增加下面语句 event='1401 trace name errorstack, level 12' 如果修改 init.ora 文件将在oracle database 启动后影响到所有Session. 第三种是使用 “ alter session set event “ 命令 Alter session set events ‘10046 trace name context fo
Oracle 中所有隐含的 参数
Oracle初始化或 init.ora文件 第一位是 “_” 的参数是隐藏或是不支持的参数。 得到所有隐藏的参数我们使用下面一个SQL 查询语句: select * from SYS.X$KSPPI where substr(KSPPINM,1,1) = '_'; 下面SQL 语句结果显示是哪些当前值的隐藏变量: select a.ksppinm "Parameter", b.ksppstvl "Session Value", c.ksppstvl "Instance Value" from x$ksppi a, x$ksppcv b, x$ksppsv c where a.indx = b.indx and a.indx = c.indx and substr(ksppinm,1,1)='_' order by a.ksppinm; [@more@]
float datatype in Oracle database
作了一个测试,就像我们以前一直提醒的一样。在使用非 number datatype 的 数字类型一定要注意。create table t_float (f float(2),n number(2))SQL> insert into t_float values (7,7);1 row created.SQL> insert into t_float values (11,11);1 row created.SQL> insert into t_float values (99,99)1 row created.SQL> select * from t_float;F N---------- ----------7 710 11100 99Why:a FLOAT column with a binary precision of 2 bits, is implemented as a NUMBER column with 1 decimal digit of precision and no
MM-DD-RRRR / MM-DD-YYYY 的区别 (Date format)
先各位执行一下下面SQL. 结果会如何呢?select to_date('05/01/02','YYYY-MM-DD') YYYY ,to_date ('05/01/02','RRRR-MM-DD') RRRR from dual结果如下:------------------------------------------------- YYYY RRRR0005-01-02 00:00:00 2005-01-02 00:00:00-------------------------------------------------什么原因 ?RRYes Lets you store 20th century dates in the 21st century using only two digits. See Also: Additional discussion on RR datetime format element in the Oracle Database SQ
Database Link 创建注意的两点
Database Link 创建注意的两点: 一般创建(Database Link Name 和 Service Name 一致) A: 先在 Server 端的tnsname.ora 中增加要访问的 database的连接字符串格式如下: BPCS = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = Ip Address)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = bpcs) ) ) B: 再用SQL /或OEM 创建 为某用户的DBlink CREATE DATABASE LINK "bpcs" CONNECT TO "BQY" IDENTIFIED BY "********" USING 'bpcs' 特殊创建(Database Link Name 和Serv
DBA 常用的10个SQL
1: SGAselect (case when pool is null then 'Buffer cache'else pool end) "SGA area",round(sum(sga.megs),1) megsfrom (select pool,name,sum(bytes)/(1000*1024) megsfrom V$SGASTAT group by pool,name) sgawhere pool is not nullgroup by poolunion select name "SGA area",round(sum(bytes)/(1000*1024),1) megsfrom V$SGASTAT where pool is nullgroup by name B: Shared poolSELECT name,bytes / (1024 * 1024) megsFROM v$sgastatWHERE pool = 'shared pool'AND name IN ('sql area','dictionary cache','
Oracle backgroud Process
System MonitorProcess Name: SMONMax Processes: 1This process is responsible for instance recovery, if necessary, at instance startup. SMON also cleans up temporary segments that are no longer in use. It also coalesces contiguous free extents in dictionary managed tablespaces that have PCTINCREASE set to a non-zero value. SMON wakes up about every 5 minutes to perform housekeeping activities. SMON must always be running for an instance.Process MonitorProcess Name: PMONMax Processes: 1This process