Environment: win7_64 bit, database version oracle11g_r2
In the cmd window, use the following three commands to connect to the database normally:
C:\users\administrator> Sqplus/nolog
C:\users\administrator> sqlplus Sys/[email protected] as SYSDBA;
Sql> conn Scott/[email protected];
However, use the following command to connect to the database to report a ora-12560 error:
C:\users\administrator>sqlplus/as Sysdba;
Workaround:
1. Check whether the operating system is certified
View the value of the parameter Sqlnet.authentication_services in the $oracle_home\network\admin\sqlnet.ora file as either NTS or all. The default installation allows the operating system to authenticate.
2. Verify that the Oracle_home key and its key values in the Windows registry are correct and valid.
For example: Hkey_local_machine\software\oracle\key_oradb10g_home1, find the Oracle_home key, the corresponding key value is D:\app\Administrator\product\ 11.2.0\dbhome_1
3. Note: Under Windows, do not set oracle_home and ORACLE_SID environment variables
After you have just installed the Oracle database library, the values of the above two variables have been written to the registry. So no further setup is required.
=========
Under CMD, when we knock Sqlplus, we actually call the Sqlplus.exe file under Oracle_home/bin in the registry.
If you execute the following command directly under this path, you can connect to the database normally.
D:\app\administrator\product\11.2.0\dbhome_1\bin>sqlplus/as Sysdba;
Sql*plus:release 11.2.0.1.0 Production on Friday January 2 18:29:42 2015
Copyright (c) 1982, Oracle. All rights reserved.
Connect to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit Production
With the partitioning, OLAP, Data Mining and Real application testing options
==================
4. Add D:\app\Administrator\product\11.2.0\dbhome_1\bin to the system environment variable path
This guarantees that the Sqlplut.exe file under the database server $oracle_home\bin directory is invoked every time the sqlplus is executed.
===============================
After installing the database, we do not need to set any environment variables, in fact, the environment variable path in the database software installation process has been added to the following bin directory, we enter sqlplus under CMD to call the Sqlplus.exe file in this directory. D:\app\Administrator\product\11.2.0\dbhome_1\bin;
If you delete this path, you will not be prompted to find this command when you enter Sqlplus under CMD.
=========
Reference files:
http://blog.csdn.net/msdnchina/article/details/38169095
The solution of Sqlplus/as SYSDBA newspaper ora-12560 under Windows