標籤:
本人忘性太大,竟然將ORACLE的Sys使用者和system使用者密碼搞忘,而且多次嘗試登入system後,造成system被鎖定。
經過一番嘗試,終於解決。過程如下:
首先,重建sys密碼檔案。重建方式為:
1、開啟cmd命令視窗;
2、執行orapwd命令,其用法為:
C:\WINDOWS\system32>orapwd Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n> where file - name of password file (required), password - password for SYS will be prompted if not specified at command line, entries - maximum number of distinct DBA (optional), force - whether to overwrite existing file (optional), ignorecase - passwords are case-insensitive (optional), nosysdba - whether to shut out the SYSDBA logon (optional Database Vault only). |
file選項為檔案全路徑,檔案名稱為PWD+資料庫執行個體名+“.ora”。password為新設定的密碼。
我執行的命令格式如下:
| C:\WINDOWS\system32>orapwd file=D:\Oracle\product\11.2.0\dbhome_1\database\PWD****.ora password=****** entries=5 force=y |
(注意,執行重建密碼檔案命令之前,最好將原來的檔案備份一下)
執行命令後,新的密碼檔案會覆蓋原有的密碼檔案。
重啟ORACLE資料庫服務後,就可以用新的密碼登入SYS了。
下一步解決system使用者鎖定問題。
在CMD命令視窗中,用sqlplus串連資料庫。
| C:\Documents and Settings\Administrator>sqlplus sys/***** as sysdba |
其中**部分為登入密碼。
然後執行命令,將system解鎖。
| SQL>alter user system account unlock; |
最後修改system使用者的密碼。
| SQL>alter user system identified by **********; |
其中***部分為新的密碼。
至此system已被解鎖且可採用新的密碼登入。
原文連結:http://www.lhtry.net/Blog/Detail?id=19
ORACLE資料庫忘記SYS和SYSTEM密碼,SYSTEM被鎖定怎麼辦?