ORA-12162: TNS:net service name is incorrectly specified


点击(此处)折叠或打开

  1. [oracle@e1 ~]$ sqlplus / as sysdba

  2. SQL*Plus: Release 11.2.0.3.0 Production on Fri Oct 24 14:25:44 2014

  3. Copyright (c) 1982, 2011, Oracle. All rights reserved.

  4. ERROR:
  5. ORA-12162: TNS:net service name is incorrectly specified


  6. Enter user-name:
  7. ERROR:
  8. ORA-12162: TNS:net service name is incorrectly specified


  9. Enter user-name:
  10. ERROR:
  11. ORA-12162: TNS:net service name is incorrectly specified


  12. SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
  13. [oracle@e1 ~]$


这个错误是因为ORACLE_SID变量没有传进去造成的。
把ORACLE_SID变量赋值,登录数据库。

点击(此处)折叠或打开

  1. [oracle@e1 ~]$ echo $ORACLE_SID


    [oracle@e1 ~]$ 
    [
    oracle@e1 ~]$ export ORACLE_SID=P1
  2. [oracle@e1 ~]$ echo $ORACLE_SID
  3. P1
  4. [oracle@e1 ~]$ sqlplus / as sysdba

  5. SQL*Plus: Release 11.2.0.3.0 Production on Fri Oct 24 14:28:13 2014

  6. Copyright (c) 1982, 2011, Oracle. All rights reserved.

  7. Connected to an idle instance.

  8. SYS@P1>startup
  9. ORACLE instance started.

  10. Total System Global Area 920678400 bytes
  11. Fixed Size 1348720 bytes
  12. Variable Size 549456784 bytes
  13. Database Buffers 364904448 bytes
  14. Redo Buffers 4968448 bytes
  15. Database mounted.
  16. Database opened.
  17. SYS@P1>


请使用浏览器的分享功能分享到微信等