oracle - ORA-01034: 从 Docker 官方镜像部署 oracle 时发生 ORACLE 不可用
问题描述
当我使用 oracle-xe-11.2.0-1.0.x86_64.rpm.zip 从这个镜像部署 https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance/dockerfiles/11.2.0.2 然后我面对
ORA-01034: ORACLE not available
docker-compose.yml 是
version: '2'
services:
oracle:
build: dockerfile
ports:
- "1521:1521"
- "8080:8080"
shm_size: 1G
volumes:
- ./oradata:/u01/app/oracle/oradata
environment:
- ORACLE_PWD=passwd
- ORACLE_PDB=PDB01
- ORACLE_SID=SID01
在 dockerfile 目录下是(刚刚从github签出)
-rwxr-xr-x 1 abe 1049089 999 Feb 3 16:35 checkDBStatus.sh
-rw-r--r-- 1 abe 1049089 3107 Feb 3 16:37 Dockerfile
-rw-r--r-- 1 abe 1049089 315891481 Feb 3 14:31 oracle-xe-11.2.0-1.0.x86_64.rpm.zip
-rwxr-xr-x 1 abe 1049089 7088 Feb 3 16:35 runOracle.sh
-rwxr-xr-x 1 abe 1049089 193 Feb 3 16:35 setPassword.sh
-rw-r--r-- 1 abe 1049089 2943 Feb 3 16:35 xe.rsp
引导日志是
oracle_1 | ORACLE PASSWORD FOR SYS AND SYSTEM: passwd
oracle_1 |
oracle_1 | Oracle Database 11g Express Edition Configuration
oracle_1 | -------------------------------------------------
oracle_1 | This will configure on-boot properties of Oracle Database 11g Express
oracle_1 | Edition. The following questions will determine whether the database should
oracle_1 | be starting upon system boot, the ports it will use, and the passwords that
oracle_1 | will be used for database accounts. Press <Enter> to accept the defaults.
oracle_1 | Ctrl-C will abort.
oracle_1 |
oracle_1 | Specify the HTTP port that will be used for Oracle Application Express [8080]:
oracle_1 | Specify a port that will be used for the database listener [1521]:
oracle_1 | Specify a password to be used for database accounts. Note that the same
oracle_1 | password will be used for SYS and SYSTEM. Oracle recommends the use of
oracle_1 | different passwords for each database account. This can be done after
oracle_1 | initial configuration:
oracle_1 | Confirm the password:
oracle_1 |
oracle_1 | Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:
oracle_1 | Starting Oracle Net Listener...Done
oracle_1 | Configuring database...Done
oracle_1 | Starting Oracle Database 11g Express Edition instance...Done
oracle_1 | Installation completed successfully.
oracle_1 |
oracle_1 | SQL*Plus: Release 11.2.0.2.0 Production on Tue Feb 4 10:21:22 2020
oracle_1 |
oracle_1 | Copyright (c) 1982, 2011, Oracle. All rights reserved.
oracle_1 |
oracle_1 | Connected to an idle instance.
oracle_1 |
oracle_1 | SQL> BEGIN DBMS_XDB.SETLISTENERLOCALACCESS(FALSE); END;
oracle_1 |
oracle_1 | *
oracle_1 | ERROR at line 1:
oracle_1 | ORA-01034: ORACLE not available
oracle_1 | Process ID: 0
oracle_1 | Session ID: 0 Serial number: 0
oracle_1 |
oracle_1 |
oracle_1 | SQL> SQL> ALTER DATABASE ADD LOGFILE GROUP 4 ('/u01/app/oracle/oradata/SID01/redo04.log') SIZE 50m
oracle_1 | *
oracle_1 | ERROR at line 1:
oracle_1 | ORA-01034: ORACLE not available
oracle_1 | Process ID: 0
oracle_1 | Session ID: 0 Serial number: 0
oracle_1 |
oracle_1 |
oracle_1 | SQL> ALTER DATABASE ADD LOGFILE GROUP 5 ('/u01/app/oracle/oradata/SID01/redo05.log') SIZE 50m
oracle_1 | *
oracle_1 | ERROR at line 1:
oracle_1 | ORA-01034: ORACLE not available
oracle_1 | Process ID: 0
oracle_1 | Session ID: 0 Serial number: 0
oracle_1 |
oracle_1 |
oracle_1 | SQL> ALTER DATABASE ADD LOGFILE GROUP 6 ('/u01/app/oracle/oradata/SID01/redo06.log') SIZE 50m
oracle_1 | *
oracle_1 | ERROR at line 1:
oracle_1 | ORA-01034: ORACLE not available
oracle_1 | Process ID: 0
oracle_1 | Session ID: 0 Serial number: 0
oracle_1 |
oracle_1 |
oracle_1 | SQL> ALTER SYSTEM SWITCH LOGFILE
oracle_1 | *
oracle_1 | ERROR at line 1:
oracle_1 | ORA-01034: ORACLE not available
oracle_1 | Process ID: 0
oracle_1 | Session ID: 0 Serial number: 0
oracle_1 |
oracle_1 |
oracle_1 | SQL> ALTER SYSTEM SWITCH LOGFILE
oracle_1 | *
oracle_1 | ERROR at line 1:
oracle_1 | ORA-01034: ORACLE not available
oracle_1 | Process ID: 0
oracle_1 | Session ID: 0 Serial number: 0
oracle_1 |
oracle_1 |
oracle_1 | SQL> ALTER SYSTEM CHECKPOINT
oracle_1 | *
oracle_1 | ERROR at line 1:
oracle_1 | ORA-01034: ORACLE not available
oracle_1 | Process ID: 0
oracle_1 | Session ID: 0 Serial number: 0
oracle_1 |
oracle_1 |
oracle_1 | SQL> ALTER DATABASE DROP LOGFILE GROUP 1
oracle_1 | *
oracle_1 | ERROR at line 1:
oracle_1 | ORA-01034: ORACLE not available
oracle_1 | Process ID: 0
oracle_1 | Session ID: 0 Serial number: 0
oracle_1 |
oracle_1 |
oracle_1 | SQL> ALTER DATABASE DROP LOGFILE GROUP 2
oracle_1 | *
oracle_1 | ERROR at line 1:
oracle_1 | ORA-01034: ORACLE not available
oracle_1 | Process ID: 0
oracle_1 | Session ID: 0 Serial number: 0
oracle_1 |
oracle_1 |
oracle_1 | SQL> SQL> ALTER SYSTEM SET db_recovery_file_dest=''
oracle_1 | *
oracle_1 | ERROR at line 1:
oracle_1 | ORA-01034: ORACLE not available
oracle_1 | Process ID: 0
oracle_1 | Session ID: 0 Serial number: 0
oracle_1 |
oracle_1 |
oracle_1 | SQL> Disconnected
oracle_1 | mv: cannot stat '/u01/app/oracle/product/11.2.0/xe/dbs/spfileSID01.ora': No such file or directory
oracle_1 | mv: cannot stat '/u01/app/oracle/product/11.2.0/xe/dbs/orapwSID01': No such file or directory
oracle_1 | #########################
oracle_1 | DATABASE IS READY TO USE!
oracle_1 | #########################
oracle_1 | The following output is now a tail of the alert.log:
oracle_1 | QMNC started with pid=24, OS id=481
oracle_1 | Completed: ALTER DATABASE OPEN
oracle_1 | Tue Feb 04 10:21:12 2020
oracle_1 | db_recovery_file_dest_size of 10240 MB is 0.98% used. This is a
oracle_1 | user-specified limit on the amount of space that will be used by this
oracle_1 | database for recovery-related files, and does not reflect the amount of
oracle_1 | space available in the underlying filesystem or ASM diskgroup.
oracle_1 | Starting background process CJQ0
oracle_1 | Tue Feb 04 10:21:12 2020
oracle_1 | CJQ0 started with pid=26, OS id=495
我该如何解决这个问题?
解决方案
我自己解决了。
ORACLE_PDB、ORACLE_SID 不能使用这些参数自动创建。
在第一次部署时,我们应该ORACLE_PWD
只设置。
部署后,我们可以访问数据库sqlplus system/${ORACLE_PWD}@XE
。
推荐阅读
- performance-testing - JMtere:响应时间图突然出现峰值,然后又下降到持续运行的原因是什么?
- python - 从json响应中提取值数组的最佳方法
- javascript - 使用 javascript 输入部分时间的焦点分钟
- spring - 如何在 r2dbc 中批量执行多个插入?
- visual-studio-code - 在终端上显示当前分支
- php - FOSUser 没有加密密码 Symfony 4
- python - 使用条件复制目录及其子目录和文件
- reactjs - 将脊椎动画与 React 集成
- sql - ORACLE - 更新 xml 中的多个属性
- image - 将图像从 wpf 应用程序拖放到 uwp 应用程序