Skip to content

Instantly share code, notes, and snippets.

@fortran01
Last active November 23, 2023 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fortran01/6b61cb2c20263ac49834d803e247ffd8 to your computer and use it in GitHub Desktop.
Save fortran01/6b61cb2c20263ac49834d803e247ffd8 to your computer and use it in GitHub Desktop.
# Install in Centos 7:
# https://www.server-world.info/en/note?os=CentOS_7&p=oracle19c&f=6
# It is possible to modify the 'sys' and 'system' user passwords
[oracle@host ~]$ sqlplus "/ as sysdba"
# SQL> alter user sys identified by syspw;
# SQL> alter user system identified by systempw;
# Test connecting to the default SID using an Oracle DB Client
# Connect to SID=ORCLCDB as sys using the SYSDBA role
# The steps from this point aim to create sample schemas
[oracle@host ~]$ cd $HOME
[oracle@host ~]$ git clone https://github.com/oracle/db-sample-schemas.git
[oracle@host ~]$ cd db-sample-schemas/
[oracle@host ~]$ git checkout v19.2
# Change all embedded paths to match your working directory
perl -p -i.bak -e 's#__SUB__CWD__#'$(pwd)'#g' *.sql */*.sql */*.dat
# Create a new PDB in the default CDB "ORCLCDB"
# SQL> CREATE PLUGGABLE DATABASE NEWPDB ADMIN USER admin IDENTIFIED BY password FILE_NAME_CONVERT = ('/pdbseed/', '/newpdb/');
# SQL> ALTER PLUGGABLE DATABASE NEWPDB OPEN;
# SQL> ALTER PLUGGABLE DATABASE ALL SAVE STATE;
# Modify the TNS file to add the new PDB.
# Add the following to /opt/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora
: '
NEWPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ip-172-31-14-88.ca-central-1.compute.internal)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = NEWPDB)
)
)
'
# Restart the ORCLCDB service
[root@host ~]# systemctl restart ORCLCDB@oracledb
# You might need to reopen the new PDB
[oracle@host ~]$ sqlplus "/ as sysdba"
# Make sure you are in the correct pwd
[oracle@host ~]$ cd $HOME/db-sample-schemas
# Connect to the new PDB using sqlplus
[oracle@host ~]$ sqlplus system/systempw@NEWPDB
# Run the top-level installation script
# SQL> @mksample systempw syspw hrpw oepw pmpw ixpw shpw bipw users temp /home/oracle/db-sample-schemas/logs NEWPDB
# After the successful creation of sample schemas, connect to a sample schema like HR
# Username is "hr" and the password is "hrpw", Service Name is NEWPDB
# Check if you can see some tables like countries, departments and employees
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment