手动创建数据库实例全攻略5:密码文件
一、ORACLE密码文件说明
oracle的密码文件是oracle数据库中拥有管理权限的(即拥有sysdba或者sysoper权限的)的用户登陆oracle数据库的其中一种方式,即这些用户可以通过oracle的密码文件来登陆数据库。如何创建呢?下面就如何创建和管理ORACLE密码文件进行如下探讨。
1、密码文件创建
标准说法是使用orapwd来创建数据库密码文件,一般的命令格式如下:
[oracle@ocmserver ~]$ orapwd Usage: orapwd file= password=
entries= force=
where
file - name of password file (mand),
password - password for SYS (mand),
entries - maximum number of distinct DBA and force - whether to overwrite existing file (opt),
OPERs (opt),
There are no spaces around the equal-to (=) character.
举例如下:

[oracle@ocmserver dbs]$ orapwd file=ocpserver password=oracle force=y [oracle@ocmserver dbs]$ sqlplus sys/oracle as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jul 3 21:34:37 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options
SQL> show user;
USER is "SYS"
SQL>
2、设置远程登录密码文件
- REMOTE_LOGIN_ PASSWORDFILE
- SQLNET.AUTHENTICATION_SERVICES
remote_login_passwordfile可通过2中方法查看
1)show parameter remote_login_pa
2)grep remote_login_passwordfile init.ora
SQL> show parameter remote_login_pa
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile string EXCLUSIVE
SQL> ! grep 'remote_login_passwordfile' /opt/oracle/product/dbs/initocpserver.ora
remote_login_passwordfile=EXCLUSIVE
SQL>
那么修改当然就有了很多方法,直接修改参数文件并重启,或者alert system set remote_login_passwordfile='' scope='' sid=''
remote_login_passwordfile参数有如下选项
remote_login_passwordfile=none|shared|exclusive
NONE:指示Oracle系统不使用密码文件,特权用户的登录通过操作系统进行身份验证;
EXCLUSIVE:指示只有一个数据库实例可以使用此密码文件。只有在此设置下的密码文件可以包含有除INTERNAL/SYS以外的用户信息,即允许将系统权限SYSOPER/SYSDBA授予除INTERNAL/SYS以外的其他用户。
SHARED:指示可有多个数据库实例可以使用此密码文件。在此设置下只有INTERNAL/SYS帐号能被密码文件识别,即使文件中存有其他用户的信息,也不允许他们以SYSOPER/SYSDBA的权限登录。此设置为缺省值。
在REMOTE_LOGIN_PASSWORDFILE参数设置为EXCLUSIVE、SHARED情况下,Oracle系统搜索密码文件的次序为:在系统注册库中查找ORA_SID_PWFILE参数值(它为密码文件的全路径名);若未找到,则查找ORA_PWFILE参数值;若仍未找到,则使用缺省值ORACLE_HOMEDATABASEPWDSID.ORA;其中的SID代表相应的Oracle数据库系统标识符。
SQLNET.AUTHENTICATION_SERVICES参数在sqlnet.ora里面有说明:
http://www.cnblogs.com/alexy/p/sqlnet.html