|
- select username, password from dba_users order by 1;
- select u.name,u.password
- from user$ u
- order by u.name;
- --48DF04E7BAB11018
- alter user hr identified by oracle_4U; 口令验证
- alter user hr identified using .....(PL/SQL , JAVA); / alter user .... identified externally ; 外部 验证
- alter user hr identified global .....(LDAP ,WINDOWS DOMAIN); 全局验证
复制代码- create user ops$oracle identified externally;
-
- create user user1 identified by oracle_4U;
-
- select u.username,
- u.account_status,
- u.lock_date,
- u.expiry_date,
- u.authentication_type
- from dba_users u
- where u.username in ('OPS$ORACLE','USER1');
-
- grant create session to ops$oracle;
-
- grant connect to user1;
复制代码- SQL> conn /
- ERROR:
- ORA-01045: user OPS$ORACLE lacks CREATE SESSION privilege; logon denied
- Warning: You are no longer connected to ORACLE.
- SQL> conn user1/oracle_4U
- ERROR:
- ORA-01045: user USER1 lacks CREATE SESSION privilege; logon denied
- SQL> conn /
- Connected.
- SQL> show user
- USER is "OPS$ORACLE"
- SQL> conn user1/oracle_4U
- Connected.
- SQL> show user
- USER is "USER1"
- SQL> select * from session_privs;
- PRIVILEGE
- ----------------------------------------
- CREATE SESSION
- SQL> conn /
- Connected.
- SQL> select * from session_privs;
- PRIVILEGE
- ----------------------------------------
- CREATE SESSION
- SQL>
复制代码- select * from role_sys_privs rsp
- where rsp.role='CONNECT';
复制代码 | ROLE | PRIVILEGE | ADMIN_OPTION | 1 | CONNECT | CREATE SESSION | NO |
- select * from system_privilege_map;
- select * from dba_sys_privs;
复制代码
- grant select_catalog_role to hr;
复制代码- select * from dba_role_privs rp
- where rp.grantee='HR';
复制代码 | GRANTEE | GRANTED_ROLE | ADMIN_OPTION | DEFAULT_ROLE | 1 | HR | RESOURCE | NO | YES | 2 | HR | SELECT_CATALOG_ROLE | NO | YES |
- grant create session to user2 identified by oracle_4U;
复制代码- grant create table to user1;
- select * from dba_ts_quotas;
- alter user user1 quota 1M on example;
- select * from dba_ts_quotas;
- alter user user1 quota 0 on example;
- select * from dba_ts_quotas;
复制代码- select u.username,
- u.account_status,
- u.lock_date,
- u.expiry_date,
- u.authentication_type
- from dba_users u
- where u.username in ('OPS$ORACLE','USER1');
- alter user user1 account lock;
- alter user user1 account unlock;
- alter user user1 password expire;
- select u.username,
- u.account_status,
- u.lock_date,
- u.expiry_date,
- u.authentication_type
- from dba_users u
- where u.username in ('OPS$ORACLE','USER1');
复制代码- select * from dba_roles;
- create role role1;
- grant select on sh.sales to role1;
- select * from role_tab_privs tp
- where tp.role='ROLE1' ;
复制代码 | ROLE | OWNER | TABLE_NAME | COLUMN_NAME | PRIVILEGE | GRANTABLE | 1 | ROLE1 | SH | SALES | | SELECT | NO |
role延迟生效:
- SQL> set role RESOURCE,SELECT_CATALOG_ROLE,HS_ADMIN_SELECT_ROLE, ROLE1;
- Role set.
- SQL> select count(*) from sh.sales;
- COUNT(*)
- ----------
- 918843
复制代码
危险:也是延迟回收的。
角色是动态的:
- revoke select on sh.sales from role1;
复制代码- SQL> /
- select count(*) from sh.sales
- *
- ERROR at line 1:
- ORA-00942: table or view does not exist
复制代码-
- alter user hr default role none;
复制代码
role的选择性获取:
- create role role2 identified by oracle_4U ;
- grant role1 to role2;
- revoke role1 from hr;
- grant role2 to hr;
复制代码
- SQL> set role role2 identified by oracle_4U ;
- Role set.
- SQL>
复制代码- select u.username,
- u.account_status,
- u.lock_date,
- u.expiry_date,
- u.authentication_type,
- u.profile
- from dba_users u
- where u.username in ('OPS$ORACLE','USER1');
- select * from dba_profiles p
- where p.profile='DEFAULT' and
- p.resource_type='PASSWORD' ;
复制代码 | PROFILE | RESOURCE_NAME | RESOURCE_TYPE | LIMIT | 1 | DEFAULT | FAILED_LOGIN_ATTEMPTS | PASSWORD | 10 | 2 | DEFAULT | PASSWORD_LIFE_TIME | PASSWORD | 180 | 3 | DEFAULT | PASSWORD_REUSE_TIME | PASSWORD | UNLIMITED | 4 | DEFAULT | PASSWORD_REUSE_MAX | PASSWORD | UNLIMITED | 5 | DEFAULT | PASSWORD_VERIFY_FUNCTION | PASSWORD | NULL | 6 | DEFAULT | PASSWORD_LOCK_TIME | PASSWORD | 1 | 7 | DEFAULT | PASSWORD_GRACE_TIME | PASSWORD | 7 |
- CREATE PROFILE "PROFILE1" LIMIT
- PASSWORD_LOCK_TIME .00069444
- FAILED_LOGIN_ATTEMPTS 1;
-
- select * from dba_profiles p
- where p.profile='PROFILE1' and
- p.resource_type='PASSWORD' ;
-
- alter user user1 profile profile1;
- select u.username,
- u.account_status,
- u.lock_date,
- u.expiry_date,
- u.authentication_type,
- u.profile
- from dba_users u
- where u.username ='USER1';
复制代码- ALTER PROFILE "PROFILE1" LIMIT PASSWORD_LIFE_TIME 0.000694444
- PASSWORD_GRACE_TIME 0.000694444
复制代码- select u.username,
- u.account_status,
- u.lock_date,
- u.expiry_date,
- u.authentication_type,
- u.profile
- from dba_users u
- where u.username ='USER1';
复制代码
| USERNAME | ACCOUNT_STATUS | LOCK_DATE | EXPIRY_DATE | AUTHENTICATION_TYPE | PROFILE | 1 | USER1 | EXPIRED(GRACE) | | 7/31/2018 9:42:37 PM | PASSWORD | PROFILE1 |
过了grace回到28001:
- select u.username,
- u.account_status,
- u.lock_date,
- u.expiry_date,
- u.authentication_type,
- u.profile
- from dba_users u
- where u.username ='USER1';
复制代码
|
|