网上的案例太过于繁杂,有的模糊不清,缺乏一个清晰的流程,这里我就整理一下发出来便于各位查阅。
我这里均是在linux环境下操作!注意!!!!!!!
================================================================================================
解锁:
第一步:
首先你需要查看用户状态
链接dba用户
sqlplus / as sysdba;
select username,account_status from dba_users order by username;
如果有hr,就执行解锁
第二步:执行解锁并修改密码
alter user hr account unlock
SQL> conn hr/hr ERROR: ORA-28001: the password has expired
更改 hr 的口令
新口令: 重新键入新口令:
口令已更改 已连接。
========引申:
修改口令另一种方法:
alter user hr identified by 新密码;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
添加:
第一步:
查看是否已经有hr表,如果没有,执行下一步
第二步:先把hr_main.sql文件搞到oracle目录下
(网上很少有,大家可点击这里下载链接:https://pan.baidu.com/s/1y6uce4XBbXpKdOiHxq05Sw
提取码:e0jd)
具体目录:
/u01/app/oracle/product/11.2.0.4/db_1/demo/schema/human_resources
oracle11g用户下sqlplus下执行命令:
SQL>@?/demo/schema/human_resources/hr_main.sql
显示如下:
成功之后再执行
SQL>conn hr/hr;
显示如下即为成功
================================================================================
scott用户添加
第一步,先进入oracle11g用户,进入目录:
/u01/app/oracle/product/11.2.0.4/db_1/rdbms/admin
将scott.sql放入文件夹,scott文件在这里下载:
链接:https://pan.baidu.com/s/1lPSM2mIp34OQ3I0fcHlIKQ
提取码:cjzq
第二步:执行脚本,在oracle11g用户下,进入sql命令如下:
SQL>sqlplus / as sysdba;
sql下执行脚本:
SQL>@/u01/app/oracle/product/11.2.0.4/db_1/rdbms/admin/scott.sql;
此时可尝试链接,如果不行,则执行
SQL>alter user scott identified by tiger;
链接:
SQL> conn scott/tiger;