参考 :
https://www.cnblogs.com/xielong/p/8950999.html
https://blog.csdn.net/starnight_cbj/article/details/6792364
oracle版本 : Release 11.2.0.1.0
docker版本 : Docker version 19.03.8, build afacb8b
创建用户及授权(创建用户名和密码都为test)
create user test identified by test;
grant connect,resource,dba to test;
查询所有表空间
select name from v$tablespace;
查询用户下所有表
select table_name from user_tables;
创建表空间
create tablespace ts_test datafile '/data/oracle/test.dbf' size 1500M autoextend on next 5M maxsize 3000M;
创建表
create table Student(
stuId number(9) not null,
stuName varchar2(20) not null,
stuMsg varchar2(50) null
);
创建自增序列
create sequence Student_stuId_Seq
increment by 1
start with 1
minvalue 1
maxvalue 999999999;
插入数据
insert into Student(stuId,Stuname) values(Student_stuId_Seq.Nextval,'n1');
insert into Student(stuId,Stuname) values(Student_stuId_Seq.Nextval,'n2');
insert into Student(stuId,Stuname) values(Student_stuId_Seq.Nextval,'n3');
insert into Student(stuId,Stuname) values(Student_stuId_Seq.Nextval,'n4');
insert into Student(stuId,Stuname) values(Student_stuId_Seq.Nextval,'n5');
insert into Student(stuId,Stuname) values(Student_stuId_Seq.Nextval,'n6');
insert into Student(stuId,Stuname) values(Student_stuId_Seq.Nextval,'n7');
insert into Student(stuId,Stuname) values(Student_stuId_Seq.Nextval,'n8');
insert into Student(stuId,Stuname) values(Student_stuId_Seq.Nextval,'n9');
insert into Student(stuId,Stuname) values(Student_stuId_Seq.Nextval,'n10');
insert into Student(stuId,Stuname) values(Student_stuId_Seq.Nextval,'n11');
查询表数据
select * from student;
清空表
truncate table student;
删除表
drop table student;
查看表结构
desc student;
删除表空间
DROP TABLESPACE ts_test INCLUDING CONTENTS AND DATAFILES;