本站用于记录日常工作内容,虚拟化云计算,系统运维,数据库DBA,网络与安全。
oracle将system表空间的数据文件变小    问题描述:今天闲的蛋疼,在自己破电脑上面跑了一下这个过程:create or replace procedure pro_test_pga isbegin  insert into t_test2  select t.*  from t_test t,(select rownum from dual connect by rownum <= 10 )  order by t.object_name;  commit;end pro_test_pga;当时t_test有2883968行数据,这个过程跑下来各种direct path read temp因为我的pga_aggregate_target只有可怜的194M,其实开始跑这个过程的目的是验证把pga_aggregate_target调小会不会让速度更慢,因为这个数字是我建库的时候用的默认值,结果跑了5455.62秒,心都碎了,我的机器上的数据库是开了归档的,反正硬盘只这么多,他一边产生我一边删,不然空间一没,就停在那了,本来还想来个把pga_aggregate_target设置为10M试试的,但后来想想还是算了,至少这周算了,以后有时间试试,挂一晚...
Guide: Installing Oracle Enterprise Manager 10g Grid Control Rel 5 on Oracle Database 11g and Linux by Mike Revitt Install Oracle Enterprise Manager 10g Grid Control Rel 5 against an existing Oracle 11g database on Oracle Enterprise Linux version 5, step by step. Published July 2009 Contents Introduction Prerequisites Reference Information Creating the Oracle Enterprise Template Prepare the DVD ...
UDEV SCSI Rules Configuration for ASM in Oracle Linux 5 and 6For Oracle Automatic Storage Manager (ASM) to use disks, it needs to be able to identify the devices consistently and for them to have the correct ownership and permissions. In Linux you can use ASMLib to manage these tasks, but it is seen as an additional layer of complexity and has never really gained any popularity. Instead, many people use the Linux device manager "udev" to perform these tasks. This article presents a brief overview of setting up udev rules with respect to disks for use with ASM in Oracle 11g. The examples are all done using Oracle Linux 5 and 6, so they will be consistent with RHEL and CentOS 5 and 6.BackgroundIdentify the Disks (/sbin/scsi_id)Make SCSI Devices TrustedCreate UDEV Rules FileLoad Updated Block Device Partitions (/sbin/partprobe)Test Rules (udevtest)Restart UDEV ServiceCheck Ownership and PermissionsBackgroundEssentially, what udev does is apply rules defined in files in the &quo...
oracle中的exists 和not exists 用法详解有两个简单例子,以说明 “exists”和“in”的效率问题1) select * from T1 where exists(select 1 from T2 whereT1.a=T2.a) ; select e.first_name,e.job_id,e.salary from employees e where exists ( select d.department_id from departments d where e.department_id=d.department_id and d.department_name='IT'); 使用exists 查看所在部门为IT的 员工信息。  T1数据量小而T2数据量非常大时,T1<<T2 时,1)的查询效率高。2) select * from T1 where T1.a in (select T2.a from T2) ;    T1数据量非常大而T2数据量小时,T1>>T2 时,2)的查询效率高。exists 用法:请注意 1)句中的有颜色字体的部分 ,理解其含义;其中 “select 1 from T2 where T1.a=T2.a” 相当于一个关联表查询,相当于“select 1 fromT1,T2    where T1.a=T2.a”但是,如果你当当执行 1) 句括号里的语句,是会报语法错误的,这也是使用exists需要注意的地方。“exists(xxx)”就表示括号里的语句能不能查出记录,它要查的记录是否存在。因此“select 1”这里的“...
 
0

Oracle表碎片整理

发表者:admin分类:数据库2015-08-24 17:26:50 阅读[2073]
 Oracle表碎片整理  数据库在日常使用过程中,不断的insert,delete,update操作,导致表和索引出现碎片是在所难免的事情,碎片多了,sql的执行效率自然就差了,道理很简单,高水位线(HWL)下的许多数据块都是无数据的,但全表扫描的时候要扫描到高水位线的数据块,也就是说oracle要做许多的无用功!因此oracle提供了shrink space碎片整理功能。对于索引,可以采取rebuild online的方式进行碎片整理,一般来说,经常进行DML操作的对象DBA要定期进行维护,同时注意要及时更新统计信息!一:准备测试数据,使用HR用户,创建T1表,插入约30W的数据,并根据object_id创建普通索引,表占存储空间34M左右,索引占6M左右的存储空间 SQL> conn /as sysdba 已连接。 SQL> select default_tablespace from dba_users where username='HR';  DEFAULT_TABLESPACE ------------------------------------------------------------ USERS  SQL> conn hr/hr 已连接。  SQL> insert into t1 select * from t...
oracle在使用dblink 远程调用数据,插入当前数据库时,提示报错误:ORA-02291: 违反完整约束条件 - 未找到父项关键字检查发现: 两个表之间有外键约束,必须先插入父表再插入字表,删除的时候刚好相反 .  CREATE TABLE "GPS_QUESTION_ANSWER"    (    "QUESTION_ID" NUMBER,     "ANSWER_ID" NUMBER,     "ANSWER_CONTENT" VARCHAR2(512 BYTE),      CONSTRAINT "PRIMARYGPS_QUESTION_ANSWER1" PRIMARY KEY ("QUESTION_ID", "ANSWER_ID")       CONSTRAINT "FK_QUESTION_ANSWER" FOREIGN KEY ("QUESTION_ID")      REFERENCES "GPS_QUESTION_SETTING" ("QUESTION_ID") ON DELETE CASCADE ENABLE   ) SQL> desc gps_question_answerName           Type          Nullable Default Comments -------------- -------...
 
0
oracle给表作了按时间分区,分区表名partition1,partition2,插入数据后,按分区查询partition2数据select * from HT-100 partition(partition2)
SQL*Net message from client 事件产生的原因分析 今天同事运行一个程序,修改表的内容,但运行一半总是挂起,查询数据库看有什么在等待,查询v$session_waitSELECT S.SID,       S.SERIAL#,        S.USERNAME,       S.STATUS,       S.MACHINE,       S.PROGRAM,       S.MODULE,       A.SQL_TEXT  FROM V$SESSION S,       V$SQLAREA AWHERE S.USERNAME IS NOT NULL   AND S.SQL_ADDRESS = A.ADDRESS看见同事那个会话在那挂起,看见SQL*Net message from client 等待时间最长,其实这个是oracle空闲等待时间,只要网络没有问题,可以不用考略这个wait。后来同事修改了下程序通过了,他是因为执行了大查询,而无反应。下面是参考文档:1.对于一个session来说,每时每刻都在wait 的状态。WAIT FOR IO / WAIT FOR CPU / WAIT FOR LATCH /WAIT FOR ...这一点你可以Query v$session_wait,总有data.2....
 
0
oracle10g分区表的自动维护oracle 10g分区表不支持自动化管理,一般都要手动创建分区,手动删除。今天给大家带来了一个自动化管理表空间的脚本。本脚本主要由3个部分组成:sys_ConfigTable.sql、sys_pro_AddAndDropPartition.sql、sys_pro_MergeTable.sql1、sys_ConfigTable.sql 主要创建了一张配置表:这里填写具体要自动维护的表名、保存天数、每天分区的个数等等;2、sys_pro_AddAndDropPartition.sql 这个用来自动增加表分区,删除过期分区;3、sys_pro_MergeTable.sql 等每天的分区大于1时,我们合并旧的分区,并重建失效的索引。1、sys_ConfigTable.sql[sql] view plaincopydrop table CONFIGTABLE;  create table CONFIGTABLE  (    name   VARCHAR2(64) not null,    value  VARCHAR2(64) not null,    type   VARCHAR2(64) not null,    isrun  NUMBER(1) not null,    remark VARCHAR2(64)  ) &n...
 
0

Oracle 分区表-Range分区

发表者:admin分类:数据库2015-08-22 10:53:53 阅读[1979]
Oracle 分区表-Range分区 一、什么是分区表       Oracle提供了分区技术以支持VLDB(Very Large DataBase)。分区表通过对分区列的判断,把分区列不同的记录,放到不同的分区中。分区完全对应用透明。       Oracle的分区表可以包括多个分区, 每个分区都是一个独立的段( SEGMENT),可以存放到不同的表空间中 。查询时可以通过查询表来访问各个分区中的数据,也可以通过在查询时直接指定分区的方法来进行查询。 二、什么时候用分区表When to Partition a Table 什么时候需要分区表,官网的 2 个建议如下:(1)Tables greater than 2GB should always be considered for partitioning.(2)Tables containing historical data, in which new data is added into the newest partition. A typical example is a historical table where only the current month's data is updatable and the other 11 months are read only. 三、分区表优点       (1)由于将数据分散到各个分区中,减少了数据损坏的可能性; ...
    总共51页,当前第27页 | 页数:
  1. 17
  2. 18
  3. 19
  4. 20
  5. 21
  6. 22
  7. 23
  8. 24
  9. 25
  10. 26
  11. 27
  12. 28
  13. 29
  14. 30
  15. 31
  16. 32
  17. 33
  18. 34
  19. 35
  20. 36
  21. 37