Oracle XE 11g 找不到XE数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34907026/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 03:08:17  来源:igfitidea点击:

Oracle XE 11g the XE database was not found

databaseoracleoracle11gwindows-7-x64

提问by Michael

I am a new one who started to use Oracle Database and faced the problem during installation the last verstion of Oracle XE 11gx64 to the Microsoft Windows 7 x64 Enterprise.

我是一个刚开始使用 Oracle 数据库的新手,Oracle XE 11g在将 x64的最后一个版本安装到 Microsoft Windows 7 x64 Enterprise 时遇到了这个问题。

During installation were not any errors and Windows Services (OracleXETNSListenerand OracleServiceXE) were successfully created and started. Winservices screen

在安装过程中没有任何错误,Windows 服务(OracleXETNSListenerOracleServiceXE)已成功创建并启动。 Winservices 屏幕

However, when I try to get the list of available databases I receive an error

但是,当我尝试获取可用数据库列表时收到错误

ORA-01034: ORACLE not available

ORA-01034: ORACLE 不可用

ORA-01034: ORACLE not available

ORA-01034: ORACLE 不可用

For some reason the XE database was not createdinto %ORACLE_BASE%\oradata\XE. enter image description here

由于某种原因,XE 数据库没有被创建%ORACLE_BASE%\oradata\XE. 在此处输入图片说明

The content of my listener.ora with localhost:

我的 listener.ora 与 localhost 的内容:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product.2.0\server)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product.2.0\server)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
    )
  )

DEFAULT_SERVICE_LISTENER = (XE)

I fixed tnsnames.ora by setting localhost IP address:

我通过设置 localhost IP 地址修复了 tnsnames.ora:

XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(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) 
    ) 
  ) 

sqlnet.ora contains both services:

sqlnet.ora 包含两个服务:

SQLNET.AUTHENTICATION_SERVICES = (NONE;NTS)

The log file from '%ORACLE_HOME%\server\log\myhost\client' contains this error:

来自“%ORACLE_HOME%\server\log\myhost\client”的日志文件包含以下错误:

Oracle Database 11g Clusterware Release 11.2.0.2.0 - Production Copyright 1996, 2010 Oracle. All rights reserved. 2016-01-20 19:51:43.920: [ default][5096]ut_read_reg:2:ocr registry key SOFTWARE\Oracle\olr cannot be opened. error 2 [
CLSE][5096]clse_get_crs_home: Error retrieving OLR configuration [0] [Error opening olr registry key. Не удается найти указанный файл. ]

Oracle 数据库 11g 集群件 11.2.0.2.0 版 - 生产 版权所有 1996、2010 Oracle。版权所有。2016-01-20 19:51:43.920: [ default][5096]ut_read_reg:2:ocr 注册表项 SOFTWARE\Oracle\olr 无法打开。错误 2 [
CLSE][5096]clse_get_crs_home:检索 OLR 配置时出错 [0] [打开 olr 注册表项时出错。Не удается найти указанный файл。]

How can I find what goes wrong and fix the problem?

如何找出问题所在并解决问题?

采纳答案by Michael

After struggling with this problem for almost a week I found a solution, how to make XE database available from this source. It is in Russian, I provide the solution right here in English.

在为这个问题苦苦挣扎了将近一个星期后,我找到了一个解决方案,即如何从此源中提供 XE 数据库。它是俄语的,我在这里用英语提供解决方案。

  1. Install the last version of Oracle XE 11gR2 from the Oracle site to the default location c:\oraclexewith default password admin. If not default, then you should edit scripts below (paths and pwd) before use them.

  2. Run cmdcommand line under administrator privileges and use it until the end of reconfiguration. First of all, set environment variables for your DB:

    set ORACLE_SID=XE
    set ORACLE_BASE=c:\oraclexe\app\oracle 
    set ORACLE_HOME=c:\oraclexe\app\oracle\product.2.0\server
    
  3. Delete the XE database by command:

    oradim -delete -sid XE
    
  4. Delete PWDXE.ORA file:

    del %ORACLE_HOME%\database\PWDXE.ORA
    
  5. Copy init.orafrom %ORACLE_HOME%\config\scriptsto %ORACLE_HOME%\database, instead of existing, rename it to initXE.oraand add the configuration below:

    open_cursors=300
    db_name=XE
    control_files=("C:\oraclexe\app\oracle\oradata\XE\control.dbf")
    job_queue_processes=4
    compatible=11.2.0.0.0
    diagnostic_dest=C:\oraclexe\app\oracle\.
    memory_target=1G
    sessions=100
    audit_file_dest=C:\oraclexe\app\oracle\admin\XE\adump
    remote_login_passwordfile=EXCLUSIVE
    dispatchers="(PROTOCOL=TCP) (SERVICE=XEXDB)"
    shared_servers=4
    undo_management=AUTO
    undo_tablespace=UNDOTBS1
    DB_RECOVERY_FILE_DEST_SIZE = 10G
    DB_RECOVERY_FILE_DEST=C:\oraclexe\app\oracle\fast_recovery_area
    #optional
    nls_language="RUSSIAN"
    nls_territory="RUSSIA"
    
  6. From the previous cmdline with admin previleges run the command to create Oracle services and file %ORACLE_HOME%\database\PWDXE.ORA:

    oradim -new -sid %ORACLE_SID% -intpwd admin -startmode auto -srvcstart system
    
  7. Run commands below to stop Windows Oracle XE services, delete them and additional XE files:

    sqlplus /nolog
    connect sys/admin as sysdba;
    shutdown immediate;
    exit;
    del %ORACLE_BASE%\oradata\XE\CONTROL.DBF
    del %ORACLE_BASE%\fast_recovery_area\XE\ONLINELOG\*.LOG
    
  8. Create two files into one directory:

  1. c:\oraclexe使用默认密码admin从 Oracle 站点将最新版本的 Oracle XE 11gR2 安装到默认位置。如果不是默认值,那么您应该在使用它们之前编辑下面的脚本(路径和密码)。

  2. 在管理员权限下运行cmd命令行并使用它直到重新配置结束。首先,为您的数据库设置环境变量:

    set ORACLE_SID=XE
    set ORACLE_BASE=c:\oraclexe\app\oracle 
    set ORACLE_HOME=c:\oraclexe\app\oracle\product.2.0\server
    
  3. 通过命令删除XE数据库:

    oradim -delete -sid XE
    
  4. 删除PWDXE.ORA file

    del %ORACLE_HOME%\database\PWDXE.ORA
    
  5. init.ora从复制%ORACLE_HOME%\config\scripts%ORACLE_HOME%\database,而不是现有,将其重命名为initXE.ora并添加以下配置:

    open_cursors=300
    db_name=XE
    control_files=("C:\oraclexe\app\oracle\oradata\XE\control.dbf")
    job_queue_processes=4
    compatible=11.2.0.0.0
    diagnostic_dest=C:\oraclexe\app\oracle\.
    memory_target=1G
    sessions=100
    audit_file_dest=C:\oraclexe\app\oracle\admin\XE\adump
    remote_login_passwordfile=EXCLUSIVE
    dispatchers="(PROTOCOL=TCP) (SERVICE=XEXDB)"
    shared_servers=4
    undo_management=AUTO
    undo_tablespace=UNDOTBS1
    DB_RECOVERY_FILE_DEST_SIZE = 10G
    DB_RECOVERY_FILE_DEST=C:\oraclexe\app\oracle\fast_recovery_area
    #optional
    nls_language="RUSSIAN"
    nls_territory="RUSSIA"
    
  6. 从前面带有 admin 特权的cmd行运行命令以创建 Oracle 服务和文件%ORACLE_HOME%\database\PWDXE.ORA

    oradim -new -sid %ORACLE_SID% -intpwd admin -startmode auto -srvcstart system
    
  7. 运行以下命令停止 Windows Oracle XE 服务,删除它们和其他 XE 文件:

    sqlplus /nolog
    connect sys/admin as sysdba;
    shutdown immediate;
    exit;
    del %ORACLE_BASE%\oradata\XE\CONTROL.DBF
    del %ORACLE_BASE%\fast_recovery_area\XE\ONLINELOG\*.LOG
    
  8. 在一个目录下创建两个文件:

createXE.cmd

创建XE.cmd

set ORACLE_SID=XE
set NLS_LANG=AMERICAN_AMERICA.CL8MSWIN1251
set ORACLE_BASE=C:\oraclexe\app\oracle
sqlplus /nolog @createXE.sql

createXE.sql

创建XE.sql

spool %ORACLE_BASE%\admin\XE\CreateXE.log;
connect sys/admin as sysdba;
startup nomount;
CREATE DATABASE XE
LOGFILE GROUP 1 SIZE 51200K,
GROUP 2 SIZE 51200K
MAXINSTANCES 8
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
CHARACTER SET CL8MSWIN1251
NATIONAL CHARACTER SET AL16UTF16
DATAFILE 'c:\oraclexe\app\oracle\oradata\XE\system.dbf' SIZE 300M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE 'c:\oraclexe\app\oracle\oradata\XE\sysaux.dbf' SIZE 120M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE 'c:\oraclexe\app\oracle\oradata\XE\temp.dbf' SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
SMALLFILE UNDO TABLESPACE UNDOTBS1 DATAFILE 'c:\oraclexe\app\oracle\oradata\XE\undotbs1.dbf' SIZE 200M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED;
CREATE SMALLFILE TABLESPACE USERS DATAFILE 'c:\oraclexe\app\oracle\oradata\XE\users.dbf' SIZE 300M REUSE AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT  AUTO;
-- catalog
@%ORACLE_HOME%\rdbms\admin\catalog.sql;
@%ORACLE_HOME%\rdbms\admin\catblock.sql;
@%ORACLE_HOME%\rdbms\admin\catproc.sql;
@%ORACLE_HOME%\rdbms\admin\catoctk.sql;
connect system/manager
-- sqlplus profile
@%ORACLE_HOME%\sqlplus\admin\pupbld.sql;
@%ORACLE_HOME%\sqlplus\admin\help\hlpbld.sql helpus.sql;
connect sys/admin as sysdba;
-- xdb protocol
@%ORACLE_HOME%\rdbms\admin\catqm.sql change_on_install SYSAUX TEMP NO;
@%ORACLE_HOME%\rdbms\admin\catxdbj.sql;
@%ORACLE_HOME%\rdbms\admin\catrul.sql;
-- compiling invalid objects
@%ORACLE_HOME%\rdbms\admin\utlrp.sql;
spool off;
exit;
  1. Run createdXE.cmdfrom command line with admin privileges.

  2. Done.

  1. 从具有管理员权限的命令行运行createdXE.cmd

  2. 完毕。