--> 进入sqlplus
[oracle@wiki-11 oracle]$ sqlplus '/as sysdba'
启动数据库:
startup
SQL> startup
ORACLE instance started.
Total System Global Area 1326520700 bytes
Fixed Size 452988 bytes
Variable Size 251658240 bytes
Database Buffers 1073741824 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
显示SGA信息;
SQL> show sga
Total System Global Area 1326520700 bytes
Fixed Size 452988 bytes
Variable Size 251658240 bytes
Database Buffers 1073741824 bytes
Redo Buffers 667648 bytes
新建用户
create user命令:
create user username identified {by password | externally}
SQL> create user test1 identified by ttt;
User created.
给用户赋权限
grant connect,resource to test1;
其中resource是一个角色
oracle角色是一组权限,我们可以将一些特殊的权限授给角色,再将角色授给用户。可以将角色当成权限组来理解。
oracle三种标准的角色:connect、resource、dba
赋于用户建立会话的权限
grant CREATE SESSION to test1
更改用户的口令
alter user test1 identified by ddd;
使用password命令来更改用户的口令
SQL> password
Changing password for TEST1
Old password:
New password:
Retype new password:
Password changed
SQL>
建立预置文件来管理用户的口令:
create profile
将用户的失败登录次数限制为5
SQL> create profile LIMITED_PROFILE limit FAILED_LOGIN_ATTEMPTS 5;
Profile created.
SQL> alter user test1 profile LIMITED_PROFILE;
User altered.
用户失败登录计数达到限制时用户会被锁定。
SQL> conn test1/33
ERROR:
ORA-28000: the account is locked
此时即口令正确也不能登录
我们来解除用户锁定
SQL> alter user test1 account unlock;
User altered.
同时还可以手动锁定用户
SQL> alter user test1 account lock;
User altered.
更改用户预置文件设定口令锁定时间及口令的生命期
SQL> alter profile LIMITED_PROFILE limit
2 PASSWORD_LiFE_TIME 30
3 PASSWORD_LOCK_TIME 1;

发表评论