# mydb01:/orainst/product/19c:Y cdb:/orainst/product/19c:NTo extract the database names:
grep "^[^#]" /etc/oratab | awk -F':' '{print $1}'Result:
mydb01 cdb
Minimalistic Oracle contains a collection of practical examples from my encounters with Oracle technologies. When relevant, I also write about other technologies, like Linux or PostgreSQL. Many of the posts starts with "how to" since they derive directly from my own personal experience. My goal is to provide simple examples, so that they can be easily adapted to other situations.
# mydb01:/orainst/product/19c:Y cdb:/orainst/product/19c:NTo extract the database names:
grep "^[^#]" /etc/oratab | awk -F':' '{print $1}'Result:
mydb01 cdb
for l in $(cat file.txt|grep 'Status'| awk -F' ' '{print $2}'); do
if [ $l != "SUCCESS" ]; then
echo $l ": Errors found. Please check logfile status.log"
else
echo "Readjust memory for the remaining cdb instance"
su - oracle <<!
-- code here --
!
runAdjustMemory
fi
done
During execution, my script failed with
./myscript.sh: line 32: warning: here-document at line 20 delimited by end-of-file (wanted `!') ./myscript.sh: line 33: syntax error: unexpected end of file
for l in $(cat file.txt|grep 'Status'| awk -F' ' '{print $2}'); do
if [ $l != "SUCCESS" ]; then
echo $l ": Errors found. Please check logfile status.log"
else
echo "Readjust memory for the remaining cdb instance"
su - oracle <<!
-- code here --
!
runAdjustMemory
fi
done
oracle@oric-dbserver01:[mydb01]# sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 17 10:43:56 2024 Version 19.22.0.0.0 Copyright (c) 1982, 2023, Oracle. All rights reserved. ERROR: ORA-28547: connection to server failed, probable Oracle Net admin errorCause:
oracle@oric-dbserver01:[mydb01]# oerr ora 28547 A failure occurred during initialization of a network connection from a client process to the Oracle server. ... The most frequent specific causes are: [ oracle lists several potential causes here ] The character set of the database is not recognized by the client process, which may be caused by an incorrect or unnecessary setting of the ORA_NLS10 client environment variable or by a new or user-defined character set installed in the Oracle server and used for the database.
export ORA_NLS10=$ORACLE_HOME/nls/data/9idataWhen this is done, sqlplus will work.
dbca -createDatabase -responsefile /home/oracle/scripts/cdb.rsp -silentThe following error kept coming up:
[FATAL] [DBT-05509] Failed to connect to the specified database (cdb). CAUSE: OS Authentication might be disabled for this database (cdb). ACTION: Specify a valid sysdba user name and password to connect to the database.Solution:
export ORA_NLS10=$ORACLE_HOME/nls/data/9idataOtherwise Oracle won't be able to find the language files it needs to create the database.
SYS@mydb01>SQL>alter database "mydb01" open resetlogs; alter database "mydb01" open resetlogs * ERROR at line 1: ORA-00603: ORACLE server session terminated by fatal error ORA-01092: ORACLE instance terminated. Disconnection forced ORA-12701: CREATE DATABASE character set is not knownAs part of the EBS 12.1.3 installation guide, the parameter ORA_NLS10 is pointing to $ORACLE_HOME/nls/data/9idata, where all the NLS files are unpacked during installation.
export ORA_NLS10=$ORACLE_HOME/nls/data/9idata
and rerun the installation scripts.
while true; do if [ -f /u01/createdb.log ]; then tail -f /u01/createdb.log fi done
sqlplus / as sysdba Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.22.0.0.0 SYS@cdb>SQL> alter session set container=PDB$SEED; Session altered. SYS@cdb>SQL>alter session set "_oracle_script"=TRUE; Session altered. SYS@cdb>SQL>alter pluggable database pdb$seed close immediate instances=all; Pluggable database altered. SYS@cdb>SQL>alter pluggable database pdb$seed OPEN READ WRITE; Pluggable database altered. SYS@cdb>SQL>select open_mode from v$database; OPEN_MODE -------------------- READ WRITE SYS@cdb>SQL>show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ WRITE NO SYS@cdb>SQL>exitTo put the PDB$SEED back into READ ONLY and RESTRICTED mode:
SYS@cdb>SQL>alter pluggable database PDB$SEED close; Pluggable database altered. SYS@cdb>SQL>show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED MOUNTED SYS@cdb>SQL>alter pluggable database PDB$SEED open read only; Pluggable database altered. SYS@cdb>SQL>show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO SYS@cdb>SQL>alter session set "_oracle_script"=FALSE; Session altered. SYS@cdb>SQL>show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO SYS@cdb>SQL>alter system enable restricted session; System altered. SYS@cdb>SQL>show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY YES