create tablespace gouchao
datafile 'f:\xyc01.dbf' size 50m;
create user xuyongchao3 identified by xyc
default tablespace gouchao
temporary tablespace temp;
alter user xuyongchao identified by gouchao;
alter user gouchao password expire;
alter user xuyongchao account lock;
alter user xuyongchao account unlock;
grant connect ,resource ,create table ,create session ,create procedure to xuyongchao;、
grant select on scott.emp to gouchao;
为用户撤销权限:
revoke connect from gouchao;
create role student;
grant select any table ,connect ,resource to student with admin option;
grant student to xuyongchao;
revoke teacher from xuyongchao;
drop role teacher;
select * from dba_users;
select * from dba_users where username='XUYONGCHAO';
conn xuyongchao/xyc
select * from user_sys_privs;
conn xuyongchao/xyc
select * from user_role_privs;
select * from user_sequences;
create sequence S_userno
start with 50 increment by 10
MAXvalue 99 cache 10;
alter sequence S_userno
maxvalue 200 cache 20 ;
drop sequence S_userno
nextVal:用于返回下一个序列号
Curral:用于返回当前序列号
insert into user(userno ,username) values(S_userno.Nextval,'33');
同义词是方案对象的别名,作用:1)简化对象访问2)提高对象访问的安全性
create public synonym public_emp for scott.emp;
select * from public_emp;
create synonym private_emp for scott.emp;
drop public synonym public_emp;
drop synonym private_emp;