[oracle@jumper oracle]$ sqlplus "/ as sysdba"SQL*Plus: Release 9.2.0.3.0 - PRodUCtion on Thu Apr 15 09:58:45 2004Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.Connected to:Oracle9i Enterprise Edition Release 9.2.0.3.0 - ProductionWith the Partitioning, OLAP and Oracle Data Mining optionsJServer Release 9.2.0.3.0 - ProductionSQL> alter user sys identified by oracle;User altered.SQL> show parameter passNAME TYPE VALUE--------------------- ----------- ------------------------------remote_login_passwordfile string NONEremote:
E:/Oracle/ora92/bin>sqlplus /nolog此处实际上是无法通过口令文件验证2.remote_login_passwordfile = exclusive
SQL*Plus: Release 9.2.0.4.0 - Production on 星期四 4月 15 09:39:22 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect sys/oracle@hsjf as sysdba
ERROR:
ORA-01017: invalid username/password; logon denied
SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;System altered.SQL> startup force;ORACLE instance started.Total System Global Area 131142648 bytesFixed Size 451576 bytesVariable Size 104857600 bytesDatabase Buffers 25165824 bytesRedo Buffers 667648 bytesDatabase mounted.Database opened.SQL> show parameter passNAME TYPE VALUE------------------------------------ ----------- ------------------------------remote_login_passwordfile string EXCLUSIVESQL> alter user sys identified by oracle;User altered.remote:
E:/Oracle/ora92/bin>sqlplus /nolog这实际上就是通过口令文件验证登录的
SQL*Plus: Release 9.2.0.4.0 - Production on 星期四 4月 15 09:47:11 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect sys/oracle@hsjf as sysdba
已连接。
SQL> show user
USER 为"SYS"
SQL>
SQL> !
[oracle@jumper oracle]$ cd $ORACLE_HOME/dbs
[oracle@jumper dbs]$ ls orapwhsjf
orapwhsjf
[oracle@jumper dbs]$ mv orapwhsjf orapwhsjf.bak
[oracle@jumper dbs]$
E:/Oracle/ora92/bin>sqlplus /nolog
SQL*Plus: Release 9.2.0.4.0 - Production on 星期四 4月 15 09:50:14 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect sys/oracle@hsjf as sysdba
ERROR:
ORA-01031: insufficient privileges
SQL>
SQL> startup force;
ORACLE instance started.
Total System Global Area 131142648 bytes
Fixed Size 451576 bytes
Variable Size 104857600 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
ORA-01990: error opening password file '/opt/oracle/product/9.2.0/dbs/orapw'
ORA-27037: unable to oBTain file status
linux Error: 2: No such file or Directory
Additional information: 3
SQL> !
[oracle@jumper oracle]$ mv $ORACLE_HOME/dbs/orapwhsjf.bak orapwhsjf
[oracle@jumper oracle]$ exit
exit
SQL> alter database open;
Database altered.
SQL>
SQL> select * from v$pwfile_users;USERNAME SYSDB SYSOP我们看到,此时的口令文件中是不能添加用户的.很多人的疑问在于:口令文件的缺省名称是orapw<sid>,怎么能够共享? 实际上是这样的: Oracle数据库在启动时,首先查找的是orapw<sid>的口令文件,假如该文件不存在,则开始查找,orapw的口令文件
------------------------------ ----- -----
SYS TRUE TRUESQL> grant sysdba to eygle;
grant sysdba to eygle
*
ERROR at line 1:
ORA-01994: GRANT failed: cannot add users to public password file
SQL> show parameter passwordNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile string SHARED
[oracle@jumper dbs]$ sqlplus "/ as sysdba"SQL*Plus: Release 9.2.0.3.0 - Production on Tue Jul 6 09:40:34 2004Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.Connected to:Oracle9i Enterprise Edition Release 9.2.0.3.0 - ProductionWith the Partitioning, OLAP and Oracle Data Mining optionsJServer Release 9.2.0.3.0 - ProductionSQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL> ![oracle@jumper dbs]$ lshsjf initdw.ora inithsjf.ora init.ora lkHSJF orapwhsjf spfilehsjf.ora[oracle@jumper dbs]$ mv orapwhsjf orapwhsjf.bak[oracle@jumper dbs]$ exitexitSQL> startupORACLE instance started.Total System Global Area 235999908 bytesFixed Size 451236 bytesVariable Size 201326592 bytesDatabase Buffers 33554432 bytesRedo Buffers 667648 bytesORA-01990: error opening password file '/opt/oracle/product/9.2.0/dbs/orapw'--这是最后查找的文件ORA-27037: unable to obtain file statusLinux Error: 2: No such file or directoryAdditional information: 3我们建立orapw口令文件,这时候可以打开数据库.
SQL> ![oracle@jumper dbs]$ lshsjf initdw.ora inithsjf.ora init.ora lkHSJF orapwhsjf.bak spfilehsjf.ora[oracle@jumper dbs]$ cp orapwhsjf.bak orapw[oracle@jumper dbs]$ exitexitSQL> alter database open;Database altered.SQL> show parameter passwNAME TYPE VALUE------------------------------------ ----------- ------------------------------remote_login_passwordfile string SHAREDSQL>那么你可能会有这样的疑问,多个Exclusive的数据库是否可以共享一个口令文件(orapw)呢?我们继续这个实验:
SQL> show parameter passwordNAME TYPE VALUE注重这里仅记录着INTERNAL/SYS的口令REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE 时
------------------------------------ ----------- ------------------------------
remote_login_passwordfile string SHARED
[oracle@jumper dbs]$ strings orapw
]/[Z
ORACLE Remote Password file
INTERNAL
AB27B53EDC5FEF41
8A8F025737A9097A
SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;System altered.SQL> startup force;注重这里,以EXCLUSIVE 方式启动以后,实例名称信息被写入口令文件.此时假如有其他实例以Exclusive模式启动仍然可以使用这个口令文件,口令文件中的实例名称同时被改写.也就是说,数据库只在启动过程中才读取口令文件,数据库运行过程中并不锁定该文件,类似于pfile/spfile文件.
ORACLE instance started.Total System Global Area 235999908 bytes
Fixed Size 451236 bytes
Variable Size 201326592 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> !
[oracle@jumper bin]$ cd $ORACLE_HOME/dbs
[oracle@jumper dbs]$ strings orapw
]/[Z
ORACLE Remote Password file
HSJF
INTERNAL
AB27B53EDC5FEF41
8A8F025737A9097A
[oracle@jumper dbs]$ exit
exit
SQL> select * from v$pwfile_users;USERNAME SYSDB SYSOP
------------------------------ ----- -----
SYS TRUE TRUESQL> grant sysdba to eygle;Grant succeeded.SQL> select * from v$pwfile_users;USERNAME SYSDB SYSOP
------------------------------ ----- -----
SYS TRUE TRUE
EYGLE TRUE FALSESQL> !
[oracle@jumper bin]$ cd $ORACLE_HOME/dbs
[oracle@jumper dbs]$ strings orapw
]/[Z
ORACLE Remote Password file
HSJF
INTERNAL
AB27B53EDC5FEF41
8A8F025737A9097A
>EYGLE
B726E09FE21F8E83
[oracle@jumper oracle]$ orapwd
Usage: orapwd file=<fname> password=<password> entries=<users> where
file - name of password file (mand),
password - password for SYS (mand),
entries - maximum number of distinct DBA and OPERs (opt),
There are no spaces around the equal-to (=) character.
新闻热点
疑难解答