Oracle角色,權限,表空間基礎語句
控制臺:
-sqlplus -----連接數據庫
-conn sys/123456@orcl as sysdba -----登錄sys
-create tablespace lpf_tablespace datafile ‘D:\mywork\Oracle\oradata\orcl\LPFTABLESPACE.DBF‘ size 100m autoextend on next 32m maxsize unlimited; -----創建表空間
-create user lpf identified by 123456 default tablespace lpf_tablespace; -----創建用戶
-gtant connect,resource to lpf; -----賦予用戶角色(包含相關系統權限)
plsql:
- -----建表
- -----設置主鍵
-創建主鍵的自增:
create sequence cust_seq1 start with 1 increment by 1 minvalue 1 nomaxvalue cache 10; -------創建自增序列
create or replace trigger cust_insert before insert on cst_customer for each row when(new.cust_id is null) begin select cust_seq.nextval into:new.cust_id from dual; end; ------創建觸發器
insert into cst_customer (cust_name) values (‘123‘); ------測試
Oracle角色,權限,表空間基礎語句