pdb相关命令
针对pdb里面数据(包括用户、密码、策略、锁定用户、解锁用户等等)均需要切换到要改动的pdb。
#查看当前容器内有多少个pdb
show pdbs
#切换到指定pdb
alter session set container=orclpdb;
#切回cdb
alter session set container=CDB$ROOT;
#查看密码策略
select * from dba_profiles
#更改用户登录的失败次数(超过指定次数则锁定账户)
alter profile default limit FAILED_LOGIN_ATTEMPTS unlimited;
#解锁(锁定)用户
alter user user_name account unlock(lock);
#更改用户的密码
alter user aytest identified by 123456
#更改密码的生命周期(多长时间更改一次密码)
alter profile default limit password_life_time unlimited;
cdb相关命令
# 创建公共用户
create user c##nmp identified by LZtOYHh5fWzhQGZw;
# 授予创建会话的权限(只有给用户创建会话的权利,然后它才可以切到那个pdb,并在pdb里给他赋予指定的权限。)
grant create session to c##nmp;
# 直接授予指定权限到指定pdb
grant dba,create session to c##nmp container = orclpdb
# 查看当前用户
show user
# 创建表空间,并设置无限自动增长。(这个无限自动增长也是有限制的,最大好像32G)
create tablespace nmptablespace datafile '/u01/app/oracle/oradata/orcl/orclpdb/nmptablespace.dbf' size 500M autoextend on next 100M maxsize unlimited;
# 创建用户并指定表空间
create user nmp identified by 123456 default tablespace nmptablespace;




