在 Debian 下启动 Oracle 数据库(通常指 Oracle Database 11g/12c/19c 等),一般步骤如下(以单机单实例为例):
su - oracle
通常 Oracle 环境在 .bash_profile 或 .bashrc 中:
export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
根据你实际安装路径修改
lsnrctl start
检查状态:
lsnrctl status
sqlplus / as sysdba
进入后执行:
startup;
若正常,会看到:
ORACLE instance started.
Database mounted.
Database opened.
退出:
exit;
sqlplus / as sysdba <<EOF
startup;
exit;
EOF
sqlplus / as sysdba
select status from v$instance;
应返回:
OPEN
Debian 下 Oracle 不自动启动,可:
/etc/init.d/oracle start
示例 /etc/systemd/system/oracle.service:
[Unit]
Description=Oracle Database
After=network.target
[Service]
Type=forking
User=oracle
Environment="ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1"
Environment="ORACLE_SID=orcl"
ExecStart=/u01/app/oracle/product/19.3.0/dbhome_1/bin/dbstart $ORACLE_HOME
ExecStop=/u01/app/oracle/product/19.3.0/dbhome_1/bin/dbshut $ORACLE_HOME
[Install]
WantedBy=multi-user.target
启用:
systemctl enable oracle
❌ ORA-01034 / ORA-27101
→ 数据库未启动或 ORACLE_SID 错
❌ listener not started
→ 先 lsnrctl start
❌ Debian 缺少依赖库
→ 需要安装 libaio1, libstdc++5 等
如果你能告诉我:
我可以给你更精确的启动命令。