oracle建立orapasswd,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]$

手动创建一个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 sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 15 08:26:25 2014

Copyright (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=gaojian

OPW-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):

[oracle@localhost admin]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 15 08:32:23 2014

Copyright (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 sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 15 08:34:24 2014

Copyright (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 sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 15 08:44:08 2014

Copyright (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 options

SQL> 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 sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 15 08:45:41 2014

Copyright (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的文件来对应。

[oracle@localhost dbs]$ orapwd file=orapworcl

Enter password for SYS:

[oracle@localhost dbs]$

输入的口令是刚才在数据库中设置的口令。

然后,再登陆看看:

此时,可以登陆成功了:

[oracle@localhost admin]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 15 08:47:58 2014

Copyright (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 options

SQL>

0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值