You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

按照README创建Oracle数据库,执行Docker连接命令遇ORA-01034错误求助

Fixing ORA-01034 & ORA-27101 Errors When Connecting to Oracle via Docker

Hey Mike, let's work through this error together. The ORA-01034: ORACLE not available and ORA-27101: shared memory realm does not exist messages tell us your instant client can't establish a connection to a running Oracle instance. Here's how to troubleshoot and fix this step by step:

Step 1: Verify the Database Container is Running

First, check if your InfraDB container is actually up and running:

docker ps

Look for a container named InfraDB with a status of Up. If it's stopped, start it with:

docker start InfraDB

Step 2: Confirm Network Connectivity Between Containers

Since you're using the SampleNET network, make sure both the database container and your instant client container are attached to it:

  1. Check the database container's network association:
    docker inspect InfraDB | grep -A 5 Networks
    
    You should see SampleNET listed under its networks.
  2. Test if the client can reach the database container:
    Run the instant client container in interactive bash mode first:
    docker run -it --network=SampleNET --rm store/oracle/database-instantclient:12.2.0.1 bash
    
    Then ping InfraDB to confirm connectivity:
    ping InfraDB
    
    If ping fails, manually attach the database container to the network:
    docker network connect SampleNET InfraDB
    

Step 3: Check if the Oracle Instance is Started

Even if the container is running, the Oracle instance might not have finished initializing or could be stopped. Enter the InfraDB container to verify:

  1. Access the container's shell:
    docker exec -it InfraDB bash
    
  2. Log in to SQL*Plus locally as SYSDBA:
    sqlplus / as sysdba
    
  3. Check the instance status:
    SELECT status FROM v$instance;
    
    If the status is not OPEN, start the instance (this may take a few minutes):
    STARTUP;
    

Step 4: Validate Your Connection String

Double-check your connection parameters for accuracy:

  • Service name mindshift: Verify it's registered with the Oracle listener. In the InfraDB container, run:
    lsnrctl status
    
    Look for mindshift under the "Services Summary" section. If it's missing, you may need to adjust the database's service_name parameter or listener configuration.
  • SYSDBA privileges: Ensure the SYS user has remote SYSDBA access. Run this query locally in SQL*Plus:
    SELECT username, sysdba FROM v$pwfile_users WHERE username = 'SYS';
    
    The sysdba column should show TRUE. If not, recreate the password file with SYSDBA privileges enabled.

Step 5: Check Client-Database Version Compatibility

Your instant client is version 12.2.0.1. Oracle clients can connect to newer database versions (e.g., 18c, 19c) but may have issues with extremely old or cutting-edge versions. If all other steps fail, confirm your InfraDB database version is compatible with 12.2.0.1.


内容的提问来源于stack exchange,提问作者Mike3355

火山引擎 最新活动