weiranjie
===========================================================
oracle 模糊导出
===========================================================

带条件的导出

exp crbt/crbt@crbtfdb tables=corp_account query="where record_time>to_date('2001122','yyyymmdd')" file=/export/home/oracle/shell/jf.dmp log=/export/home/oracle/shell/jf.log
导出部分表
exp rlslog/rlslog tables=G_QST_2009062% file=g_qst2009062.dmp


weiranjie 发表于:2009.07.01 13:43 ::分类: ( oracle 技术 ) ::阅读:(15次) :: 评论 (0)
===========================================================
managed oracle statistics
===========================================================

收集表的统计信息

收集索引的统计信息

删除表的统计信息

删除索引的统计信息

导出导入统计信息

不同的数据库间统计信息的复制

dbms_stats 和 analyze 的优点和缺点

对柱状图的理解和常用的统计信息,柱状图的视图

 查看全文

weiranjie 发表于:2009.06.18 10:43 ::分类: ( oracle 技术 ) ::阅读:(36次) :: 评论 (0)
===========================================================
dbms_aq 堵塞处理
===========================================================

dbms_aq 堵塞处理 步骤:

今天数据迁移的时候,需要做赋权操作

grant execute on dbms_aq to aaaaa;

到这个地方就死到这里啦

处理步骤如下:

 查看全文

weiranjie 发表于:2009.06.18 10:26 ::分类: ( oracle 技术 ) ::阅读:(40次) :: 评论 (0)
===========================================================
db file scattered read,direct path read 等待事件的原因以及解决方法
===========================================================

db file sequential read (single block read into one SGA buffer)

db file scattered read (multiblock read into many discontinuous SGA buffers)

direct read (single or multiblock read into the PGA, bypassing the SGA)

direct path read and direct path read temp
direct path write and direct path write temp

 查看全文
weiranjie 发表于:2009.06.10 14:07 ::分类: ( oracle 技术 ) ::阅读:(63次) :: 评论 (0)
===========================================================
buffer busy waits
===========================================================

buffer busy waits -----

解决思路 :

查找等待的对象类型:

查找等待事件对应的SQL ,优化

 查看全文

weiranjie 发表于:2009.06.10 10:10 ::分类: ( oracle 技术 ) ::阅读:(25次) :: 评论 (0)
===========================================================
linux oracle 10客户端连接oracle 9 数据库 慢
===========================================================

1. 检查网络是否正常 (网络正常)

2.设置 sqlnet.ora

但是还是不能解决问题 :

最后查明是linux 下的设置了dns

去掉 /etc/resolv.conf 下的内容

连接正常

 查看全文
weiranjie 发表于:2009.06.04 12:45 ::分类: ( oracle 技术 ) ::阅读:(37次) :: 评论 (0)
===========================================================
临时表空间消除的方法
===========================================================

以下摘自 XZH2000

消除temp ts暴涨的方法

 查看全文
weiranjie 发表于:2009.03.09 10:03 ::分类: ( oracle 技术 ) ::阅读:(100次) :: 评论 (0)
===========================================================
top sql 产生的原因
===========================================================
top sql 产生的原因 查看全文
weiranjie 发表于:2009.03.09 10:00 ::分类: ( oracle 技术 ) ::阅读:(117次) :: 评论 (0)
===========================================================
索引是如何定期rebuild的
===========================================================

摘自 xzh2000 博客文章

1. 发现哪个index碎片较多,需要对索引进行rebuild的语句
2. 对索引进行rebuild的语句,特别对于那些24X7的应用,大家都是如何对大表的索引进行rebuild.

 查看全文

weiranjie 发表于:2009.03.09 09:57 ::分类: ( oracle 技术 ) ::阅读:(108次) :: 评论 (0)
===========================================================
处理数据库慢的一般方法
===========================================================

以下在XZH2000 博客摘取

如果不用分析工具如statspack等,如何快速找出原因?
lcm_0090828给出自己常用的checklist:
1. 检查表空间资源
2. 归档是否正常(归档空间满时,会等待归档,之后用户进程就死掉了)
3. 检查alert 信息
4. 用vmstat, top命令看看系统i/o, cpu的繁忙程度,以及哪个进程在消耗资源,结合v$process, v$session, v$sqlarea 等视图查找出终端机器,以及其使用的sql 语句等。
5. 有没有死锁
6. 有时用户进程运行的程序会报错,就根据错误提示寻找根源及解决办法,可能是初始化参数设置不合理。


weiranjie 发表于:2009.03.09 09:49 ::分类: ( oracle 技术 ) ::阅读:(103次) :: 评论 (0)
===========================================================
solairs corntab
===========================================================
solairs corntab 说明 查看全文
weiranjie 发表于:2008.11.17 16:07 ::分类: ( aix/solaris 技术 ) ::阅读:(164次) :: 评论 (0)
===========================================================
提高 insert 的方法
===========================================================

insert into xxx select a,b,c from xxxx

把要插入的表的索引干掉

对于多CPU

提高的方法有如下方法

append

nologging cpu-1 或者cpu 的个数

parallel

db_file_multiblock_read_count

 查看全文

weiranjie 发表于:2008.10.23 10:17 ::分类: ( oracle 技术 ) ::阅读:(142次) :: 评论 (0)
===========================================================
在线定义表
===========================================================

天高的方法

dbms_redefinition

慢慢消化

 查看全文
weiranjie 发表于:2008.10.23 09:38 ::分类: ( oracle 技术 ) ::阅读:(142次) :: 评论 (0)
===========================================================
ORA-38029
===========================================================
ORA-38029: 对象统计信息已锁定

随即查了一下——

-bash-3.00$ oerr ora 38029
38029, 00000, "object statistics are locked"
// *Cause: An attept was made to modify optimizer statistics of the object.
// *Action: Unlock statistics with the DBMS_STATS.UNLOCK_TABLE_STATS procedure
// on base table(s). Retry the operation if it is okay to update statistics.

于是就找UNLOCK_TABLE_STATS 的用法,在DBMS_STATS包中查找,也发现有UNLOCK_SCHEMA_STATS procedure,于是就干脆执行——

SQL> begin
2 DBMS_STATS.UNLOCK_schema_STATS(user);
3 end;
4 /

PL/SQL 过程已成功完成。

exec dbms_stats.unlock_table_stats('CSHOW','cmpp_send_mass');

analyze table cmpp_send_mass compute statistics for table for all indexes for all indexed columns;


weiranjie 发表于:2008.10.20 12:39 ::分类: ( oracle 技术 ) ::阅读:(331次) :: 评论 (0)
===========================================================
sql 中单引号的表示
===========================================================

select 'execute DBMS_APPLY_ADM.DELETE_ERROR('||'local_transaction_id => ' || chr(39)||local_transaction_id ||chr(39) ||')'||';' from dba_apply_error

chr(39) -----'


weiranjie 发表于:2008.09.27 10:47 ::分类: ( oracle 技术 ) ::阅读:(158次) :: 评论 (0)
===========================================================
一个耐人深思的典型故事
===========================================================

第一,永远不要走捷径。便捷而陌生的道路可能要了你的命。

第二,永远不要对可能是坏事的事情好奇,否则也会要了你的命。


第三,永远不要在仇恨和痛苦的时候作决定,否则你以后一生会后悔的。

 查看全文
weiranjie 发表于:2008.09.26 13:02 ::分类: ( 心情驿站 ) ::阅读:(107次) :: 评论 (0)
===========================================================
让孩子聪明的8个秘诀
===========================================================
http://tolywang.itpub.net/post/48/465630 查看全文
weiranjie 发表于:2008.09.11 09:33 ::分类: ( 心情驿站 ) ::阅读:(153次) :: 评论 (0)
===========================================================
bulk collect 的使用
===========================================================
通常在SQL语句中给PL/SQL变量赋值叫做绑定(Binding),一次绑定一个完整的集合称为批量绑定(Bulk Binding)。

批量绑定(Bulk binds)可以通过减少在PL/SQL和SQL引擎之间的上下文切换(context switches )提高了性能.

批量绑定(Bulk binds)包括:
(i) Input collections, use the FORALL statement,一般用来改善DML(INSERT、UPDATE和DELETE) 操作的性能
(ii) Output collections, use BULK COLLECT clause,一般用来提高查询(SELECT)的性能

FORALL的语法如下:

FORALL index IN lower_bound..upper_bound sql_statement;

具体的例子

 查看全文
weiranjie 发表于:2008.09.09 15:33 ::分类: ( oracle 技术 ) ::阅读:(182次) :: 评论 (0)
===========================================================
ddl 数据库trigger 监控
===========================================================

1. 创建表

2. 创建trigger

 查看全文
weiranjie 发表于:2008.09.09 09:23 ::分类: ( oracle 技术 ) ::阅读:(196次) :: 评论 (0)
===========================================================
监控登陆数据库的trigger
===========================================================

监控登陆数据库的trigger

1. 赋予权限

SQL> grant select on v_$session to wrj;

Grant succeeded.

SQL>
SQL> grant select on v_$mystat to wrj;

Grant succeeded.

2. 创建表

create table log_information (login_user varchar2(10),login_time date,ip_adress varchar2(20),ausid number,terminal varchar2(30),
osuser varchar2(30),machine varchar2(64),program varchar2(48),sid number,serial# number);

3 . 创建触发器

CREATE OR REPLACE TRIGGER tr_login_record
AFTER logon ON DATABASE
DECLARE
miUserSid NUMBER;
mtSession v$session%rowtype;
CURSOR cSession(iiUserSid IN NUMBER) IS
SELECT * FROM v$session WHERE sid = iiUserSid;
BEGIN
SELECT sid INTO miUserSid FROM v$mystat WHERE rownum <= 1;
OPEN cSession(miUserSid);
FETCH cSession
INTO mtSession;
--if user exists then insert data
IF cSession%FOUND THEN
INSERT INTO log_information
(login_user,
login_time,
ip_adress,
ausid,
terminal,
osuser,
machine,
program,
sid,
serial#)
VALUES
(ora_login_user,
SYSDATE,
SYS_CONTEXT('USERENV', 'IP_ADDRESS'),
userenv('SESSIONID'),
mtSession.Terminal,
mtSession.Osuser,
mtSession.Machine,
mtSession.Program,
mtSession.Sid,
mtSession.Serial#);
ELSE
--if user don't exists then return error
--sp_write_log('Session Information Error:'||SQLERRM);
null;
CLOSE cSession;
raise_application_error(-20099, 'Login Exception', FALSE);
END IF;
CLOSE cSession;
EXCEPTION
WHEN OTHERS THEN
--sp_write_log('Login Trigger Error:'||SQLERRM);
null;
END tr_login_record;

/


weiranjie 发表于:2008.09.08 14:33 ::分类: ( oracle 技术 ) ::阅读:(152次) :: 评论 (0)
===========================================================
如何配置合适的 pga
===========================================================

如何配置合适的 pga

如何诊断PGA设定是否合适

怎么去设置一个合理pga的大小呢?

 查看全文

weiranjie 发表于:2008.09.05 15:54 ::分类: ( oracle 技术 ) ::阅读:(299次) :: 评论 (0)
===========================================================
跨平台 跨版本 大规模数据迁移
===========================================================

昨天在 pub 上看到一个问题,

oracle 9i 如果600G 的资料库需要进行最短时间的跨平台(windows 到unix) 停机(12 小时)迁移,该如何进行数据迁移 ?

请教了 biti

作了一下测试

 查看全文
weiranjie 发表于:2008.09.05 14:21 ::分类: ( oracle 技术 ) ::阅读:(270次) :: 评论 (0)
===========================================================
上亿的数据量,创建索引如何提高速度
===========================================================
原帖由 rollingpig 于 2008-8-6 08:49 发表 查看全文
weiranjie 发表于:2008.09.01 09:23 ::分类: ( oracle 技术 ) ::阅读:(196次) :: 评论 (0)
===========================================================
表被 drop 掉,如何快速的是谁干的 ?
===========================================================

建议你用tigger来监控数据库的drop,truncate的操作

============

以下是 eygle 的建议

亡羊补牢,总是有点迟了。

用Logminer能够获得一些更进一步信息,根据Log中的删除时间,结合listener.log日志登陆时间,基本可以确定是who从where登陆的数据库,能查到人的。

这个不复杂。

 查看全文
weiranjie 发表于:2008.08.28 16:57 ::分类: ( oracle 技术 ) ::阅读:(143次) :: 评论 (0)
===========================================================
imp导入数据,能不能让导进来的表名跟原来导出的表名不同,也就是换个新的表名呢
===========================================================

今天从网上看了一个问题

imp导入数据,能不能让导进来的表名跟原来导出的表名不同,也就是换个新的表名呢?

imp system/system file=mydmp.dmp fromuser=myuser1 touser=myuser2 tables=(mytable1)

这样能把dmp导出文件里面myuser1.mytable1导入到myuser2,但表名还是mytable1,能不能让导进来之后变为其他表名,比如mytable2?

请各位高手指点,谢谢!
 查看全文
weiranjie 发表于:2008.08.28 16:22 ::分类: ( oracle 技术 ) ::阅读:(199次) :: 评论 (0)
===========================================================
如何得到一个用户的权限 语句
===========================================================
如下 查看全文
weiranjie 发表于:2008.05.08 12:57 ::分类: ( oracle 技术 ) ::阅读:(209次) :: 评论 (0)
===========================================================
如何加密过程
===========================================================

步骤如下

要加密的过程如下:

more drop_cdr_name_1.sql
create or replace procedure drop_cdr_name_1 (p_date in varchar2) is
v_date date;
v_sqlstr varchar2(2048);
begin
v_date := to_date(p_date,'YYYYMMDD') - 60 ;
v_sqlstr := 'drop table CDR_' || to_char(v_date,'YYYYMMDD');
execute immediate v_sqlstr;
end ;
/

$ wrap iname=drop_cdr_name_1.sql

PL/SQL Wrapper: Release 9.2.0.1.0- 64bit Production on Fri Apr 18 08:52:50 2008

Copyright (c) Oracle Corporation 1993, 2001. All Rights Reserved.

Processing drop_cdr_name_1.sql to drop_cdr_name_1.plb
$
$
$ pwd
/export/home/oracle/shell
$ ls
add_tablespace.sh host_opt_log_his_exp.sh host_opt_log_his_imp2006.sh nohup.out
drop_cdr_name_1.plb host_opt_log_his_exp2006.sh host_opt_log_his_imp2007.sh wrj_z.sh
drop_cdr_name_1.sql host_opt_log_his_exp2007.sh idx_host.sh
$ pwd
/export/home/oracle/shell

drop_cdr_name_1.sql host_opt_log_his_exp2007.sh idx_host.sh
$ sqlplus crbt/crbt

SQL*Plus: Release 9.2.0.1.0 - Production on Fri Apr 18 08:54:14 2008

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production

SQL> @/export/home/oracle/shell/drop_cdr_name_1.plb;

Procedure created.

 查看全文
weiranjie 发表于:2008.04.18 09:28 ::分类: ( oracle 技术 ) ::阅读:(841次) :: 评论 (0)
===========================================================
oracle权限问题
===========================================================

oracle权限问题

 查看全文
weiranjie 发表于:2008.03.21 10:22 ::分类: ( oracle 技术 ) ::阅读:(180次) :: 评论 (0)
===========================================================
需要排序的操作
===========================================================
Ø创建索引
Ø包含了索引维护的并行插入操作
ØORDER BY 或者 GROUP BY 子句
Ø查询中的DISTINCT
ØUNION, INTERSECT, 或者 MINUS 操作
Ø多表联合查询
Ø
v$sort_usage --监控
ANALYZE 命令
 查看全文
weiranjie 发表于:2008.02.27 15:23 ::分类: ( oracle 技术 ) ::阅读:(246次) :: 评论 (0)
===========================================================
3000万数据成功迁移
===========================================================

方法一: exp

方法二 : create table aa as

方法三 : spool ,sqlldr

 查看全文
weiranjie 发表于:2008.02.22 16:39 ::分类: ( oracle 技术 ) ::阅读:(251次) :: 评论 (0)
切换风格
新闻聚合
博客日历
文章归档...
最新发表...
博客统计...
网站链接...