Configuring The Linux System For Oracle
Configuring The Linux System For Oracle
Step - 1 Firstly, you need to download Virtual Box in order to install the Oracle for Linux. For
downloading the software, go to https:// www.virtualbox.com
Step -2 Then after directing on virtual box page, click on download virtual box for windows.
Step -3 Choosing your current Operating System to download and use appropriately.
Step -4 Then save the installation file to your folder destination
Step -5 Now install the virtual you just downloaded from the site. This will start the installation for
Virtual Box.
Step -6 A window like above picture will appear. Then click on Next continuously to Install the
VirtualBox.
Step -7 After successfully installing the virtual box, check if virtual box has been installed or not. If
yes, any operating system is ready to install in virtual box.
A. Installing PuTTy
Go to the link below to download the software. https://www.chiark.greenend.org.uk/~sgtatham/putty/
Step 1: Choose the putty version and download the setup file in a folder.
Step 2: Run the downloaded setup file and click on next until the software is installed. You can also
change the default location of file that is going to be installed.
Step 3: After completing the installation, Open the PuTTy to check whether it’s working or not.
Minimum Requirement
Some minimum requirements must be fulfilled for successful installation and configuration of Oracle
Database Server. If the requirement is not met then the system must be reinstalled or your hardware
must be upgraded.
4GB of RAM: It is necessary to operate and function properly for which 3GB of RAM is the
minimum requirement of Oracle 11G. For better and fast operations, you could have more RAM
than this or I prefer minimum of 4GB of RAM.
120GB of Hard Disk: For installing Oracle, 80GB hard disk is the minimum requirement of 11G to
work efficiently. I have given 120GB hard disk as per requirement.
20GB of / (root): It can be called as top-level directory. I have given 20GB of space to root.
20GB of /home: Since it contains all the files and folders of desktop, I have given 20GB of space
as home directory. If the home directory is not partitioned then the files will use the space of root
directory instead.
/tmp must have at least 400MB of space: if /tmp partition is created then the partition must be at
least 400 MB in size. Temporary partition needs huge space so that the installation can be
performed smoothly. I have given 20 GB space for temporary partition.
/boot must have at least 200MB of space: This partition uses space when the server is starting up.
200MB can be enough for boot partition.
5GB of swap space: Since swap space is set two times the amount of RAM whereas our RAM is
determined as 4GB. For the systems that have more than 2GB of RAM, the amount of swap space
can be one or two time the amount of RAM. The more RAM you have, it is less likely to use the
swap space. Even though swapping has advantages, it has also disadvantaged. I have given 10GB
as swap space while configuring.
Oracle file space: At least 1.5CB of space must be allocated for the most basic Oracle installation.
The amount size varies on the components you have chosen to install.
Oracle data files: You must have at least 2GB of space for basic sample database such as hr, sales,
superstore etc. This space can either be on a filesystem, or on an Oracle ASM (Automatic Storage
Management) disk group.
Installation of Linux
Step 1: Firstly, Open the Oracle Virtual Box and Click on create to install the Oracle Linux in
VirtualBox.
Step 2: A dialog box will appear. Here you’ll have to give the name of OS and choose the version of
OS.
Step 3: Then the RAM dialog box will appear. Here a user has to allocate the RAM for Virtual Box. I
have allocated 4GB as RAM for the OS.
Step 4: After clicking on Next, a virtual hard disk option will appear. You will also need to allocate the
file location and size of the virtual hard disk from your actual hard disk. I have allocated 200GB as the
hard disk for this operating system.
Step 7: Now Start the virtual machine to install the Operating System. After starting the machine a
screen will apeear which will say a disk is found. Choose skip for skipping media test and directly
starting the installation.
Step 8: Click on Next and select the English language. Then select the basic storage devices and discard
all the data.
Step 11: Then create multiple disks as follow and click on next and select Write changes to disk. This
will format and create filesystem or disks.
Step 12: After writing changes a screen will appear, click on next and a list of server name will appear.
Select the basic server and customize now button to configure the server.
Step 13: Next a screen will appear, select on desktops and the following features. (desktop, desktop
debugging, desktop platform, general purpose desktop, graphical administrative tools, kde desktop,
legacy x windows, x windows system.). Then click on next to start the installation process.
Step 14: After completing the installation, reboot of the OS will be needed. Then a screen will appear
saying welcome. Click on Forward and agree the agreements to license information. And also, do not
register your system in any case.
Step 15: After clicking on next, a create User Screen will appear. Click on Next with no information
given. Also click the next button on the date and time dialog box with no changes.
Step 16: Enable K-dump and click on finish to finalize the installation.
Step 17: Reboot your OS and check the Ip address by typing ifconfig in Terminal to successfully set up
the OS.
Post-Installation Procedures
After the installation of Linux Operating System, there are list of steps that must be done in order to
install Oracle 11G. These steps consist of configuration of yum, installation of grid, configuration of
kernel and also consists of adding user and group account on Oracle. It also includes creating
directories for the files of Oracle and its database files. These above steps are necessary to install the
Oracle Database 11 G Server.
Configuration of YUM
YUM (Yellowdog Update Modified) is a command-line that is open source and also graphical based
package management tool for RPM (RedHat Package Manager) on Linux Systems. It allows
administrator of system and also user of system to easily install, remove, update and search on software
packages of system.
To install yum, firstly you have to install required rpms. For installing RPMs, you’ll need to insert
Operating System DVD into the DVD-ROM. After successfully inserting the DVD you’ll need to make
a directory called stage. Then the files of the CD is copied to the directory we just made and then you’ll
have to install python-deltarpm and also create repository to successfully install RPMs
Moreover, you’ll need to edit the repo called packages. Repo where you’ll add your server name,
baseurl and other important factors. The following are the steps to install RPM’s in the system.
cd /stage/Disk1/Packages
rpm -ivh createrepo<TAB> deltarpm<TAB> python-deltarpm<TAB>
createrepo /stage/Disk1/Packages
cd /etc/yum.repos.d
vi packages.repo
[server]
name=server's packages
baseurl=file:///stage/Disk1/Packages
enabled=1
gpgcheck=0
After successfully installing required RPM’s you are ready to configure the YUM. To install YUM
you’ll need to switch as a root user. You’ll need to run the following codes to successfully configure
the YUM.
After successfully installing all the YUM packages, you’ll need to check whether yum is correctly
configured or not. To check the yum, you can install firefox or any other browser to make sure that yum
is correctly installed.
Configuring Kernel Parameters
In order to make Oracle Database Server work and function, some default resources of operating
system must be configured. These resources by default are set too low for the Oracle Database Server
11G to start and run properly but the Linux Operating system allows these parameters to dynamically
change without any reboot.
The parameters that are needed to be modified and configured are semaphore, shared meomory, max
number of open files and the port range that requires IP’s. Following should be added and configured to
configure to Kernel.
vi /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 982431744
kernel.shmmni = 4096
fs.file-max = 6815744
fs.aio-max-nr = 1048576
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
sysctl –p
vi /etc/security/limits.conf
setenforce 0
vi /etc/sysconfig/selinux
SELINUX=disabled
iptables -F
service iptables save
chkconfig iptables off
groupadd asmadmin
groupadd asmdba
groupadd asmoper
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,asmadmin,asmdba,asmoper -d /home/grid grid
useradd -g oinstall -G dba,oper,asmdba -d /home/oracle oracle
passwd grid
passwd oracle
Oracle Base: Used as the main directory for the Oracle tree
Oracle Inventory: This is used as the location for Oracle Installer.
Oracle Home: Here in this directory a software version is installed and is also a subdirectory of
Oracle Base.
For the data files of Oracle, the directory naming structure follows the convention of:
Mount_point/app/oracle
The typical mount point for Oracle data files can be /u01, /u02, /u03…. And /opt/oracle for the Oracle
home directory. The path for Oracle Inventory directory is oracle_base/oraInventory.
After the permission switch the root user to oracle and add the following code to bash_profile of user
Oracle.
After editing this document, switch the user again to grid and add the following code to bash_profile of
the grid user.
umask 022
This is the command that sets the default file creation mask. The mask 022 will create files with rw-
r--r—permissions or 644. This command is set on both the bash_profile of user and grid.
export TEMP=/tmp
export TMPDIR=/tmp
These above variables TEMP and TMPDIR should be set when you do not have sufficient space in
the directories. These above variables are added in both the bash_profile of oracle and grid.
fdisk /dev/sdb
In the same way, total of five disks are created. After creating these disks, reboot your Operating
System to save the changes.
Downloading and Installing Library for ASM
To install ASM (Automatic Storage Management), I have downloaded two libraries which I will install
as RPM. These two libraries listed below has to be installed as root user:
oracleasm-support-2.0.1-1.i386.rpm
oracleasmlib-2.0.1-1.i386.rpm
/etc/init.d/oracleasm configure
/etc/init.d/oracleasm createdisk VOL1 /dev/sda8
After completing the steps above, check the partitions whether if it is labelled to ASM or not. Then,
reboot the system to save the changes.
1. oracleasm listdisk
Installing Grid Infrastructure
Another thing that needs to be done before installing oracle is to install the grid infrastructure. Here we
will also create ASM disk group called DATA so that the file is stored equally in all the three disks.
These data are redundant so that the user can recover all the files even when database is corrupt. The
installation file can be found on the Operating System disk.
1. After tagging disk to ASM, you will need to unzip the grid files.
2. Then run the ./runInstaller file inside the above unzipped folder.
8. On the next step, you will need to set up the ASM password. We will use same password for all
the accounts.
9. Then choose the default operating system groups and click on next. These groups were created
manually by groupadd in the first period of grid installation.
10. These locations will also be default location, so you will not need to change the location as well
11. After clicking on next, the prerequisite check will check if the environment variable and kernel
were set correctly. If not then the check will fail.
12. After checking all the requirements, a summary will appear saying everything is fine and is
ready to install.
13. Click on install and wait for installation to be complete.
14. Finally, you’ll need to execute a root script as a root user to complete the installation. The
script is also given by the Installer
15. After completing the installation, reboot your system to save the changes.
Configuring ASM
If you wish to configure Automatic Storage Management (ASM), all you need to do is following points.
It will show adding or creating new disk group in the following while you can also mount and unmount
the disk from the ASM. Here disk group FRA is created.
1. You will firstly type asmca (Automatic Storage Management Configuration Assistant) in the
terminal of grid user.
2. Then asmca screen will appear with disk groups that exist.
3. Click on create and a create disk screen will appear. Choose the external redundancy and click on
both the remaining disk and also give the disk group name as FRA and click on Ok.
4. This will create a disk group called FRA and will take some time to complete. A disk group
message will show up after the completion.
Installing Oracle Database Infrastructure
Last thing to do before creating the database is to setup the database infrastructure. To install the
database infrastructure, two files from the OS disk image should be copied or unzipped. This will create
a directory called database where .runInstaller file can be found. After installing the file, database can
be successfully created.
1. Firstly, switch the user into oracle and copy the files from the Image file of OS.
2. Then, unzip both the files as below.
3. After unzipping both the files, it will create a directory called database. Inside the directory an
installation file will be found. Run the file for further installation(./runInstaller).
4. After running the file, an installation screen will appear where you will unselect the security
updates by Oracle Support and click on next.
5. Next select skip the software updates as below and click on next.
6. Since this is the first installation of database, select Install database software only.
7. Select Single Instance database and always choose English as default language.
10. Then, a prerequisite check will be performed to verify the target environment with the minimum
requirement and configuration requirement.
11. Finally, its ready to install. Click on install button and the installation will start.
12. In the middle of installation, a root script will popup which needs to be executed in the root
account.
13. After running the scripts in the root account, a message will be displayed saying installation is
successfully complete.
4. Next, a database name and SID would be required while creating the database. Click on next after
naming the database.
5. Choose the second one and confirm the password while setting up the database credentials.
6. Then select ASM as storage type and browse +DATA as database area and click on next.
7. Next, browse fast recovery as +FRA and leave the size to default for database recovery options.
8. Unselect the sample schemas and select the use Automatic Meomory Management in the next two
steps.
9. Click
next and
select
on create
10. Wait till the installation is complete. Then reboot the server.
Interacting database with a SQLTools
1. Firstly, download the tool called SQLTools from the Internet. It is free.
2. Then open the SQLTool, an Interface will appear. Fill up the username, password, host server ip
address, tcp port, SID and mode to connect with the database.
3. After clicking on Connect button after filling up the form, it will connect to that server as a user.
SID will define which database to connect.
4. Now after connecting to the database, users will be able to work on the database easily.
Firstly, Connect the server from SQLTools as sysdba. Only system administrator or user with the role
of dba can create tablespace.
Creating tablespace
isdigit:=FALSE;
m := length(password);
FOR i IN 1..10 LOOP
FOR j IN 1..m LOOP
IF substr(password,j,1) = substr(digitarray,i,1) THEN
isdigit:=TRUE;
GOTO findchar;
END IF;
END LOOP;
END LOOP;
IF isdigit = FALSE THEN
raise_application_error(-20008, 'Password must contain at least one digit, one character');
END IF;
After creating two profiles, I have created users according to my business need. Since my business
requirement is dependent on Super Store, Users can be accountant, Staff and also the analyst. Though
there is always a DBA user.
Auditing
Here I have done two type of auditing. Fine Grained Auditing and Standard Database Auditing. Run the
code below on SQLTools to audit the database.
Database Auditing
Auditing for hrdb
AUDIT ALL BY hrdb BY ACCESS;
AUDIT SELECT TABLE, UPDATE TABLE, INSERT TABLE, DELETE TABLE BY hrdb BY
ACCESS;
AUDIT EXECUTE PROCEDURE BY hrdb BY ACCESS;
SELECT db_user,extended_timestamp,object_schema,object_name,action
FROM v$xml_audit_trail
WHERE object_schema = 'hrdb'
ORDER BY extended_timestamp;
BEGIN
DBMS_FGA.add_policy(
object_schema => 'hrdb',
object_name => 'PRODUCT_INFORMATION',
policy_name => 'PRODUCT_INFORMATION_AUDIT',
audit_condition => NULL,
audit_column => NULL,
statement_types => 'SELECT,INSERT,UPDATE,DELETE');
END;
/statement_types => 'SELECT,INSERT,UPDATE,DELETE');
END;
/
EXEC dbms_fga.drop_policy('SuperStore','districtS','districts_AUDIT');
Fine grained Auditing for CUSTOMERS
BEGIN
DBMS_FGA.add_policy(
object_schema => 'hrdb',
object_name => 'CUSTOMERS',
policy_name => 'CUSTOMERS_AUDIT',
audit_condition => NULL,
audit_column => NULL,
statement_types => 'SELECT,INSERT,UPDATE,DELETE');
END;
/
To confirm
SELECT session_id,TIMESTAMP,db_user,
os_user,userhost,object_schema,
object_name,policy_name,statement_type,
sql_text FROM dba_fga_audit_trail;
SELECT * FROM dba_fga_audit_trail;
/
COMMIT;
Roles
Than after auditing role was defined.
RMAN
Catdb database has been created just like HRDB as sys user and following command was executed.
RMAN
CREATE TABLESPACE rman DATAFILE '+DATA/RMANH_DATAFILE'
SIZE 1000M AUTOEXTEND ON NEXT 100M
MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT
LOCAL SEGMENT SPACE MANAGEMENT AUTO;
RMAN Tablespace
CREATE USER rman IDENTIFIED BY rman
DEFAULT TABLESPACE rman
QUOTA UNLIMITED ON rman
ACCOUNT UNLOCK;
RMAN User
GRANT connect, resource, recovery_catalog_owner TO rman;
DROP TABLESPACE rman;
DROP USER rman;
DROP USER vpcuser;
Scheduling
After configuring RMAN, backup was made automated.
BEGIN
sys.dbms_scheduler.create_job(
job_name => '"SYS"."Full_backup"',
job_type => 'EXECUTABLE',
job_action => '/u01/app/sh/fullbackup.sh',
repeat_interval => 'FREQ=DAILY;BYDAY=SAT;BYHOUR=2;BYMINUTE=0;BYSECOND=0',
start_date => systimestamp at time zone 'America/New_York',
job_class => '"DEFAULT_JOB_CLASS"',
auto_drop => FALSE,
enabled => FALSE);
sys.dbms_scheduler.set_attribute( name => '"SYS"."Full_backup"', attribute => 'raise_events', value =>
dbms_scheduler.job_started + dbms_scheduler.job_succeeded + dbms_scheduler.job_failed);
sys.dbms_scheduler.enable( '"SYS"."Full_backup"' );
END;
Performing ETL
Making control file
Loading data into staging table
Making main table
Inserting into main table
LOAD DATA
LOAD DATA
LOAD DATA
LOAD DATA
LOAD DATA
Step 1
Step 2
Step 3
Step 4
Step 5 Step 6
Step 7 Step 8
Step 10
Step 9
Step 11 Step 12
Step 13
This code is used to connect with tableau to show the diagrams made in it
Installation of tableau