Build Oracle Database 19c on Oracle Linux 8.3 (DB Build Part 2)

This is a continuation of the previous article (↓).

-The most easy-to-understand procedure / explanation for installing Oracle Linux 8.3 (DB construction first part)

This time, install Oracle Database 19c and build the DB.

Also, the motivation for writing this article is also to catch up with the latest knowledge (because 11g, 12c was the last one used), so you may feel that the prerequisite knowledge is old, but please Please understand.

Also, as I wrote in the previous article, the purpose of the series of articles is to build a learning database for the purpose of linking with .NET 5.0 (C #) programs, so it is not very complicated and it is exactly There may be some parts that are not. I hope you understand that (although I welcome your suggestions).

TL;DR In the past you had to create a dedicated user (oracle) or group (oinstall) yourself, then run the installer and do a manual install, but now you can do it with a package (RPM). With it, it's almost automated, so you can work efficiently.

So, as a work to do

  1. Install Oracle Preinstallation RPM
  2. Install Oracle Database 19c
  3. Create database with DBCA
  4. Start database and check operation
  5. F / W settings

It will be.

Oracle Preinstallation RPM

It automates pre-tasks such as automatic installation of prerequisite packages and automatic creation of installation users.

Install with the following command.

$ sudo dnf install oracle-database-preinstall-19c.x86_64

When confirmed, press "y" to confirm that it was successful. 1_pre.PNG Let's check if the oracle user is created.

$ id oracle

It's done properly. 2_pre.PNG

-About Oracle Preinstallation RPM --[Overview of Configuring Oracle Linux with Oracle Preinstallation RPM](https://docs.oracle.com/cd/F19136_01/ladbi/overview-of-oracle-linux-configuration-with-oracle-rpms.html# GUID-693599D4-BD32-4E6A-9689-FA7D1CD75653)

Oracle Database 19c installation

Download. The URL of the RPM package can be obtained from the following page.

You'll need to create an account, so if you haven't already done so.

Once downloaded, I'll put rpm in my home directory for now. 3_downloaded.PNG

Check the file for corruption (with SHA256). The hash value is posted on the download page earlier. Create a file called checksum.txt and give it the content hash value [half-width space] file name. 4_sum.PNG

$ sha256sum -c checksum.txt

Execute.

When you see "Complete", it's OK. If the file is corrupted or tampered with (which is unlikely), you'll probably get the phrase "doesn't match". 5_sum.PNG

Install with the command below.

$ sudo dnf localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm

When you get confirmation, click "y" (well, you can skip the confirmation with the -y option, but I want to be careful). 6_installed.PNG Has completed.

Create database

Since building the Database itself is not a study this time, I will create a database with a basic configuration that is not for special purposes (I will write data files, tablespaces, PDBs, etc. again if I have time).

Environment variable settings

First, set environment variables such as ORACLE_HOME. You can add it to each individual user (.profile), but since it is all users, add it to a common place.

$ sudo nano /etc/profile

Add the following at the bottom. SID is an identifier and is the database to be created this time. Add the character code setting as well.

export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=orcl
export NLS_LANG=Japanese_Japan.AL32UTF8

Save it and apply it with the following command.

$ source /etc/profile

Execute echo $ ORACLE_HOME to check if it is done properly. 10_source.PNG

Create database with DBCA

** DBCA (Database Configuration Assistant) ** is a tool for creating Databases.

So, this is done as the oracle user, but the oracle user does not have a password, so set it.

$ sudo passwd oracle

Then log out of the GUI and log in as the oracle user (otherwise the window will not pop up). Set the language setting to "English". This is because the characters become "□□" and become garbled in Japanese. Well, it's okay to use Japanese, but since you have to put in a Java execution environment separately and it will take more time to edit the DBCA startup script, this time we will do it in English as it is (because it is just a test DB creation) ..

By the way, if you want to display Japanese correctly, install the latest Oracle JDK (free for personal use), open $ ORACLE_HOME / bin / DBCA with vi or nano, and change the path of JRE_DIR. is needed.

Returning to the story, log in to the English GUI environment, open a terminal, and start dbca. 13_oracle_user.PNG

$ dbca

11_dbca.PNG

Select "** Create a database **" above (for some reason, the radio check is strange, but it seems to be selected).

14_dbca1.PNG

Select "** Advanced configuration **" below and click "Next".

17_dbca4.PNG

Select ** General Purpose or Transaction Processing ** and click Next.

18_dbca5.PNG

Change only the following parts (well, but you can name it as you like).

19_dbca6.PNG PDB is an abbreviation for pluggable database and is a mechanism introduced from 12c.

Simply put, there is a parent container called a CDB, which contains one or more PDBs. Although the PDB is a conventional tablespace / schema, it is a set. This makes it possible to streamline individual tasks such as patch application.

Keep in mind that the SID orcl will be used again later (by the way, this orcl is often used in Oracle).

Select ** Use template file for database stroage attributes ** and click Next. 20_dbca7.PNG

Select "** Specify Fast Recovery Area **", leave the defaults, and click "Next". 21_dbca8.PNG

Check "** Create a new listener **" and set the following. A listener is a service that accepts processing requests from clients. The port number (1521) specified here is used when connecting from a client.

22_listener.PNG

Do not select any "Data Vault Config Option" and click "Next". 23_dbca9.PNG

"Configuration Options" has several setting items. For Memory, select "** User Automatic Shared Memory Management **" (the value remains the same). 24_dbca.PNG

Character sets -** Select User Unicode (AL32UTF8) **

25_dbca.PNG

For Connection mode, select "** Dedicated server mode **". image.png

If you need a sample schema, check "Add sample schemas to the database" (literally, it will contain sample data). image.png

Leave the default "Management Options" and click "Next". Enterprise Manager is a tool that allows you to check the status of the DB from the browser. image.png

The administrator can use different passwords, but this time we will use the same password. There are multiple admin users in Oracle, such as SYS and SYSTEM. image.png

Make sure that "Create database" is checked by default, and press "Next". image.png

Press "Finish". Then, database creation will start. It's a long task, so wait patiently. image.png

Let's wait patiently. image.png

If it finishes without any problem, this screen will be displayed. The information on this screen will be used later, so please refrain from it or take a screenshot, and close it with "Close". image.png

This completes the database construction.

Listener activation

Since the listener is not started, run the lsnrctl command as the oracle user and run start.

LSNRCTL> start
The Command completed successfully

When it comes out, it's OK. Exit lsnrctl with exit.

Database startup

As the oracle user, connect to the idle instance with sqlplus.

$ sqlplus / as sysdba

Start up with startup.

SQL> startup

When it says that the database has been opened, it's OK. image.png

Added connection identifier to tnsname.ora

Add an identifier to connect to PDB1 (the client may also do this in some cases). If you add this, you will be able to connect by specifying the identifier without writing the IP address or port number of the server each time.

In nano, open the config file

$ nano /opt/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora

Add the following PDB1 identifier (used to connect from the client). In the next and subsequent articles, we will create tables and data for this PDB1.

PDB1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pdb1)
    )
  )

The whole looks like this. image.png

Operation check from the server

Let's try it out.

$ sqlplus sys/[password]@PDB1 as sysdba

If you get "Connected" like this, it's OK. image.png

However, the PDB cannot be used as it is, so make it available. The PDB has a state of ** open mode **, and MOUNTED cannot write or read. The open mode must be ** READ WRITE ** (change OPEN MODE from MOUNTED to OPEN). image.png

Run the following command:

SQL>alter pluggable database open;

OPEN MODE is now READ WRITE. image.png

Now you can build the database without any problems.

Add user

Since SYS and SYSTEM are administrator users, let's create a general user and schema (concept that represents an area in Oracle) for everyday use.

SQL> create user yuki identified by [password]
     default tablespace USERS
     temporary tablespace TEMP;

Give authority. ** connect ** is a set of permissions (called roles) required to connect, but at a minimum this is required. ** resource ** can be created / modified / deleted in the associated schema (essentially a general user). By the way, there is a DBA role for administrators.

-[Database administrator in 2 days --7 Manage user accounts and security](https://docs.oracle.com/cd/F19136_01/admqs/administering-user-accounts-and-security.html#GUID-7FC1D8BE -4BB9-4642-A4CE-29CD2B8A5F23)

SQL> grant connect to yuki;
SQL> grant resource to yuki;

When executed, it should look like this. image.png

Postscript ('20 / 11/22): ↓ is also required.

$ GRANT UNLIMITED TABLESPACE TO yuki;

Let's try connecting.

$ sqlplus yuki@pdb1

You can also specify the password by using sqlplus [username] / [password] @ [connection identifier].

If you can connect, it should look like this. image.png

Yes. This completes the construction.

Firefall settings

Execute the following with root privileges, such as promotion with su.

$ firewall-cmd --zone=public --add-port=1521/tcp --permanent
$ firewall-cmd --zone=public --add-port=5500/tcp --permanent
$ firewall-cmd --reload

This completes the database construction. It takes a lot of time ...

If I do it at work, I will also test whether it is possible to connect to the DB from the client side, but since the client side uses the ODP.NET Managed Driver to create a program in C #, I will do that from the next time onwards.

By the way, to access the management tool called Enterprise Manager, open https: // DB server IP address: 5500 / em / in your browser.

image.png

that's all. Next time, it's time to write the code that connects to Oracle Database 19c from .NET 5.0 (C #).

Reference link

--Database Installation Guide for Linux (Oracle) -Yuji & Gyota's Practical Database Course Let's Use Oracle Database 12c Multi-Tenant Architecture

Recommended Posts

Build Oracle Database 19c on Oracle Linux 8.3 (DB Build Part 2)
Compactly build an Oracle database (19c) on Linux on VirtualBox
Oracle Database 18c installation (Linux CentOS 7 edition)
Build Apache HTTP Server and Wildfly on Oracle Linux 8
Install oracle java8 on amazon linux2
[UE4] Build DedicatedServer on Windows and Linux
[Linux] [C / C ++] Notes about Waf build system
Build an NFS server on Arch Linux
X86 assembler on Linux (linkage with C)
Build a simple WebDAV server on Linux
[C] [python] Read with AquesTalk on Linux
Build an LNPP environment on Amazon Linux 2
Build a Samba server on Arch Linux
The easiest procedure and explanation for installing Oracle Linux 8.3 (DB construction first part)
Linux C / C ++ Build your own library creation environment
[Environment construction] Oracle DB x Pro * C [Now]
How to build Java environment on Ubuntu (Linux)
Build an Arch Linux environment on Raspberry Pi
Set up Docker on Oracle Linux (7.x) with Vagrant
Easy build of C ++ code with CMake on Docker
How to build a Python environment on amazon linux 2