conn system/system
已连接。
1.2查看表结构
desc dba_users
名称 是否为空? 类型
----------------------------------------- -------- ----------------------------
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)
select username,account_status from dba_users order by username;
USERNAME ACCOUNT_STATUS
------------------------------------------------------------ ----------------------------------------------------------------
ANONYMOUS OPEN
CTXSYS EXPIRED & LOCKED
DBSNMP EXPIRED & LOCKED
DIP EXPIRED & LOCKED
FLOWS_020100 EXPIRED & LOCKED
FLOWS_FILES EXPIRED & LOCKED
**HR EXPIRED**
MDSYS EXPIRED & LOCKED
OUTLN EXPIRED & LOCKED
SYS OPEN
SYSTEM OPEN
USERNAME ACCOUNT_STATUS
------------------------------------------------------------ ----------------------------------------------------------------
TSMSYS EXPIRED & LOCKED
XDB EXPIRED & LOCKED
1.4 为hr用户解锁并改密码
alter user hr account unlock sql> conn hr/hr ERROR: ORA-28001: the password has expired 更改 hr 的口令 新口令: 重新键入新口令: 口令已更改 已连接。
注意:还有一种更改口令的方法
alter user hr identified by 新密码;
conn sys/sys as sysdba
按照oracle的目录D:\oralce\app\oracle\product\10.2.0\server\RDBMS\ADMIN中(以我的这个目录为例)找到scott.sql的这个文件。
以上是我的scott.sql的路径。
2.3运行一下语句
@D:\oralce\app\oracle\product\10.2.0\server\RDBMS\ADMIN\scott.sql
这样scott用户就被添加进来,默认密码是tiger
sql>conn scott/tiger 连接成功
sql>SHOW USER;
USER为“SCOTT”