Oracle默认用户
- sys 相当于linux root账户权限最大的用户
- system 默认系统管理员,管理数据库用户、权限、存储等
- SCOTT 示范账户
CREATE USER <username>
INDENTIFIED BY <password>
sqlplus /nolog
SQL> conn system/system@orcl
# 创建用户
SQL> CREATE USER test1 IDENTIFIED by test1;
# 定义配置文件profile1 允许最大的登陆次数 失败之后锁定2天
SQL> CREATE profile pro1 limit failed_login_attempts 2 password_lock_time 2;
# test1账户加载profile1配置文件
SQL> ALTER user test1 profile pro1;
# 输入错误2次密码被锁定查看锁定状态
SQL> select username,account_status from dba_users WHERE username='TEST1';
USERNAME ACCOUNT_STATUS
------------------------------ --------------------------------
TEST1 LOCKED(TIMED)
# 解锁
SQL> ALTER user test1 account unlock;
SQL> select username,account_status from dba_users WHERE username='TEST1';
USERNAME ACCOUNT_STATUS
------------------------------ --------------------------------
TEST1 OPEN
# 密码最大有效期10天,最大宽限2天
SQL> ALTER profile pro1 limit password_life_time 10 passwoed_grace_time 2;
# 恢复默认权限
SQL> ALTER user test1 profile DEFAULT;
END