文档详情

[整理]java知识点.doc

发布:2017-04-19约5.57万字共17页下载文档
文本预览下载声明
原文地址:HYPERLINK /s/blog_512117be01008iz4.htmlORACLE 行级锁:表级锁:行共享:行排他:共享锁共享行排他:排他锁:表分区作者:HYPERLINK /u/1361123262宝贝 行级锁: select * from userinfo for update; 这时候可以锁定选中的所有行 如果已经被锁定,就不用等待 select * from userinfo for update nowait; 如果已经被锁定,更新的时候等待5秒 select * from userinfo for update wait 5; 表级锁: 行共享:允许用户进行任何操作,禁止排他锁 lock table userinfo in row share mode; 行排他:允许用户进行任何操作,禁止共享锁 lock table userinfo in row exclusive mode; 共享锁:其他用户只能看,不能修改 lock table userinfo in share mode; 共享行排他:比共享锁有更多限制 lock table userinfo in share row exclusive mode; 排他锁:其他用户只能看,不能修改,不能加其他锁 lock table userinfo in exclusive mode; 表分区: 范围分区: select PARTITION_NAME from user_tab_partitions; create table sales ( product_id varchar2(20), sales_date date not null, sales_cost number(10) ) partition by range (sales_cost) ( partition p1 values less than (1000), partition p2 values less than (2000), partition p3 values less than (maxvalue) ) SQL insert into sales values(test001,sysdate,1200); SQL insert into sales values(test001,sysdate,2200); SQL insert into sales values(test001,sysdate,2000); SQL insert into sales values(test001,sysdate,122000); SQL insert into sales values(test001,to_date(2004-04-12,yyyy-mm-dd),122000); 从指定分区查找数据: select * from sales partition(p3); SQL update sales set sales_cost=500 where sales_cost=122000; update sales set sales_cost=500 where sales_cost=122000 * ERROR 位于第 1 行: ORA-14402: 更新分区关键字列将导致分区的更改 总结:范围分区不能建立在可变字段上面 普通的表不能升级为分区表 散列分区: create table employee( emp_id number(4), emp_name varchar2(14), descp varchar2(20) ) partition by hash(emp_id) partitions 4; 备注:下面这条语句可以看到employee下面分区的名字 select table_name,PARTITION_NAME from user_tab_partitions where table_name=EMPLOYEE; 指定分区表的名字: create table employee( emp_id number(4), emp_name varchar2(14), descp varchar2(20) ) partition by hash(emp_id)( partition p1, partition p2 ); SQL insert into employee values(001,test1,haha); 已创建 1 行。 SQL insert into employee values(001,test1,haha1); 已创建 1 行。 SQL select * from employee ; EMP_ID EMP_NAME
显示全部
相似文档