Can't restart oracle database inside docker

Viewed 304

So I'm trying to configure debezium on a Oracle database inside this docker image, according to the documentation described here.

At the "Preparing the Database" the first config I have to do is:

ORACLE_SID=ORACLCDB dbz_oracle sqlplus /nolog

CONNECT sys/top_secret AS SYSDBA
alter system set db_recovery_file_dest_size = 10G;
alter system set db_recovery_file_dest = '/opt/oracle/oradata/recovery_area' scope=spfile;
shutdown immediate
startup mount
alter database archivelog;
alter database open;
-- Should now "Database log mode: Archive Mode"
archive log list

exit;

The problem is that when I run shutdown immediate, the database dies and never returns. When I try to run:

docker exec -ti oracle sqlplus sys/top_secret@localhost:1521/ORCLCDB as SYSDBA

I get the error:

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Aug 10 07:44:23 2021
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor

I tried running this script inside the container, but still nothing. Anyone knows how could I start the database again?

1 Answers

There are 2 solutions for this

  1. create a static listener configuration that has the database defined in the listener. Doing so enables startup through sqlnet like you tried.

  2. run the script on the server using an account that is member of the local dba group. For startup use something like: ORAENV_ASK=NO; ORACLE_SID=ORCLCDB; source oraenv; “echo startup”| sqlplus / as sysdba. This asumes that ORCLCDB is listed in /etc/oratab

Related