🕺作者: 主页
我的专栏 C语言从0到1 探秘C++ 数据结构从0到1 探秘Linux 😘欢迎关注:👍点赞🙌收藏??留言
🏇码字不易,你的👍点赞🙌收藏??关注对我真的很重要,有问题可在评论区提出,感谢阅读!!!
create user TESTUSER
IDENTIFIED BY test
default tablespace users
quota unlimited on users;
运行结果
grant connect,resource to TESTUSER;
运行结果
conn testuser/test
运行结果
4.1.创建学生信息表并插入数据
create table stu_table
(
stu_no char(8) primary key not null,
stu_name varchar2(10) not null,
stu_sex char(1) not null,
stu_grade float not null
);
insert into stu_table(stu_no, stu_name, stu_sex, stu_grade)
values ('20180001', 'Lunatic', 'M', 488.2);
insert into stu_table(stu_no, stu_name, stu_sex, stu_grade)
values ('20180002', 'Insane', 'M', 391.5);
insert into stu_table(stu_no, stu_name, stu_sex, stu_grade)
values ('20180003', 'Mad', 'M', 477.8);
insert into stu_table(stu_no, stu_name, stu_sex, stu_grade)
values ('20180004', 'Faze Clan', 'F', 489.2);
insert into stu_table(stu_no, stu_name, stu_sex, stu_grade)
values ('20180005', 'Astralis', 'F', 590.2);
insert into stu_table(stu_no, stu_name, stu_sex, stu_grade)
values ('20210006', 'ARSENAL', 'M', 591.2);
insert into stu_table(stu_no, stu_name, stu_sex, stu_grade)
values ('20210007', 'Chelsea', 'M', 488.5);
savepoint key_rollback;
insert into stu_table(stu_no, stu_name, stu_sex, stu_grade)
values ('20210008', 'Man Utd', 'M', '388.7');
rollback to key_rollback;
select * from stu_table;
select * from stu_table
where stu_grade > 480;
grant create view to testuser;
create view view_male
as
select * from stu_table
where stu_sex = 'M';
create index B_index on testuser.stu_table(stu_grade);
create cluster empl_dep(depno varchar2(4))
size 500
tablespace users storage(
initial 100 K
next 200 K
minextents 2
maxextents 20
pctincrease 33
);
运行结果

create table empl
(
e_no varchar(10) primary key,
e_name varchar(10) not null,
e_sex varchar(2),
depno varchar(4) not null references dep
)
cluster empl_dep(depno);
create table dep
(
depno varchar(4) primary key,
d_name varchar(10) not null,
rs number
)
cluster empl_dep(depno);

create index empl_dep_index
on cluster empl_dep tablespace users;
grant all on empl to scott;
本次实验着重介绍了模式对象管理和安全管理的知识。通过实验,我们学习了创建用户、授权和权限设置的方法,以及使用命令创建表、视图、索引等数据库对象的技巧。我们还学会了保存点、回退和提交操作的运用,以及如何建立和管理用户角色和权限。此外,我们还学习了在表簇中建立索引和授予权限的操作。通过这次实验,我们对数据库的结构管理和安全性有了更深入的理解,为今后的数据库管理工作打下了坚实基础。