Linux环境oracle数据库重置sys用户密码

今天在使用研发环境oracle数据库时发现普通用户被锁定了,需要sys用户去解锁。结果悲催的是sys用户密码不知道。然后请教同事,总结以下便捷方式重置sys用户密码并解锁普通数据库用户。
1、首先要登录到oracle安装的linux服务器
     [email protected] temp>#su - oracle
    password:
    [email protected] temp>

2、查看oracle环境变量ORACLE_SID的设置情况linux:
  [email protected] temp>#echo $ORACLE_SID
                          [显示若为空需要先设置oracle环境变量ORACLE_SID]
  [email protected] temp>#export  ORACLE_SID=ORCL
  [email protected] temp>#echo $ORACLE_SID
  f1ebank
  [email protected] temp>
3、然后输入以下命令以sysdba身份登录到oracle  【此处因不知道sys用密码,所以以nolog 方式进入sqlplus环境】
----运行sqlplus命令,进入sqlplus环境。其中/nolog是不登陆到数据库服务器的意思,如果没有/nolog参  数,sqlplus会提示你输入用户名和密码.
    [email protected] temp>#sqlplus  /nolog
   connected to :
   oracle database 11g ****************************************************
  SQL>

4、以sys身份登录到oracle,重置sys用户密码
   SQL>sqlplus  /as sysdba
    SQL*Plus: Release **********************************
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>alter user sys identified by sys;

注意:windows 环境处理方式只是在第一步存在差异
 在安装oracle的服务器打开命令窗口   cmd --》命令窗口
查看oracle环境变量ORACLE_SID的设置情况:echo %ORACLE_SID%
设置ORACLE_SID : set ORACLE_SID=ORCL

Linux环境oracle数据库重置sys用户密码