--创建序列
CREATE SEQUENCE increase_sequence
INCREMENT BY 1 -- 每次加几个
START WITH 1 -- 从1开始计数
MAXVALUE 9999999999
MINVALUE 1
--NOMAXVALUE -- 不设置最大值
NOCYCLE -- 一直累加,不循环
NOCACHE -- 不建缓冲区
select increase_sequence.nextval from dual;--查询序列下一值
select increase_sequence.currval from dual;--查询序列当前值
drop sequence increase_sequence;--删除序列
触发器
create or replace trigger bbs_topic_autoNo
before insert on bbs_topic----(sysrole为表名)
for each row----触发每一行
begin
select bbs_topic_sequences.nextval into :new.topicid from dual;
end;
创建表空间
create tablespace hcrm
datafile 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\hcrm.dbf' size 200M
autoextend on next 20M maxsize unlimited logging
extent management local autoallocate
segment space management auto
commit;
穿件用户
-- Create the user
create user HCRM
identified by ""
default tablespace HCRM
temporary tablespace TEMP
profile DEFAULT
quota unlimited on hcrm;
-- Grant/Revoke role privileges
grant dba to HCRM with admin option;
-- Grant/Revoke system privileges
grant administer any sql tuning set to HCRM with admin option;
grant unlimited tablespace to HCRM with admin option;
CREATE SEQUENCE increase_sequence
INCREMENT BY 1 -- 每次加几个
START WITH 1 -- 从1开始计数
MAXVALUE 9999999999
MINVALUE 1
--NOMAXVALUE -- 不设置最大值
NOCYCLE -- 一直累加,不循环
NOCACHE -- 不建缓冲区
select increase_sequence.nextval from dual;--查询序列下一值
select increase_sequence.currval from dual;--查询序列当前值
drop sequence increase_sequence;--删除序列
触发器
create or replace trigger bbs_topic_autoNo
before insert on bbs_topic----(sysrole为表名)
for each row----触发每一行
begin
select bbs_topic_sequences.nextval into :new.topicid from dual;
end;
创建表空间
create tablespace hcrm
datafile 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\hcrm.dbf' size 200M
autoextend on next 20M maxsize unlimited logging
extent management local autoallocate
segment space management auto
commit;
穿件用户
-- Create the user
create user HCRM
identified by ""
default tablespace HCRM
temporary tablespace TEMP
profile DEFAULT
quota unlimited on hcrm;
-- Grant/Revoke role privileges
grant dba to HCRM with admin option;
-- Grant/Revoke system privileges
grant administer any sql tuning set to HCRM with admin option;
grant unlimited tablespace to HCRM with admin option;