Oracle-11g-R2

連接到一個空閒實例;創建數據庫時遇到問題

  • July 3, 2019

我試圖連接到我的數據庫並得到Connected to an idle instance

C:\>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Mon Sep 22 19:07:34 2014
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> select status, database_status from v$instance;
select status, database_status from v$instance
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

此外,無法找到入門頁面Error code: ERR_CONNECTION_REFUSEDhttp://127.0.0.1:8080/apex/f?p=4950

我做了什麼來嘗試解決這個問題

在各種論壇中探勘時,我發現也許我需要initXE.ora在啟動時指定文件:

SQL> startup pfile='C:\oraclexe\app\oracle\product\11.2.0\server\database\initXE.ora'
ORA-01565: error in identifying file 'C:\oraclexe\app\oracle\product\11.2.0\server\dbs/spfileXE.ora'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.
ORA-01078: failure in processing system parameters

沒有這樣spfileXE.ora的文件。好的,那麼創建它?

SQL> create spfile='C:\oraclexe\app\oracle\product\11.2.0\server\dbs\spfileXE.ora' from pfile='C:\oraclexe\app\oracle\product\11.2.0\server\dbs\init.ora';
File created.
SQL> startup pfile='C:\oraclexe\app\oracle\product\11.2.0\server\database\initXE.ora'
ORA-48108: invalid value given for the diagnostic_dest init.ora parameter
ORA-48140: the specified ADR Base directory does not exist [C:\oraclexe\app\oracle\product\11.2.0\server\DATABASE\<ORACLE_BASE>]
ORA-48187: specified directory does not exist
OSD-00002: additional error information
O/S-Error: (OS 123) The filename, directory name, or volume label syntax is incorrect.
SQL>

好吧,我想我沒有 ADR Base 目錄..

C:\oraclexe\app\oracle\product\11.2.0\server\database>dir
Volume in drive C is Windows
Volume Serial Number is 8822-A545
Directory of C:\oraclexe\app\oracle\product\11.2.0\server\database
22/09/2014  06:06 PM    <DIR>          .
22/09/2014  06:06 PM    <DIR>          ..
22/09/2014  06:06 PM             2,048 hc_xe.dat
22/09/2014  02:44 PM                73 initXE.ora
27/08/2011  09:58 AM            31,744 oradba.exe
22/09/2014  05:07 PM             2,265 oradim.log
              4 File(s)         36,130 bytes
              2 Dir(s)  298,041,913,344 bytes free

我在下面列出了我知道的盡可能多的支持資訊。

環境

  • Windows 7 企業版,SP1,64 位。
  • 適用於 Windows x32 的 Oracle 數據庫快捷版 11g 第 2 版

我設置了這些環境變數:

echo %ORACLE_SID% - %ORACLE_HOME%
XE - C:\oraclexe\app\oracle\product\11.2.0\server

安裝設置

這些是安裝程序使用的安裝設置:

Destination Folder: C:\oraclexe\
Oracle Home: C:\oraclexe\app\oracle\product\11.2.0\server\
Oracle Base:C:\oraclexe\
Port for 'Oracle Database Listener': 1521
Port for 'Oracle Services for Microsoft Transaction Server': 2030
Port for 'Oracle HTTP Listener': 8080

來自 lsnrctl stat 的輸出

一些可能有用的調試資訊:

C:\oraclexe\app\oracle\product\11.2.0\server\bin>lsnrctl stat
LSNRCTL for 32-bit Windows: Version 11.2.0.2.0 - Production on 22-SEP-2014 19:05:52
Copyright (c) 1991, 2010, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 32-bit Windows: Version 11.2.0.2.0 - Production
Start Date                22-SEP-2014 17:07:02
Uptime                    0 days 1 hr. 58 min. 49 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   C:\oraclexe\app\oracle\product\11.2.0\server\network\admin\listener.ora
Listener Log File         C:\oraclexe\app\oracle\diag\tnslsnr\ITS57151\listener\alert\log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myhost.mycompany.local)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
 Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
 Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
C:\oraclexe\app\oracle\product\11.2.0\server\bin>

各種配置文件

以下是其他重要文件的內容。

initXE.ora 文件 -C:\oraclexe\app\oracle\product\11.2.0\server\database\initXE.ora

SPFILE='C:\oraclexe\app\oracle\product\11.2.0\server\dbs/spfileXE.ora'

listener.ora 文件 -C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\listener.ora

SID_LIST_LISTENER =
 (SID_LIST =
   (SID_DESC =
     (SID_NAME = PLSExtProc)
     (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
     (PROGRAM = extproc)
   )
   (SID_DESC =
     (SID_NAME = CLRExtProc)
     (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
     (PROGRAM = extproc)
   )
 )
LISTENER =
 (DESCRIPTION_LIST =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
     (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.mycompany.local)(PORT = 1521))
   )
 )
DEFAULT_SERVICE_LISTENER = (XE)

tnsnames.ora 文件 -C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\tnsnames.ora

XE =
 (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.mycompany.local)(PORT = 1521))
   (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SERVICE_NAME = XE)
   )
 )
EXTPROC_CONNECTION_DATA =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
   )
   (CONNECT_DATA =
     (SID = PLSExtProc)
     (PRESENTATION = RO)
   )
 )
ORACLR_CONNECTION_DATA =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
   )
   (CONNECT_DATA =
     (SID = CLRExtProc)
     (PRESENTATION = RO)
   )
 )
  1. 解除安裝Oracle Database Express Edition 11g Release 2 for Windows x32
  2. 下載並安裝Oracle Database Express Edition 11g Release 2 for Windows x64- 64 位安裝程序。
  3. 花一些時間來減壓。:)

引用自:https://dba.stackexchange.com/questions/77243