创建表空间
CREATE TABLESPACE testdb LOGGING DATAFILE 'F:\oracle\app\oracle\oradata\XE\testdb.dbf' SIZE 100M AUTOEXTEND ON NEXT 32M MAXSIZE 500M EXTENT MANAGEMENT LOCAL;create temporary tablespace testdb_temp tempfile 'F:\oracle\app\oracle\oradata\XE\testdb_temp.dbf' size 100m autoextend on next 32m maxsize 500m extent management local;创建用户CREATE USER testuser IDENTIFIED BY asdf1234 DEFAULT TABLESPACE testdb TEMPORARY TABLESPACE testdb_temp;授权grant connect,resource,dba to testuser;grant create session to testuser;创建表create table users(
id number(9) not null primary key, name varchar2(64) not null, password varchar2(64) not null, age number(3) default 10) 删除表空间DROP TABLESPACE testdb INCLUDING CONTENTS AND DATAFILES;删除用户drop user testuser cascade;创建主键sequencecreate sequence users_seq increment by 1 start with 1 MAXVALUE 999999 NOCYCLE NOCACHE;SELECT users_seq.currval FROM DUAL; INSERT INTO users VALUES (users_seq.nextval, 'sam');