1、如果密碼文件不存在,則重創建密碼文件:
oracle@linux-254:~/product/11gR1/db> orapwd file=/opt/oracle/product/11gR1/db/dbs/orapweconf force=y password=oracle
密碼文件命名最好是以:orapwORACLE_SID的形式命令
force=y爲覆蓋的意思
password=oracle就是你實際登錄密碼了。
2、如果密碼文件存在,也可以使用上一步進行覆蓋,因爲有時這個密碼文件會被損壞
oracle@linux-254:~/product/11gR1/db> sqlplus /nolog
SQL*Plus: Release 11.1.0.7.0 - Production on Thu Oct 20 17:14:36 2011
Copyright (c) 1982, 2008, Oracle. All rights reserved.
SQL> connect sys as sysdba
Enter password:
Connected.
SQL> grant sysdba to sys;
Grant succeeded.
SQL> select * from v$pwfile_users;
USERNAME
--------------------------------------------------------------------------------
SYSDBA SYSOPER SYSASM
--------------- --------------- ---------------
SYS
TRUE TRUE FALSE
這樣之後就可以使用PL/SQL工具以SYSDBA權限登錄數據庫了。