The practices are designed to be independent of each other. However, before starting a practice it is suggested that you re-create your database in your testing environment.
You should not run these labs on a production system. Commands and scripts are provided solely for testing purposes and need some adaptation to your testing environment.
Step 1 : Create an Oracle Database 21c instance
Create an Oracle Database 21c instance. If you plan to create the instance in Oracle Cloud Infrastructure, follow the instructions described in the Create an Oracle Cloud Infrastructure VM Database tutorial.
In the tutorial, in Lab 4 Create an Oracle Cloud Infrastructure VM Database - Step 2 Create a Database Virtual Machine - Substep 4 define the CDB and PDB as:
Database name: Choose default database name to "cdb21".
PDB name field, enter "pdb21".
Step 2 : Define and test the connections
Log in to the VM of your Database Virtual Machine. Following the tutorial, Lab 4 Create an Oracle Cloud Infrastructure VM Database - Step 3 Gather system details and connect to the Database using SSH to get the IP address of the node and the procedure to log in to the VM.
Create the net service name alias CDB21 for the container database CDB21 and the net service name alias PDB21 for the pluggable database PDB21.
Run the lsnrctl utility to find the path of the /u01/app/oracle/homes/OraDB21Home1/network/admin/tnsnames.ora file. The letters in the Unix prompt following the login username (opc or root or oracle) are the Hostname prefix defined during the Database VM creation via the tutorial, Lab 4 Create an Oracle Cloud Infrastructure VM Database - Step 2 Create a Database Virtual Machine - Subset 3 On the DB System Information form.
[oracle@xx ~]$ lsnrctl status
LSNRCTL for Linux: Version 21.0.0.0.0 - Production on 11-DEC-2020 09:28:09
Copyright (c) 1991, 2020, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxxx.sub12100925130.vcndj.oraclevcn.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 21.0.0.0.0 - Production
Start Date 10-DEC-2020 09:43:06
Uptime 0 days 23 hr. 45 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/homes/OraDB21Home1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/xxxxx/listener/alert/log.xml
Listening Endpoints Summary...
...
Service "CDB21_fra1xn.sub12100925130.xxxxx.oraclevcn.com" has 1 instance(s).
Instance "CDB21", status READY, has 1 handler(s) for this service...
Service "pdb21.sub12100925130.vcndj.oraclevcn.com" has 1 instance(s).
Instance "CDB21", status READY, has 1 handler(s) for this service...
The OraDB21Home1 sub-directory is the sub-directory mentioned in the /u01/app/oraInventory/ContentsXML/inventory.xml file.
Open the /u01/app/oracle/homes/OraDB21Home1/network/admin/tnsnames.ora file. There is a net service alias for the container database, CDB21, using the databaseUniqueName. Replace the SERVICE_NAME entry with the value found in the service from lsnrctl, such as CDB21_fra1xn.sub12100925130.xxxxx.oraclevcn.com.
Step 4 : Update the practices scripts to the current environment
Execute the /home/oracle/labs/update_pass.sh shell script. The shell script prompts you to enter the password_defined_during_DBSystem_creationand sets it in all shell scripts and SQL scripts that will be used in the practices.
Make the script readable, writable, and executable by everyone.
[oracle@xx ~]$ /home/oracle/labs/update_pass.sh
Enter the password you set during the DBSystem creation: password_defined_during_DBSystem_creation
[oracle@xx ~]$