[转]对ORA-01555的精彩解释
刚才浏览博友博文,看到一段对ORA-01555的解析,很深刻.[@more@]假设有张表,叫table1,里面有5000万行数据,假设预计全表扫描1次需要1个小时,我们从过程来看: 1、在1点钟,有个用户A发出了select * from table1;此时不管将来table1怎么变化,正确的结果应该是用户A会看到在1点钟这个时刻的内容。这个是没有疑问的。 2、在1点30分,有个用户B执行了update命令,更新了table1表中的第4000万行的这条记录,这时,用户A的全表扫描还没有到达第4000万条。毫无疑问,这个时候,第4000万行的这条记录是被写到了回滚段里去了的,我假设是回滚段
分区表的使用总结(转)
在ORACLE里如果遇到特别大的表,可以使用分区的表来改变其应用程序的性能。同事的分区表总结,转载一下。[@more@]1.1 分区表PARTITION table在ORACLE里如果遇到特别大的表,可以使用分区的表来改变其应用程序的性能。1.1.1 分区表的建立: 某公司的每年产生巨大的销售记录,DBA向公司建议每季度的数据放在一个分区内,以下示范的是该公司1999年的数据(假设每月产生30M的数据),操作如下: 范围分区表:CREATE TABLE sales (invoice_no NUMBER, ... sale_date DATE NOT NULL ) PARTITION BY RANGE (sale_date) (PARTITION sales1999_q1 VAL
sys可以登陆,其它用户登陆就hang住的处理
刚才在itpub里闲逛,看到这个帖子.又学习了.赶紧纪录下来.ref: http://www.itpub.net/viewthread.php?tid=1102426&extra=&page=1[@more@]猪面人心同学在群里说sys用户登陆的时候,可以正常登陆,其它用户登陆的时候就hang,这样的情况经常是由于归档过不出而出现这种状况,由于不清楚具体的情况,于是叫朋友给出v$session_wait的结果,输出的等待事件如下:SQL*Net message from clientjobq slave waitStreams AQ: qmn slave idle waitresmgr:become activeSQL*Net message from clientresmgr:become activeStreams AQ: waiting
[转]安装statspack
ref : http://www.eygle.com/archives/2004/06/statspack03.html[@more@]使用sys用户以sysdba身份连接: D:oracleora92rdbmsadmin>sqlplus "/ as sysdba" SQL*Plus: Release 9.2.0.3.0 - Production on 星期四 7月 10 19:18:54 2003 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. 连接到: Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining options JServer Release 9.2.0.3.0 - Production SQL> 检查数
索引组织表IOT
索引组织表(index organized table, IOT)就是存储在一个索引结构中的表。存储在堆中的表是无组织的(也就是说,只要有可用的空间,数据可以放在任何地方),IOT中的数据则按主键存储和排序。对你的应用来说,IOT表和一个“常规”表并无二致。IOT有什么意义呢?使用堆组织表时,我们必须为表和表主键上的索引分别留出空间。而IOT不存在主键的空间开销,因为索引就是数据,数据就是索引,二者已经合二为一。[@more@]但是,IOT带来的好处并不止于节约了磁盘空间的占用,更重要的是大幅度降低了I/O,减少了访问缓冲区缓存(尽管从缓冲区缓存获取数
检查tablespace使用情况的sql.
检查tablespace使用情况的sql.[@more@]column "Tablespace" format a13column "Used MB" format 99,999,999column "Free MB" format 99,999,999column "Total MB" format 99,999,999select fs.tablespace_name "Tablespace", (df.totalspace - fs.freespace) "Used MB", fs.freespace "Free MB", df.totalspace "Total MB", round(100 * (fs.freespace / df.totalspace)) "Pct. Free"from (select
Oracle删除约束
删除一个表某条记录时,出现如下错误:ORA-02292: integrity constraint (CICRO.FK3_EL_NODES) violated - child record found于是查看了相关的主键和约束关系,发现了一些问题。[@more@]关于这个错误,oracle官方解决方法是:Error: orA-02292: integrity constraint <constraint name> violated - child record foundCause: You tried to Delete a record from a parent table (as referenced by a foreign key), but a record in the child table exists. Action: The options to resolve this oracle error are: This error com
ORACLE用户管理和起停数据库
一、连接你的oracle数据库 SQL> sqlplus /nolog SQL> connect /as sysdba[@more@]二、修改oracle账户信息 1、修改账户的口令,使用下面的语句: SQL> ALTER USER username IDENTIFIED BY password 2、修改已锁定的账户口令,使用下面的语句: SQL> ALTER USER username IDENTIFIED BY password ACCOUNT UNLOCK 3、如果要锁定账户,使用下面的语句: SQL> ALTER USER username ACCOUNT LOCK 4、如果要解锁账户,使用下面的语
让表释放空间3种情况
1 drop table.........2 truncate table .....drop storage....把表的数据删除只剩一个表头3alter table ..... deallocate unused 改变表的高水位[@more@]
一些与packege、object有关的表
user_types 创建的对象类型user_type_attrs 对象属性user_type_methods 对象方法user_method_params 类型方法使用的参数user_method_results 类型方法返回的数据类型user_source 源代码表 user_tables 对象表.比如:对象保存的表空间等user_tab_columns 类型的列user_dependencies 类型依靠的表,及各关系[@more@]
查杀oracle lock session and table
查杀oracle 死锁的一些帖子摘录[@more@]查找死锁进程column sid format 999;column b format 9;column object_name format a30;select v$lock.sid,decode(v$lock.type, 'MR', 'Media Recovery', 'RT','Redo Thread', 'UN','User Name', 'TX', 'Transaction', 'TM', 'DML', 'UL', 'PL/SQL User Lock', 'DX', 'Distributed Xaction', 'CF', 'Control File', 'IS', 'Instance State', 'FS', 'File Set', 'IR', 'Instance Recovery', 'ST', 'Disk Space
ORACLE index提示
index提示被用子显式地指定表名,在这种情况下,优化器将使用表中最佳的索引;或者显式地指定表名和索引名,在这种情况下,优化器将使用指定的索引。 调用index提示时要遵循以下原则:[@more@]1 如果表名或索引名拼写错误那么查询将不使用提示,下面是一个表名拼写错误的查询:select /*+ index(erp,dept_idx) */ * from emp;2 表名在提示中必须指定。例如,下面的提示将会由子在查询中没有指定表名而被忽略:select /*+ index(dept_idx) */ * from emp;3 如果在查询中指定了表别名,那么必须使用表别名。例如,下面的查询将忽略index提示,因
创建用户
1创建用户create user userName identified by password;创建用户 userName,密码为 password[@more@]2给用户授权grant dba to userName; --授予DBA权限grant unlimited tablespace to userName;--授予不限制的表空间grant select any table to userName; --授予查询任何表grant select any dictionary to userName;--授予 查询 任何字典 3 撤权: revoke 权限... from 用户名; 4数据库安装完成后,有两个系统级的用户 : 1) system 默认密码为 :manager 2) sys 默认密码为 :change_on_install 例子:crea
Journey into Partitioning Methods
Partitioning, the best thing that happened to Oracle since sliced bread — perhaps that trite analogy has a grain of truth in this case. Sliced bread gave mankind the ability to tackle the monolithic loaf by breaking it into bite-sized pieces, not unlike what partitioning does for our Oracle tables. The slices hold patties, tomatoes, cheese, and all the relishes you may want to fit in — analogous to data in the table. However, a sandwich made from the slices is still a logical entity — just li
ora_rowscn伪列介绍和使用
下面一段英文是官方SQL Reference里的说明:For each row,ORA_ROWSCNreturns the conservative upper bound system change number (SCN) of the most recent change to the row. This pseudocolumn is useful for determining approximately when a row was last updated. It is not absolutely precise, because Oracle tracks SCNs by transaction committed for the block in which the row resides. You can obtain a more fine-grained approximation of the SCN by creating your tables with row-level dependency tracking.Please
Oracle: 表连接提示
1 use_hash 关键点是:驱动表是小表 select /*+ use_hash(e,b) parallel(e,4) parallel(b,4) */ e.name from emp e, bonus b where e.name = b.ename[@more@]2 use_merge 提示强制执行一个排序合并操作 select /*+ use_merge(e,b) parallel(e,4) parallel(b,4) */ e.name from emp e, bonus b where e.name = b.ename3 use_nl 提示强制对目标表执行嵌套循环连接 select /*+ use_nl(e) */ e.name from emp e, bonus b where e.name = b.ename4 star 提示强制使用星形查询计划;前提是查询中至少有三个表,而且在事实表中存在恰当的
Install orcale in linux
最近配置了一个Linux server,将一些步骤写下来:Install oracle in linuxVersion:Linux:Linux gzdev02 2.6.18-274.el5 #1 SMP Fri Jul 8 17:36:59 EDT 2011 x86_64 x86_64 x86_64 GNU/LinuxOracle:oracle 11g[@more@]1.binutils-2.17.50.0.6 compat-libstdc++-33-3.2.3 elfutils-libelf-0.125 elfutils-libelf-devel-0.125 elfutils-libelf-devel-static-0.125 gcc-4.1.2 gcc-c++-4.1.2 glibc-2.5-24 glibc-common-2.5 glibc-devel-2.5 glibc-headers-2.5 kernel-headers-2.6.18 ksh-20060214 libaio-0.3.106 libaio-devel
设置并行查询
alter table xxx parallel 35;将小表放进高速缓冲区alter table xxx cache;[@more@]
检查DB中table 和 index被检索的各种方式的次数
column value format 999,999,999Table:select name,value from v$sysstatwhere name like 'table%';[@more@]Indexselect name,value from v$sysstatwhere name like 'index%'
oracle 随机函数
DBMS.RONDOM_VALUE(MIX,MAX)egSELECT TRUNC ( DBMS.RONDOM_VALUE(20,100) ) FROM DUAL;20 - 100 的随机整数.[@more@]