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'); ------测试