随笔分类 -  Oracle

摘要:1创建一个测试表,test,并且插入10000行数据; SQL> create table test (id int); SQL> begin 2 for i in 1..10000 loop 3 insert into test values(i) 4 end loop; 5 end; ... 阅读全文
posted @ 2014-07-29 18:42 princessd8251 阅读(1106) 评论(0) 推荐(0)
摘要:With below three situation, we can use the pseudocolumncolumn_value to refer the column value.an XMLTABLEconstruct without the columnsclauseTABLE func... 阅读全文
posted @ 2014-07-28 18:40 princessd8251 阅读(866) 评论(0) 推荐(0)
摘要:我们在10046生产的trace 文件里经常看到下面的信息. 表示系统在等待散列读取某个文件号的某个块开始的8个块.WAIT #6: nam='db file scattered read' ela= 438472 file#=6 block#=2641 blocks=8WAIT #6: nam='... 阅读全文
posted @ 2014-07-26 00:45 princessd8251 阅读(2610) 评论(0) 推荐(0)
摘要:Format:column column_name new_value var_nameMeaning: use the column_name of a select statment to construct a variable, later we can use &var_name to r... 阅读全文
posted @ 2014-07-24 19:50 princessd8251 阅读(258) 评论(0) 推荐(0)
摘要:以前写过用external table来加载trace文件,详情参考下面链接.http://www.cnblogs.com/princessd8251/p/3779145.html今天要做到是用UTL_FILE包来读取一个directory下面的文件,比如我们的trace文件.先定义get_trac... 阅读全文
posted @ 2014-07-24 18:38 princessd8251 阅读(423) 评论(0) 推荐(0)
摘要:Question:I want to understand when to export and import by dbms_stats statistics and learn when it is a good idea to export and import statistics.Answ... 阅读全文
posted @ 2014-07-23 21:12 princessd8251 阅读(412) 评论(0) 推荐(0)
摘要:from http://www.itpub.net/thread-1852897-1-1.html有论坛朋友在上面的帖子里问SQL为什么不走索引,正好这两天我也刚刚在看SQL优化,于是试着回答了一下.下面是原来的SQL:select o.order_id as orderIdfrom order_i... 阅读全文
posted @ 2014-07-23 20:45 princessd8251 阅读(1612) 评论(0) 推荐(1)
摘要:数据库设置a.设置UNDO_RETENTION的初始值(在短时间内)代表你想要查过去多远的时间。b.设置初始化参数UNDO_MANAGEMENT=AUTO。c.建立一个还原点空间,要有足够的空间存储需要的数据。有多少数据更新,就需要多少空间。权限FLASHBACK_SCN和FLASHBACK_TIM... 阅读全文
posted @ 2014-07-21 19:01 princessd8251 阅读(889) 评论(0) 推荐(0)
摘要:来自讨论贴 http://www.itpub.net/thread-1877111-1-1.html准备数据表2014-07-20 01:38:10>create table tb_1 as select * from dba_objects where rownumcreate table tb_... 阅读全文
posted @ 2014-07-20 01:57 princessd8251 阅读(361) 评论(0) 推荐(0)
摘要:from http://www.itpub.net/thread-1876506-4-1.htmlSQL> defineDEFINE _DATE = "20-7月 -14" (CHAR)DEFINE _CONNECT_IDENTIFIER = "ORCL" (CHAR)DEFINE _USER = ... 阅读全文
posted @ 2014-07-20 00:56 princessd8251 阅读(692) 评论(0) 推荐(0)
摘要:在ITPUB 上看到一个帖子 http://www.itpub.net/thread-1875212-1-1.html同一条SQL语句,只有查询条件不一样,查询返回的结果集都为0,一个走了全表扫描,一个走索引。查看全表扫描的SQL语句:SQL走全表,产生了2422609个逻辑读,cost为535KS... 阅读全文
posted @ 2014-07-20 00:24 princessd8251 阅读(436) 评论(0) 推荐(0)
摘要:要想给一个Oracle实例配置多个监听,首先要定义多个监听器,因为是多个监听,势必会有一些监听端口不是1521.现在服务端的listener.ora文件中定义如下监听器:LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS =... 阅读全文
posted @ 2014-07-18 02:43 princessd8251 阅读(16956) 评论(0) 推荐(0)
摘要:From ASKTOM siteA process is a physical process or thread.On unix, you can see a process with "ps" for example. It is there.There are many types of pr... 阅读全文
posted @ 2014-07-16 01:53 princessd8251 阅读(168) 评论(0) 推荐(0)
摘要:在我们用dbms_job包进行定时Job的时候,需要设置时间间隔,所以需要知道时间的基本加减方法.SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';会话已更改。SQL> select sysdate, sysdate+1/2... 阅读全文
posted @ 2014-07-16 00:30 princessd8251 阅读(798) 评论(0) 推荐(0)
摘要:he following commands will helpful to delete the expired archive log files using Oracle Recovery Manager(RMAN).Connect to the Rman prompt and try the ... 阅读全文
posted @ 2014-06-25 15:04 princessd8251 阅读(740) 评论(0) 推荐(0)
摘要:1. 用下面的语句找到trace文件的路径select * from v$diag_info where name='Default Trace File';2. 创建一个directory用来加载trace文件create or replace directory tracefile as '/u... 阅读全文
posted @ 2014-06-10 00:57 princessd8251 阅读(434) 评论(0) 推荐(0)
摘要:1、查看数据库锁,诊断锁的来源及类型: select object_id,session_id,locked_mode from v$locked_object;或者用以下命令:select b.owner,b.object_name,l.session_id,l.locked_modefrom v... 阅读全文
posted @ 2014-04-19 00:49 princessd8251 阅读(264) 评论(0) 推荐(0)
摘要:fromhttp://www.akadia.com/services/ora_chained_rows.htmlOverviewIf you notice poor performance in your Oracle database Row Chaining and Migration may ... 阅读全文
posted @ 2014-03-31 21:22 princessd8251 阅读(342) 评论(0) 推荐(0)
摘要:ITpub 上有个帖子 http://www.itpub.net/thread-1852068-1-1.html生产数据库版本10.2.0.4测试数据库版本10.2.0.1sql在生产库运行就使用了谓词推进,效率很高,只要3s,但是在测试库没有使用谓词推进,需要6分30s。大家帮忙看看如何优化或者强... 阅读全文
posted @ 2014-03-26 00:40 princessd8251 阅读(661) 评论(0) 推荐(0)
摘要:SQL> drop table test;表已删除。SQL> create table test as select * from dba_objects where 1!=1;表已创建。SQL> create index idx_test_id on test(object_id);索引已创建。S... 阅读全文
posted @ 2014-03-20 03:18 princessd8251 阅读(1020) 评论(0) 推荐(0)