Oracle解鎖與加鎖(hr使用者為例)

2021-05-21 21:22:57 字數 4528 閱讀 9063

sql*plus: release 9.2.0.4.0 - production on tue jul 14 18:12:38 2009

sql> conn sys/sys as sysdba

connected.

sql> show user

user is "sys"

sql> desc dba_users

name                                   null?    type

username                         not null varchar2(30)

user_id                             not null number

password                                 varchar2(30)

account_status                   not null varchar2(32)

lock_date                                       date

expiry_date                                    date

default_tablespace                    not null varchar2(30)

temporary_tablespace                      not null varchar2(30)

created                            not null date

profile                             not null varchar2(30)

initial_rsrc_consumer_group                      varchar2(30)

external_name                                    varchar2(4000)

sql> set lines 200

sql> select username,account_status from dba_users;

username                 account_status

sys                      open

system                      open

dbsnmp                            open

scott                        open

outln                        expired & locked

wmsys                       expired & locked

ordsys                      expired & locked

ordplugins                    expired & locked

mdsys                       expired & locked

ctxsys                      expired & locked

xdb                            expired & locked

username                 account_status

anonymous                    expired & locked

wksys                       expired & locked

wkproxy                  expired & locked

odm                           expired & locked

odm_mtr                 expired & locked

olapsys                   expired & locked

hr                        expired & locked

oe                        expired & locked

pm                       expired & locked

sql> alter user hr account unlock;(解鎖)

user altered.

sql> select username,account_status from dba_users;

username                 account_status

sys                      open

system                      open

dbsnmp                            open

scott                        open

hr                        expired

outln                        expired & locked

wmsys                       expired & locked

ordsys                      expired & locked

ordplugins                    expired & locked

ql> alter user hr identified by hr;(更改密碼)

user altered.

sql> select username,account_status from dba_users;

username                 account_status

sys                      open

system                      open

dbsnmp                            open

scott                        open

hr                        open

outln                        expired & locked

sql> conn hr/hr

connected.

sql> conn /as sysdba

connected.

sql> alter user hr account lock;(加鎖)

user altered.

sql> select username,account_status from dba_users;

username                 account_status

sys                      open

system                      open

dbsnmp                            open

scott                        open

hr                        locked

outln                        expired & locked

sql> alter user hr password expire;(密碼失效)

user altered.

sql> select username,account_status from dba_users;

username                 account_status

sys                      open

system                      open

dbsnmp                            open

scott                        open

outln                        expired & locked

wmsys                       expired & locked

olapsys                   expired & locked

hr                        expired & locked

oe                        expired & locked

pm                       expired & locked

sql> conn hr/hr

error:

ora-28000: the account is locked

warning: you are no longer connected to oracle.

已投稿到:  

圈子

Oracle 使用者加鎖與解鎖

檢視使用者狀態 以sysdba身份登入sqlplus sqlplus as sysdba 查詢指定使用者狀態 使用者名稱需要大寫 select username,account status from dba users where username abc 狀態顯示為open,表示使用者狀態正常。...

oracle中加鎖與解鎖

oracle中的資料在併發操作時,為了防止錯誤的發生可以進行記錄或者資料庫表的加鎖操作。當鎖操作完成時可以進行解鎖操作。資料庫中加鎖有兩種方式,獨佔模式和共享模式。1.獨佔模式,不允許其他會話以任何方式共享鎖定資源,當進行資料庫資料修改時可以使用這種模式。2.共享模式,允許在資料訪問時,併發共同訪問...

oracle資料庫使用者加鎖和解鎖

分類 database 2012 04 19 17 17 7506人閱讀收藏 舉報 資料庫oracle user sql oracle資料庫安裝好之後,scott之類的使用者預設情況下是被鎖住的,無法使用scott使用者登入資料庫。使用有alter user資料庫許可權的使用者登陸,角色選sysdb...