首页 文章

如何使用SQL Developer或Apex连接Oracle

提问于
浏览
1

我通过查看reference links在Ubuntu 14.04上安装了Oracle 11g . 安装时,我没有看到任何创建用户名和密码的步骤

之后,我配置如下

$# sudo /etc/init.d/oracle-xe configure
Oracle Database 11g Express Edition Configuration

This will configure on-boot properties of Oracle Database 11g Express Edition.  The following questions will determine whether the database should be starting upon system boot, the ports it will use, and the passwords that will be used for database accounts.  Press <Enter> to accept the defaults.
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:8080

Specify a port that will be used for the database listener [1521]:1522

Specify a password to be used for database accounts.  Note that the same password will be used for SYS and SYSTEM.  Oracle recommends the use of different passwords for each database account.  This can be done after initial configuration:
Confirm the password:

Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y

Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.
  • 我尝试使用http://localhost:8080/apex/f?p=4950 ==>无法连接登录到顶点 . Firefox无法在localhost:8080 Build 与服务器的连接 .

  • 我尝试使用SQL Developer进行连接

SQL Developer

Error: Status : Failure -Test failed: Listener refused the connection with the following error:ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

更多信息:

$ lsnrctl状态

rgm@Motown:~$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 25-JUL-2015 08:49:19

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE))) STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                23-JUL-2015 17:21:04
Uptime                    1 days 15 hr. 28 min. 14 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/Motown/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Motown)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

listener.ora文件

# listener.ora Network Configuration File:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/xe)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
      (ADDRESS = (PROTOCOL = TCP)(HOST = Motown)(PORT = 1521))
    )
  )

DEFAULT_SERVICE_LISTENER = (XE)

使用SYSTEM登录SqlPlus

rgm@Motown:~$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Sat Jul 25 09:00:29 2015

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

ERROR:
ORA-01031: insufficient privileges


Enter user-name: SYSTEM
Enter password:
ERROR:
ORA-01033: ORACLE initialization or shutdown in progress
Process ID: 0
Session ID: 0 Serial number: 0


Enter user-name: oracle
Enter password:
ERROR:
ORA-01033: ORACLE initialization or shutdown in progress
Process ID: 0
Session ID: 0 Serial number: 0


SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

使用oracle登录SqlPlus(su到oracle用户)

rgm@Motown:~$ su oracle
Password:
oracle@Motown:/home/rgm$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Sat Jul 25 09:02:19 2015

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


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL>
SQL>

请帮我修复使用Apex和SQL Developer登录SQL的问题 .

谢谢

2 回答

  • 1

    你的SQL Developer截图,你没有使用tnsnames.ora - 这很好 .

    如何使用服务名称= XE,而不是SID . 和localhost到Motown .

    在此之前 - 转到命令,看看是否可以调整Motown .

    c:\ tnsping motown

    你应该在最后一行的某个地方看到OK . 我假设您已经安装了Oracle客户端工具

  • 0

    在安装日志中,它显示的是1522的端口,而不是默认的1521 .

    Specify a port that will be used for the database listener [1521]:1522
    

    在您的SQL Developer屏幕截图中,您显示了一个使用默认值1521的连接对话框 . 至少获取正确的端口号将使您靠近,如果不能解决它 .

相关问题