表空间操作(DBA用户)
select * from v$tablespace;
select username, default_tablespace from user_users;
create tablespace test_tablespace datafile '/u01/app/oracle/oradata/xe/testspace.dbf' size 128M;
create user test_user identified by pwdtest default tablespace test_tablespace;
alter user test_user default tablespace test_tablespace;
alter user test_user quota unlimited on test_tablespace;
drop tablespace test_tablespace including contents and datafiles;
用户操作(DBA用户)
select * from all_users;
create user testuser identified by pwdtestuser;
select * from user_sys_privs;
select * from user_tab_privs;
grant create table to test_user;
grant all on test_table to test_user;
grant select on test_table to test_user;
grant resource to test_user;
invoke all on test_table to test_user;
alter user test_user identified by new_pwd;
drop user testuser
表操作
create table test_user(
id number generated by default as identity primary key;
name varchar2(64) not null;
age number(3) default 0 not null;
remark varchar2(256)
) tablespace testspace;
comment on table test_user is '测试用户信息表';
comment on column test_user.id is '主键';
comment on column test_user.name is '姓名';
comment on column test_user.age is '年龄';
comment on column test_user.remark is '备注';
alter table test_user add (birthday date default sysdate not null);
alter table test_user modify (birthday date null);
alter table test_user drop column birthday;
alter table test_user drop(birthday, remark);
alter table test_user rename to test_table;
truncate table test_user;
drop table test_user;