Oracle-16.1创建和管理数据库用户账户

16.1.1用户账户属性

1.oracle12c中默认带有hr模式;

2.登录hr模式:

   #su - oracle

   #lsnrctl start

   #sqlplus / as sysdba

    >startup;

   >alter pluggable database all open;

   >alter session set container=pdboaec;

   >conn hr / hr@pdboaec;

   >show user;

3.查看用户的默认表空间

   >select default_tablespace from user_users;

   

 

 

4.查看数据库的所有表空间

   >col file_name for a60;

   >set linesize 160;

   >select file_name,tablespacle,bytes from dba_data_files;

   

5.更换用户的默认表空间

   >alter database default tablespace system;

6.查看用户FWQ的默认表空间和默认临时表空间

  >create user fwq identified by fwq;

  >select username from dba_users;      查看创建的用户FWQ

  >select default_tablespace,temporary_tablespace from dba_users whers username='FWQ';     注意创建的用户名默认为大写;

   

 

  >alter database default tablespace users;    将数据库默认表空间改为USERS;

  >select default_tablespace,temporary_tablespace from dba_users where username='FWQ';

  

7.修改用户在表空间上的配额

   >alter user  fwq quota 10m on users;   将用户fwq在USERS表空间上的配额改为10m

   >alter user fwq quota unlimited on users; 将用户fwq在USERS表空间的配额改为无限

8.查看用户配额分配情况

   >select tablespace_name,bytes,max_bytes from dba_ts_quota where username='FWQ';    "-1"表示无限配额,bytes为0表示他当前未使用两个表空间中的任何一个

   

  >alter user fwq quota 10m on users;

  >select tablespace_name,bytes,max_bytes from dba_ts_quota where username='FWQ';

  

 

 9.查看表空间和临时表空间

   >select property_name,property_value from database_properties where property_name like '%TABLESPACE%';

   

 

 10.修改用户的临时表空间

      >alter user fwq temporary tablespace tablespace_name;

 11.查看用户账户状态

     >select account_status from dba_users;       

     

 

 12.设置用户状态

    >alter user fwq account lock;

    >alter user fwq account unlock;

    >alter user fwq password expire;

16.1.2身份验证方法

16.1.3创建账户

1.创建账户

   >create user alois identified by alois

     default tablespace users password expire;

   >create user afra identified by oracle

     default tablespace users quota unlimited on users;

   >create user anja identified by oracle;

 

posted @ 2020-04-13 15:20  奔跑在study的路上  阅读(614)  评论(0编辑  收藏  举报