1、表空间
表空间由数据文件构成
创建表空间:
create tablespace tableName
datafile ‘c\name.dbf’
size 100m
next 10m
创建表的时候如果没有指定表空间,普通用户默认为USERS01.DBF这个表空间
也可以创建用户的时候指定默认表空间
2、复制表
create table emp10
as
select * from emp where 1=2;
由于1永远不等于2,所以只复制了表结构,没有复制表记录
rowid 行地址(伪列)
通过rowid获得记录:
select *
from emp10
where rowid='AAAM4KAAEAAAAGoAAB';
3、修改表
增加列:alter table test1 add photo blob;(blob 大的二进制对象)
修改列:alter table test1 modify tname varchar2(40);(修改了列类型)
删除列:alter table test1 drop column photo;(删除photo列)
重命名列:alter table test1 rename column tname to username;(吧列tanme改为username)
重命名表:rename test1 to test2;(修改表名test1为test2)
4、回收站
(1)drop表后并没把表删除,只是删除到oracle回收站中
(2)oracle中管理员没有回收站,只有普通用户才有回收站
(3)通过回收站中的表名也可以查到数据,但是表名要加双引号
查看回收站:show recyclebin
清空回收站:purge recyclebin
不经过回收站直接删除:drop table tableName purge;
闪回删除:操作回收站:flashback table tableName to before drop;
5、闪回操作
oracle10g有6种闪回操作,oracle11g中有7中闪回操作
(1)闪回删除
(2)闪回表
(3)闪回查询
(4)闪回版本查询
(5)闪回事务查询
(6)闪回数据库
oracle11g中新增的操作(最麻烦的一种):闪回数据归档