Chinaunix首页 | 论坛 | 博客
  • 博客访问: 91741652
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: Oracle

2008-04-30 19:10:25




sql> alter index xay_id allocate extent(size 200k datafile 'c://index.dbf');

<8>.alter index xay_id deallocate unused;

<9>、查看索引
     SQL>select index_name,index_type,table_name from user_indexes order by table_name;
<10>、查看索引被索引的字段
     SQL>select * from user_ind_columns where index_name=upper('&index_name');

11、创建序列
    select * from user_sequences;
    create  sequence SEQ_NAME  start with 1000
         maxvalue  1000 increment by 1;
    alter sequence  SEQ_NAME minvalue 50 maxvalue 100;
12、删除重复行
    update a set aa=null where aa is not null;
   
    delete from a where rowid!=
        (select max(rowid) from a  b where  a.aa=b.aa);
13、删除同其他表相同的行
    delete from a  where exits
      (select 'X' from b where b.no=a.no);
    或
      delete from a  where no in (select no from b);
14、查询从多少行到多少行的记录(可以用在web开发中的分页显示)

 select * from ( select rownum row_id,b.* from (select a.* from sys_oper a) b )
 where row_id between 15 and 20

15、对公共授予访问权
    grant select on 表名 to public;
    create public synonym 同义词名  for 表名;
16、填加注释
    comment on table 表名 is  '注释';
    comment on column 表名.列名 is '注释';
17、分布式数据库,创建数据库链路
    create [public] database link LINKNAME
       [connect to USERNAME identified by PASS]
       [using 'CONNECT_STRING']
    可以在端,也可以在客户端建立,但必须注意,两台服务器之间
    数据库必须可以互访,必须各有各自的别名数据库
18、查看数据库链路
    select * from  all_db_links;
    select * from user_db_links;
    查询  select * from ;
    创建远程数据库同义词
       create synonym  for ;
    操纵远程数据库记录
      insert into (a,b)  values (va,vb);
      update      set a='this';
      delete from ;

阅读(272) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~