An Oracle database is a collection of data treated as a unit with a purpose to store and retrieve related information. All this is accomplished while delivering high performance. A database server also prevents unauthorized access and provides efficient solutions for failure recovery. Users can concurrently access the same data.
Oracle Database is the first database designed for enterprise grid computing, the most flexible and cost-effective way to manage information and applications. Enterprise grid computing creates large pools of industry-standard, modular storage, and servers. With this architecture, each new system can be rapidly provisioned from the pool of components. There is no need for peak workloads because capacity can be easily added or reallocated from the resource pools as needed.
The database has logical structures and physical structures. Because the physical and logical structures are separate, the physical storage of data can be managed without affecting the access to logical storage structures.
Source: https://docs.oracle.com/cd/B19306_01/server.102/b14220/intro.htm
1. SETTING HOSTNAME
Find the hostname by typing hostname in the terminal. You can set hostname in the file /etc/sysconfig/network. For that, add or edit the following entry for new name.
[root@oracle]# vi /etc/sysconfig/network HOSTNAME=server.example.com [root@server]# hostname server.example.com
/etc/sysconfig/network file is the source from which the startup scripts take the arguments for ‘hostname‘ command and is used to specify information about the desired network configuration.
Alternatively, you can change the hostname from /etc/hostname and you need to restart the system or run the command hostname -F /etc/hostname to take effect the change.
Open /etc/hosts file and add a fully qualified hostname for the server. Host file serves the function of translating human-friendly hostnames into numeric protocol addresses, called IP addresses, that identify and locate a host in an IP network. The hosts’ file’s content is used preferentially to other methods, such as the Domain Name System (DNS). Also, there should be no nameservers set while configuring IP, which can slow down the resolution process. As an example, we will use the IP address 192.168.1.58.
[root@server]# vi /etc/hosts 192.168.1.58 server.example.com
Now restart networking on the server to make sure that changes will be persistent on reboot.
[root@server]# /etc/init.d/network restart Verify your network settings using ping server.example.com [root@server ~]# ping -c 3 server.example.com PING server.example.com (192.168.1.58) 56(84) bytes of data. 64 bytes from server.example.com (192.168.1.58): icmp_seq=1 ttl=64 time=0.034 ms 64 bytes from server.example.com (192.168.1.58): icmp_seq=2 ttl=64 time=0.035 ms 64 bytes from server.example.com (192.168.1.58): icmp_seq=3 ttl=64 time=0.040 ms --- server.example.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2839ms rtt min/avg/max/mdev = 0.034/0.036/0.040/0.005 ms
2. CREATING USER, GROUP AND DIRECTORIES
Create a new user say “oracle” using useradd oracle command and set the password as “oracle”.
[root@server ~]# useradd oracle
[root@server]# passwd oracle Changing password for user oracle. New password: Retype new password: passwd: all authentication tokens updated successfully.
Make a directory for installing the oracle files and set permission.
mkdir /oracle/app/product/11.2.0/db_1 chmod -R 775 /oracle chown -R oracle:oracle /oracle
/oracle/app/product/11.2.0/db_1 is for storing the installation files and /oradata for storing database. The partition before configuration will be /oracle – 100GB, /oradata – 100GB, / – 100GB and so on. Change the permission for owner and his group to full, and others to read and execute.
Here, we are using single-user and single group. Instead, we can create the user oracle and the groups install for OraInventory and dba for OSDBA, which are used during database installation.
3. EDITING CONFIGURATION FILES
Add or modify kernel parameters in /etc/sysctl.conf to change settings for shared memory, semaphores, the maximum number of file descriptors, and so on.
[root@server ~]# vi /etc/sysctl.conf kernel.shmmni = 4096 kernel.shmmax = 4398046511104 kernel.shmall = 1073741824 kernel.sem = 250 32000 100 128 fs.aio-max-nr = 1048576 fs.file-max = 6815744 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048586 Apply kernel parameters [root@server ~]# /sbin/sysctl -p
Set hard and soft shell resource limits in /etc/security/limits.conf
, such as the locked-in memory address space, the number of open files, the number of processes, and core file size.
[root@server ~]# vi /etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 4096 oracle hard nofile 65536 oracle soft stack 10240 oracle soft core unlimited oracle hard core unlimited oracle soft memlock 50000000 oracle hard memlock 50000000
Disable secure linux by editing the /etc/selinux/config file, making sure the SELINUX flag is set as permissive. The purpose of supporting permissive policies is to allow a system to run with SELinux enabled, while still allowing all accesses that the applications are trying to do. An SELinux-enabled system that runs in permissive mode is not protected by SELinux. In permissive mode SELinux does not enforce its policy, but only logs what it would have blocked.
[root@server ~]# vi /etc/selinux/config SELINUX=permissive Once the change is complete, restart the server.
If you have the Linux firewall enabled, you will need to disable or configure it. To disable it, do the following.
[root@server ~]# systemctl stop firewalld [root@server ~]# systemctl disable firewalld
Alternative to disabling, you can configure it to allow the port and add some services as trusted so that Oracle can use them. For that, use the command firewall-config to open firewall configuration GUI. The default port for Oracle is 1521.
4. EDIT THE bash_profile
To ensure that the environment is setup correctly for the oracle user account, use the following in .bash_profile.
[oracle@server ~]# vi .bash_profile # Oracle Settings TMP=/tmp; export TMP TMPDIR=$TMP; export TMPDIR ORACLE_HOSTNAME=server.example.com; export ORACLE_HOSTNAME ORACLE_UNQNAME=server; export ORACLE_UNQNAME ORACLE_BASE=/oracle; export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/app/product/11.2.0/db_1; export ORACLE_HOME ORACLE_SID=server; export ORACLE_SID ORACLE_TERM=xterm; export ORACLE_TERM PATH=/usr/sbin:$PATH; export PATH PATH=$ORACLE_HOME/bin:$PATH; export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH [oracle@server ~]# source .bash_profile
5. INSTALL DEPENDENCIES
The following packages are listed as required, including the 32-bit version of some of the packages. Many of the packages should be installed already.
yum install binutils -y yum install compat-libstdc++-33 -y yum install compat-libstdc++-33.i686 -y yum install gcc -y yum install gcc-c++ -y yum install glibc -y yum install glibc.i686 -y yum install glibc-devel -y yum install glibc-devel.i686 -y yum install ksh -y yum install libgcc -y yum install libgcc.i686 -y yum install libstdc++ -y yum install libstdc++.i686 -y yum install libstdc++-devel -y yum install libstdc++-devel.i686 -y yum install libaio -y yum install libaio.i686 -y yum install libaio-devel -y yum install libaio-devel.i686 -y yum install libXext -y yum install libXext.i686 -y yum install libXtst -y yum install libXtst.i686 -y yum install libX11 -y yum install libX11.i686 -y yum install libXau -y yum install libXau.i686 -y yum install libxcb -y yum install libxcb.i686 -y yum install libXi -y yum install libXi.i686 -y yum install make -y yum install sysstat -y yum install unixODBC -y yum install unixODBC-devel -y yum install zlib-devel -y yum install elfutils-libelf-devel -y
6. DOWNLOAD AND INSTALL ORACLE
Switch to user oracle and download Oracle. You can download Oracle from http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
Unzip the two files using the following commands:
[oracle@server ~]# unzip linux.x64_11gR2_database_1of2.zip [oracle@server ~]# unzip linux.x64_11gR2_database_2of2.zip [oracle@server ~]# ls linux.x64_11gR2_database_1of2.zip database linux.x64_11gR2_database_2of2.zip
The extracted files are in the directory database. So open that and run the installer.
[oracle@server ~]# cd /database [oracle@server database]# ./runInstall
If any display error found, log out of all other users and login as oracle and try again.
Follow the steps to configure and install the software.
1. Configure Security Updates
Enter your e-mail address, preferably your My Oracle Support e-mail address or user name in the Email field to receive updates or just skip the step by clicking next. If a popup appears just click yes.
2. Software updates
You can use the Software Updates feature to dynamically download and apply the latest updates. Skip the software updates and click next.
3. Select Install Option
Choose Create and configure database option for new installation.
4. System Class
Choose Server Class option. Choose Desktop Class option if you are installing on a laptop or desktop class system.
5. Grid install options
Select Single instance database installation option which installs the database and the listener. Real Application Clusters database installation option installs Oracle Real Application Clusters and Oracle RAC One Node database installation option installs the Oracle RAC One Node database.
6. Select Install Type
Select Typical Install. This installation method is selected by default. It lets you quickly install Oracle Database using minimal input. Advanced Install method enables to perform more complex installations.
7. Typical Install Configuration
Enter the following information according to your requirements:
Oracle base: The Oracle base path appears by default. You can change the path based on your requirement. Type /oracle as path.
Software location: In the Software Location section, accept the default value or enter the Oracle home directory path in which you want to install Oracle components. The directory path should not contain spaces. Type /oracle/app/product/11.2.0/db_1
Storage Type: Select File System, or Oracle Automatic Storage Management as the database storage option.
Database file location: If you select File System as your storage type, then click Browse and specify
a database file location. Type /oradata
ASMSNMP Password: If you select Oracle Automatic Storage Management as your Storage Type, then specify the password for the ASMSNMP user.
Database edition: Select the database edition to install. Enterprise edition by default.
OSDBA Group: The OSDBA group is selected by default. You can also select the OSDBA group from the list. We will be having the group oracle.
Global database name: Specify the Global Database Name as server.example.com
Administrative password: Enter the password for the privileged database account. Use “oracle”.
Confirm Password: Reenter, and confirm the password for the privileged database account.
8. Create Inventory
This screen is displayed only during the first installation of Oracle products on a system. Specify the full path of the Oracle Inventory directory. Ensure that the operating system group selected is oracle
. Use /oracle/oraInventory and click Next to continue.
9. Perform Prerequisite Checks
Verify that all the prerequisite checks succeed, and then click Next. Oracle Universal Installer checks the system to verify that it is configured correctly to run Oracle software. If you have completed all the preinstallation steps in this guide, all the checks should pass. If a check fails, then review the cause of the failure listed for that check on the screen. If possible, rectify the problem and rerun the check. Alternatively, if you are satisfied that your system meets the requirements, then you can select the checkbox for the failed check to manually verify the requirement.
10. Summary
Review the information displayed on this screen, and then click Install. Save Response File can be useful later for silent installation.
11. Install Product
This screen states the progress of a database installation. After the database is installed, you are prompted to execute some root configuration script for new inventory as the root
user. Click Next.
This screen then displays the status information for the configuration assistants that configure the software and create a database.
Finally, a message is displayed at the end of Database Configuration Assistant process, and click OK.
Execute the root.sh
script as the root
user to complete the installation and click OK.
12. Finish
This screen is shown automatically when all the configuration tools are successful. Click Close.
Edit the /etc/oratab file setting the restart flag for each instance to ‘Y’.
[root@server ~]# vi /etc/oratab
server:/oracle/app/product/11.2.0/db_1:Y
7. CHECK INSTALLATION AND AUTO START ORACLE
Just for checking, log into the database using the command
[oracle@server ~]# sqlplus
As username, enter sys as sysdba and enter the database password.
To automate starting oracle on system startup, create a service and then enable it. For that, add the below lines to /etc/systemd/system/oracle.service
[root@server ~]# vi /etc/systemd/system/oracle.service # /etc/systemd/system/oracle.service # Invoking Oracle scripts to start/shutdown Instances defined in /etc/oratab and starts Listener [Unit] Description=Oracle Database(s) and Listener Requires=network.target [Service] Type=forking Restart=no ExecStart=/oracle/app/product/11.2.0/db_1/bin/dbstart /oracle/app/product ExecStop=/oracle/app/product/11.2.0/db_1/bin/dbshut /oracle/app/product User=oracle [Install] WantedBy=multi-user.target [root@server ~]# systemctl start oracle.service [root@server ~]# systemctl enable oracle.service
You can check the status after rebooting using
[root@server ~]# systemctl status oracle.service
[UNIT] carries generic information about the unit. It includes:
Description: A free-form string describing the unit and should contain a name that means something to the end user.
Requires: Configures requirement dependencies on other units. If this unit gets activated, the units listed here will be activated as well. If one of the other units fails to activate, and an ordering dependency After = on the failing unit is set, this unit will not be started.
Requisite: If the units listed here are not started already, they will not be started and the starting of the unit will fail immediately.
[INSTALL] carries installation information for the unit. It includes:
WantedBy: This directive is the most common way to specify how a unit should be enabled. It specifies the run levels or target the application should run. The primary result is that the current unit will be started when the listed unit is started.
[SERVICE] carries information about the service and the process it supervises. A number of options that may be used in this section are shared with other unit types.
Type: Configures the process start-up type for this service unit. One of simple
, forking
, oneshot
, dbus
, notify
or idle
.
Restart: Configures whether the service shall be restarted when the service process exits, is killed, or a timeout is reached.
ExecStart: Commands with their arguments that are executed when this service is started
ExecStop: Commands with their arguments that are executed when this service is started
User: Set the UNIX user or group that the processes are executed as, respectively. Takes a single user or group name, or a numeric ID as an argument.