0% found this document useful (0 votes)
48 views

w02 Oracle Setup en

Uploaded by

Ana Pîslaru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

w02 Oracle Setup en

Uploaded by

Ana Pîslaru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Oracle 12.

2 Setup
WEEK 02

Database Administration
FEAA | SDBIS-SIA MASTER
Contents
Week 2 – Installing Oracle ............................................................................................................................ 2
Getting Ready for the Playground Oracle Virtual Machine ...................................................................... 2
Import and Start Oracle VM ...................................................................................................................... 2
Downloading the Oracle Software ............................................................................................................ 3
Preparing the OS Environment ................................................................................................................. 3
Install Oracle Database Server Software .................................................................................................. 4
Creating an Oracle Database .................................................................................................................... 9
Tips & Tricks ................................................................................................................................................ 12
Useful Links ................................................................................................................................................. 12
Week 2 – Installing Oracle
This week we’re going to install an Oracle database server on a VirtualBox virtual machine running a
Linux operating system. Let’s get started!

Getting Ready for the Playground Oracle Virtual Machine


Note: If you’re in the class, just skip this section since the environment is already prepared.

First things first! You need a computer with a 64bit CPU architecture. Obviously, it must be running a
64bit operating system. It doesn’t matter if it’s Windows, OS X, Linux or Solaris. Then you need to
download and install VirtualBox. Any version higher than 5.2.8 will cut it through.

Next, download the virtual machine image from: https://www.dropbox.com/s/iy88t092bf95o18/abd-


20190214.ova?dl=1. It’s a ~14GB file, so you need a good Internet connection and a lot of patience. Also
check if you have enough local disk space to accommodate this big file.

Import and Start Oracle VM


Now that we have the virtual machine downloaded, we need to import it. Open VirtualBox and go to
“File > Import Appliance…”. Choose the previously downloaded “abd-20190214.ova” file and press
“Import”. You’ll get an estimation about the time needed to finish this operation in a progress bar. It
depends on the computer performance you’re working with.
Note: If you’re in the classroom, the file to be imported is already available on a location which will be provided
during the class.

After VM has finished importing, simply start it and wait for the login prompt.

The accounts we’ll use during classes are:

Account Password
root root!
oracle oracle
student student
Downloading the Oracle Software
We’ll install an Oracle 12.2 database server and we need to download the corresponding software
package from the Oracle official download area.

Tick the “Accept License Agreement” and then download “linuxx64_12201_database.zip” file. An Oracle
free account is required to download the software, so you must create one.
Note: Because downloading such a big file is time consuming this file was already provisioned inside the VM itself.
You may find it in “/opt/kits” folder. So, if you’re using the Oracle VM we provided, there’s no need to download
anything.

Preparing the OS Environment


Login with “oracle” user and open a terminal. You should see the “Terminal” icon on the desktop. Go to
“/opt/kits” folder and unzip the oracle software package.

cd /u01/kits
unzip -q linuxx64_12201_database.zip

You should see now a “database” folder under “/opt/kits”.

Usually, Oracle is quite picky on fulfilling all OS prerequisites. Fortunately, the Oracle VM playground
was already prepared, and all dependent packages were installed, as well as other related settings like
“sysctl” or “shell limits”. For those of you who want to install Oracle on your own Linux, it is mandatory
to follow all the installation steps. You may find detailed instructions here. In fact, this link is already
available as a bookmark in the playground VM.

Now, let’s prepare the folders where Oracle software is going to be installed. As “root” user, run the
following commands (to switch to “root”, use the “su –“ command):

mkdir -p /u01/app/oracle/product/12.2.0.1/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01
What does it mean “775”? Why the “-p” argument of the “mkdir” command? If you
don’t know, how can you find more information about “mkdir -p” command?

The next step is to define some environment variables which must be defined first. On a RedHat OS they
usually go to “/home/oracle/.bash_profile” file. However, to keep things clean and simple, just go to
“/opt/oradba/dbs” and launch the “setup_oracle_profile.sh” script.

cd /opt/oradba/dbs
./setup_oracle_profile.sh

Now, we need to refresh the shell environment. Either close the terminal window and start a new one,
or run the following command:

source ~/.bash_profile

Either way, using the following command you should see the ORACLE_HOME environment variable set:

env | grep ORACLE_HOME


ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1

If you don’t see the value for the ORACLE_HOME variable, stop now! Review the previous steps and find
out what went wrong.

What is that “|” character between “env” and “grep”? And what’s the idea of using
“grep” anyway?

Install Oracle Database Server Software


Go to “/opt/kits/database” folder and launch the so-called Oracle Universal Installer. Don’t be afraid, it’s
just a fancy name for their “uncool” installer tool:

cd /opt/kits/database
./runInstaller

You’ll be welcomed by the first wizard page:


Untick the highlighted option above and choose next. The following warning can be safely ignored. It
asks for our confirmation that indeed we are fool enough to remain uninformed of Oracle critical issues
which may come up in the future.

It’s a test/playground environment so we can take this risk. Press “Yes” and the next wizard page is
displayed:

We choose the second option. The first one would be also a good fit, but we’ll go with the second option
because we’d like to emphasize the difference between having the software installed and the database
on top of it. You may have just the software installed and no database, but not the other way around.
Also, you may have more than one database sharing the same Oracle software. The next screen is:

We let the default first option selected and choose next.

Again, we let the default option which is “Enterprise Edition” and we move forward.

What is the difference between Oracle Enterprise Edition and Standard Edition? What
would you choose for your company?
The next setup page is where you specify the ORACLE_BASE and the ORACLE_HOME locations.
ORACLE_BASE is the common location for all Oracle related software (not necessarily Oracle database
server), whereas ORACLE_HOME points to the folder underneath ORACLE_BASE where, in this case, the
database server software is going to be installed.

The next screen is the following:

Here, Oracle is asking for the inventory location. This is just a folder where Oracle keeps track of all
software packages it installs. On Windows this information is usually kept in Windows registry, but on
Linux (and on other OS platforms) this facility can’t be used. Just leave the default and move forward.

The screen above asks for a mapping between an OS group and the administrative tasks allowed to the
users belonging to those groups. For example, if an OS user is part of the “dba” OS group, then it will
implicitly be a DBA database administrator with all the corresponding rights. We can have a look at the
groups “oracle” user belongs to:

id oracle
uid=54321(oracle) gid=54321(oinstall)
groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdb
a),54326(kmdba),54330(racdba)
We can see that “oracle” user is part of all the groups shown in the setup screen, which means it can do
all possible Oracle administrative tasks.

The last screen before starting the setup process is the summary below:

“Save Response File…” is a feature we’re not going to use, but for your information it allows to save all
previous options so that to allow you to reuse them on subsequent installations. It is very helpful for
automating the setup. For now, we’ll just go with the “Install” button. You should see now some
progress information. At some point you’ll be prompted to run some scripts:

Leave the above window open and run the specified scripts using “root” user. The first script would be:

[root@orasrv ~]# /u01/app/oraInventory/orainstRoot.sh


Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.


The execution of the script is complete.
The second script asks for some input data from the user. Just hit ENTER to accept all defaults.

[root@orasrv ~]# /u01/app/oracle/product/12.2.0.1/db_1/root.sh


Performing root user operation.

The following environment variables are set as:


ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/12.2.0.1/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:


Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...


Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] :

Oracle Trace File Analyzer (TFA - User Mode) is available at :


/u01/app/oracle/product/12.2.0.1/db_1/suptools/tfa/release/tfa_home/bin/tfactl

OR

Oracle Trace File Analyzer (TFA - Daemon Mode) can be installed by running this script
:/u01/app/oracle/product/12.2.0.1/db_1/suptools/tfa/release/tfa_home/install/roottfa.sh

After running those two scripts, come back to the “Execute Configuration Scripts” window and press
“OK”. The final screen should be:
Hit “Close”! Congratulations! You have successfully installed the Oracle database server software.

Creating an Oracle Database


Ok, we have the Oracle software in place, but we haven’t installed a database yet. To get one up and
running we can use a few tools, but the most common one is to use the “Database Configuration
Assistant”. The short name of the command launching this tool is “dbca”. So, as “oracle” OS user, fire up
a new terminal and type “dbca”, as shown below (of course, with ENTER at the end):

dbca

The GUI (Graphical User Interface) of this tool is very similar with the Oracle Universal Installer in the
sense that a sequence of wizard pages is shown. The first page is the one below:

By looking at this page we can figure out that this tool is not only for creating new databases but also for
configuring and delete them. However, we’re now interested in creating a new database therefore we
let the first option checked and move forward to the next page.

We go with a “Typical configuration” where we let the system to configure our database with the
recommended options. We provide the “Global database name” as “mydb”, and “oracle” as the
“Administrative password”. We also choose to create the database as a container. This is a new feature
in Oracle 12c version. Basically, we can tell Oracle that under the same server backend we want to
manage a special kind of databases called “pluggable databases”. In the screen above we want to create
a pluggable database called “facebook”. Later on, we can easily add more such databases. Also, it is
important to decide now the “Database character set” as it is difficult to change it after the database is
created. The default “UTF-8” character set is the recommended one because it can accommodate any
symbol (a.k.a glyph). For now, just leave the “Fast Recovery Area (FRA)” field as it is. We’ll cover this
concept when we reach the “Backup & Recovery” topic.

Look at the “Database files location” field and try to guess where the database files
are going to be created.

Press the “Next” button and a warning is displayed.

The reason is that we provided a very simple and easy to guess password and Oracle wants us to
confirm that we are aware of the risk. Of course, we’re going to use more complex passwords for
productive environments, but for this playground database we won’t bother. So, just confirm with
“Yes”.

The next screen is a summary for the database which is about to be created:
What do you think “Save Response File…” is for? When do you think such a feature is
useful?

Press “Finish” and wait for the database setup to finish. You get progress information in a screen like the
one shown below:

In Oracle, creating a new container or a non-container database is a time-consuming process, so be


patient. If all goes well, you should see the final screen of the database setup:

Hit “Close” and congratulate yourself. You’ve successfully created a new Oracle database.
Tips & Tricks
If you want to start over again with the setup, you can easily achieve that by reverting all changes in the
playground VM. Just connect with root, and run the following command:

[root@orasrv ~]# week1.sh

Useful Links
Installation instructions: https://oracle-base.com/articles/12c/oracle-db-12cr2-installation-on-oracle-
linux-6-and-7

Oracle official documentation: https://docs.oracle.com/en/database/oracle/oracle-


database/12.2/index.html

You might also like