表空间
首先用system登录,对用户授权
grant create,drop tablespace to HAPPYY2165create tablespace y2165tabspace
datafile 'E:\app\Happy\oradata\orcl\y2165tabspace_1.dbf' size 10m,
'E:\app\Happy\oradata\orcl\y2165tabspace_2.dbf' size 10m
autoextend on next 32m maxsize unlimited
select tablespace_name from user_tablespaces;
--删除表空间
drop tablespace y2165tabspace2
--删除表空间的同时清除物理文件
drop tablespace y2165tabspace including contents and datafiles
序列
序列和表是平级的。
序列是用于生成唯一,连续序号的对象,序列可以是升序的,也可以是降序的,使用 create seqvence语句创建序列。
create tablespace y2165tabspacedatafile 'E:\app\Happy\oradata\orcl\y2165tabspace_1.dbf' size 10m
autoextend on next 32m maxsize unlimited
--Oracle没有自增列 ,用的就是序列
create table dept
(
deptno number primary key not null,
deptname nvarchar2(32)
) tablespace y2165tabspace
create table emp
(
empno number primary key not null,
empname nvarchar2(32)
) tablespace y2165tabspace
insert into dept values(1,'开发部')
commit
select * from dept
insert into emp values(1,'啦啦')
insert into emp values(seq_num.nextval,'啦啦')
commit
select * from emp
insert into dept values(seq_num.nextval,'开发部')
select seq_num.nextval from dual;
--当前序列中存储的值是多少
select seq_num.currval from dual;
--GUID和UUID
select SYS_GUID() from dual;