Oracle分析表和索引(analyze)
analyze table tablename compute statistics;
analyze index indexname compute statistics;
对于使用CBO很有好处,可以使用更可靠的table信息,从而执行计划也可以更准确一些,在10g会自动analyze,之前的版本需要手动定期
生成统计信息,,选择合理的执行计划..
Oracle的online document这样描述analyze的作用:
Use the ANALYZE statement to collect non-optimizer statistics, for example, to:
1、Collect or delete statistics about an index or index partition, table or table partition, index-organized table, cluster, or scalar object attribute.
2、Validate the structure of an index or index partition, table or table partition, index-organized table, cluster, or object reference (REF).
3、Identify migrated and chained rows of a table or cluster.
对于收集统计信息这块,我一般使用dbms_stats这个package,收集统计信息的做用使CBO方式的优化选择执行计划更准确。
统计信息最好定期收集,以业务的不同确定不同的收集周期。
相关文档:
select sysdate 当前时间,
sys.login_user 数据库用户,
machine 登录机器名,
SYS_CONTEXT('USERENV', 'IP_ADDRESS') 登录IP,
&n ......
今天在百度上搜索了下oracle写的触发器,感觉还可以。
就收藏咯。
用户表:创建触发器之前首先要创建序列
用户表序列:
create sequence users_seq;
用户表触发器:
create or replace trigger bifer_users_userid_pk
before insert
on users
for each row
begin
select users_seq.nextval into:new.userid from ......
查询某列值为null的记录:
select *
from tablename
where col is null;
查询某列值不为null的记录:
select *
from tablename
where col is not null;
针对null的+-*/=!=等操作都是null:
null表示不确定的值,两个null表示两个不确定的值、未知的值,因此不存在两个null的相等,� ......
使用sdeupgradeora9i应用程序升级后,再按照一般的post方法post,在填写net service name时,使用oracle客户端的 net manager 配置一个另一台oracle数据库的service name;其余按照 一般方法进行,Post完成后,修改$sdehome/dbinit.sde
set ORACLE_SID = ORCL;为
set LOCLA=service name;
启动服务即可。 ......
Oracle数据库出现坏块现象是指:在Oracle数据库的一个或多个数据块(一个数据块的容量在创建数据库时由db_block_size参数指定,缺省为8K)内出现内容混乱的现象。由于正常的数据块都有固定的合法内容格式,坏块的出现,导致数据库进程无法正常解析数据块的内容,进而使数据库进程报错乃至挂起,并级联导致整个数据库实例� ......