日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

表空间,序列

發布時間:2025/7/14 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 表空间,序列 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

表空間

首先用system登錄,對用戶授權

grant create,drop tablespace to HAPPYY2165


create 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 y2165tabspace
datafile '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;

轉載于:https://www.cnblogs.com/wangbenqing/p/7545651.html

總結

以上是生活随笔為你收集整理的表空间,序列的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。