当前所在位置:珠峰网资料 >> 计算机 >> Oracle认证 >> 正文
oracle中常用的一些语句(三)
发布时间:2010/10/6 10:33:33 来源:www.xue.net 编辑:城市总裁吧
   CASE的使用

  update jzqld1 set bcrq=case

  when id like '3%' then '09010102'

  when id like '4%' then '09010204'

  else '09010805'

  end;

  删除用户drop user tony/create user tony

  showdown abort; startup;

  希望在scott用户下能看到mk用户中test表的数据???

  connect mk/m123

  grant select on test to scott; //授权scott能select

  connect scott/tiger

  select * from mk.test;

  create synonym mtest for mk.test; //为表建立的

  //可以为任何对象建立同义词

  select * from mtest; //相当于select * from mk.test;

  位图索引

  create bitmap index ind_aa on emp(job);

  create index ind_dept on dept(dname,loc);

  //联合索引 分次序的

  create index ind_dept1 on dept(loc,dname);

  show parameter db_name数据库名

  DBA要及时查看数据库中数据文件的状态(如被误删除),根据实际情况决定如何进行处理,检查数据文件的状态的SQL如下:

  select file_name,status from dba_data_files;

  如果数据文件的STATUS列不是AVAILABLE,那么就要采取相应的措施,如对该数据文件进行恢复操作,

  或重建该数据文件所在的表空间。

  //给用户授予权限

  grant connect,dba,resource to testserver_user;

  //创建用户并指定表空间

  create user ORACLE8I identified by ORACLE8I

  default tablespace ORACLE8I

  temporary tablespace test_temp ;

  //创建数据表空间

  create tablespace oracle8i

  logging

  datafile 'E:\oracle\product\10.2.0\oradata\testserver\test_data01.dbf'

  size 32m

  autoextend on

  next 32m maxsize 2048m

  extent management local;

  //创建临时表空间

  create temporary tablespace test_temp

  tempfile 'E:\oracle\product\10.2.0\oradata\testserver\test_temp01.dbf'

  size 32m

  autoextend on

  next 32m maxsize 2048m

  extent management local;

  表锁 : lock table emp in exclusive mode;

  对emp表加的表锁

  一般不使用表锁;

  alter table aa move tablespace bb

广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved