首页 / 数据库 / MySQL / Oracle的sqlnet.ora与password文件试验
先看有没有sqlnet.ora
[Oracle@localhost ~]$ cd $ORACLE_HOME
[oracle@localhost dbhome_1]$ cd network
[oracle@localhost network]$ cd admin
[oracle@localhost admin]$ ls
listener.ora samples shrept.lst
[oracle@localhost admin]$VMware+Linux+Oracle 10G RAC全程详细图解 http://www.linuxidc.com/Linux/2011-02/31976.htm在CentOS 6.4下安装Oracle 11gR2(x64) http://www.linuxidc.com/Linux/2014-02/97374.htmOracle 11gR2 在VMWare虚拟机中安装步骤 http://www.linuxidc.com/Linux/2013-09/89579p2.htmDebian 下 安装 Oracle 11g XE R2 http://www.linuxidc.com/Linux/2014-03/98881.htmOracle 11gR2 在VMWare虚拟机中安装步骤 http://www.linuxidc.com/Linux/2013-09/89579.htm手动创建一个sqlnet.ora文件
[oracle@localhost admin]$ touch sqlnet.ora
[oracle@localhost admin]$ vim sqlnet.ora
[oracle@localhost admin]$ cat sqlnet.ora
SQLNET.AUTHENTICATION_SERVICES=(none);
[oracle@localhost admin]$
试验登陆情况:
[oracle@localhost admin]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 15 08:26:25 2014Copyright (c) 1982, 2013, Oracle. All rights reserved.ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name: *********************************
查看口令文件情况:
[oracle@localhost dbs]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[oracle@localhost dbs]$ ls
hc_orcl.dat init.ora initorcl.ora lkORCL orapworcl spfileorcl.ora
[oracle@localhost dbs]$ 现在执行口令文件处理:
用老的口令文件改口令不被允许:
[oracle@localhost dbs]$ orapwd file=orapworcl password=gaojianOPW-00005: File with same name exists - please delete or renam
只好再作一个新的:
[oracle@localhost dbs]$ orapwd file=orapwgaojian password=gaojian
[oracle@localhost dbs]$ ls
hc_orcl.dat initorcl.ora orapwgaojian spfileorcl.ora
init.ora lkORCL orapworcl
[oracle@localhost dbs]$ 用刚刚作好的口令,还是不行(因为它和oracle中的sys口令不一致,是我随便设的,所以不行,其实登陆到哪个实例,就会用哪个口令文件--orapw<SID>):
[oracle@localhost admin]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 15 08:32:23 2014Copyright (c) 1982, 2013, Oracle. All rights reserved.ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name: sys as sysdba
Enter password:
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name: sys
Enter password:
ERROR:
ORA-01017: invalid username/password; logon denied
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
[oracle@localhost admin]$ *******************************
考虑删除orapworcl (这个操作实际上有一定的危险性):
[oracle@localhost dbs]$ rm orapworcl
[oracle@localhost dbs]$ 一样也是登陆不进去:
[oracle@localhost admin]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 15 08:34:24 2014Copyright (c) 1982, 2013, Oracle. All rights reserved.ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name: sys as sysdba
Enter password:
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name: sys
Enter password:
ERROR:
ORA-01017: invalid username/password; logon denied
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
[oracle@localhost admin]$*******************************
把sqlnet.ora中的 SQLNET.AUTHENTICATION_SERVICES=(none); 注释掉,再试验:
[oracle@localhost admin]$ cat sqlnet.ora
#SQLNET.AUTHENTICATION_SERVICES=(none);
[oracle@localhost admin]$ [oracle@localhost dbs]$ strings orapwgaojian
][Z
ORACLE Remote Password file
INTERNAL
FE406C76B620912C
861BAF16E111B672
[oracle@localhost dbs]$ 登陆到数据库中,来更改口令:
[oracle@localhost admin]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 15 08:44:08 2014Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> alter user sys identified by oracle;User altered.SQL>exit
[oracle@localhost dbs]$ strings orapwgaojian
][Z
ORACLE Remote Password file
INTERNAL
FE406C76B620912C
861BAF16E111B672
[oracle@localhost dbs]$口令文件似乎无变化。
还是登陆不进去:
[oracle@localhost admin]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 15 08:45:41 2014Copyright (c) 1982, 2013, Oracle. All rights reserved.ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name: sys as sysdba
Enter password:
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name:*******************************
看来还得用orapw<SID>的文件来对应。
[oracle@localhost dbs]$ orapwd file=orapworclEnter password for SYS:
[oracle@localhost dbs]$
输入的口令是刚才在数据库中设置的口令。
然后,再登陆看看:
此时,可以登陆成功了:
[oracle@localhost admin]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 15 08:47:58 2014Copyright (c) 1982, 2013, Oracle. All rights reserved.ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name: sys as sysdba
Enter password:Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL>更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12本文永久更新链接地址