日期:2014-05-16  浏览次数:20572 次

密码文件的恢复 || EM登录失败的解决

1,密码文件默认位置是:/u01/oracle/product/10.2.0/db_1/dbs/orapwSID

如果密码文件被损坏,则无法远程登录,em无法登录,会出现,“username or password invalid”的错误。

2,这时可以重新创建密码文件:

cd /u01/oracle/product/10.2.0/db_1/dbs

orapwd file=orapwdv11 password=oracle entries=5 force=y

3,查看密码文件:

SQL> select * from v$pwfile_users;

USERNAME         SYSDB SYSOP
------------------------------ ----- -----
SYS          TRUE  TRUE

 

[oracle@redhat dbs]$ strings orapwdv11
]\[Z
ORACLE Remote Password file
INTERNAL
AB27B53EDC5FEF41
8A8F025737A9097A
SYSTEM
2D594E86F93B17A1
4,对system赋sysoper权限,则system的信息就会被写入密码文件:

SQL> grant sysoper to system;

Grant succeeded.

SQL> select * from v$pwfile_users;

USERNAME         SYSDB SYSOP
------------------------------ ----- -----
SYS          TRUE  TRUE
SYSTEM          FALSE TRUE

5,sys与sysoper权限的不同之处:

SQL> select * from system_privilege_map where name like '%SYS%';

 PRIVILEGE NAME           PROPERTY
---------- ---------------------------------------- ----------
 -3 ALTER SYSTEM          0
 -4 AUDIT SYSTEM          0
       -83 SYSDBA          0
       -84 SYSOPER          0

 

    When you connect with SYSDBA or SYSOPER privileges, you connect with a default schema,

    not with the schema that is generally associated with your username.

    For SYSDBA this schema is SYS; for SYSOPER the schema is PUBLIC


 

   SQL> conn / as sysdba

   SQL> show user

    USER is "SYS"

    SQL> conn / as sysoper

    Connected.

    SQL> show user

    USER is "PUBLIC"

6,密码认证类型:

SQL> show parameter remote_login_passwordfile

NAME         TYPE  VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile      string  EXCLUSIVE

 

       remote_login_passwordfile = none | exclusive |shared  位于$ORACLE_HOME/dbs/spfile$ORACLE_SID.ora参数文件中

       none : 不使用密码文件认证

       exclusive :要密码文件认证,自己独占使用(默认值)

       shared :要密码文件认证,不同实例dba用户可以共享密码文件

 

-------------------------------------------------------------------

useful scripts:

alter user system identified by oracle;

alter user scott account unlock;

grant sysdba to system;

show parameter pfile

show parameter spfile

show parameter remote_login_password