启动Oracle
sqlplus sys/1234 as sysdba //sys用户登录
sqlplus mike/1234 // 普通用户登录
简单命令
1,创建新用户并设置密码为pwd123
create user mike identified by "123"; //此时用户还没有登录权限
2,创建新用户,设置密码,并设置默认表空间为USERS
create user tom identified by pwd123
default tablespace users
quota 50m on users;
grant create session to tom; --授予登录权限
grant unlimited tablespace to tom; --授予无线表空间
3,创建用户,并设置用户为过期,用户状态为加锁
create user peter identified by pwd123
password expire
account lock;
alter user peter account unlock; --解锁用户
alter user peter identified by pwd123;-- 修改用户密码
password peter;-- 修改用户密码
4,创建角色,角色:一组相关权限的集合
create role testrole; --创建角色
grant create any table,create session to testrole;-- 授予登录和创建表的权限
grant select on scott.EMP to testrole; -- 授予角色访问sctt用户下的EMP表权限
grant testrole to peter;-- 将角色授予给用户