DB - To Prepare Linux OS for Oracle DB



PT : Preparar Linux para Base de Dados Oracle  
EN : To prepare Linux  for Oracle DB


OS INFO

[root@host ~]# uname -a

Linux host.mydomain.net 4.1.12-61.1.18.el7uek.x86_64 #2 SMP Fri Nov 4 15:48:30 PDT 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@host ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.3 (Maipo)
[root@host ~]# cat /etc/oracle-release 
Oracle Linux Server release 7.3

OS KERNEL PARAMETERS

cp /etc/sysctl.conf /etc/sysctl.conf.bakp

echo "fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
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 = 1048576" >> /etc/sysctl.conf 

[root@host ~]#  /sbin/sysctl -p

[root@host ~]#  /sbin/chkconfig boot.sysctl on
[root@host ~]#  reboot


ADD SWAP

root@host ~]#  dd if=/dev/zero of=/swapfile bs=1024 count=262144
262144+0 records in
262144+0 records out
268435456 bytes (268 MB) copied, 0.61773 s, 435 MB/s

[root@host ~]# mkswap /swapfile
Setting up swapspace version 1, size = 262140 KiB
no label, UUID=185a9ca6-730d-4952-a5f4-50c2879a95be

[root@host ~]# swapon /swapfile
swapon: /swapfile: insecure permissions 0644, 0600 suggested.

[root@host ~]# chmod 0600 /swapfile

[root@host ~]# # echo "/swapfile               swap                    swap    defaults        0 0" >> /etc/fstab
root@host ~]# vi /etc/fstab


FS INFO

[root@host u01]# df

Filesystem          1K-blocks    Used Available Use% Mounted on
devtmpfs              1867416       0   1867416   0% /dev
tmpfs                 1891012     156   1890856   1% /dev/shm
tmpfs                 1891012    8964   1882048   1% /run
tmpfs                 1891012       0   1891012   0% /sys/fs/cgroup
/dev/mapper/ol-root  10258432 4938200   5320232  49% /
/dev/sda1             1038336  214244    824092  21% /boot
tmpfs                  378204      12    378192   1% /run/user/1000
/dev/sr0                57088   57088         0 100% /run/media/oracle/VBOXADDITIONS_5.0.30_112061
tmpfs                  378204       0    378204   0% /run/user/0

ADD A NEW DISK

[root@host ~]# fdisk -l 


Disk /dev/sda: 12.9 GB, 12884901888 bytes, 25165824 sectors

Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0005b7ac

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200    25165823    11533312   8e  Linux LVM

Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors

Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/ol-root: 10.5 GB, 10515120128 bytes, 20537344 sectors

Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/ol-swap: 1287 MB, 1287651328 bytes, 2514944 sectors

Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@host ~]# fdisk -l /dev/sdb


Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors

Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@host ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors

Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


[root@host ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0xeda68212.

Command (m for help): m

Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): n

Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-104857599, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): 
Using default value 104857599
Partition 1 of type Linux and of size 50 GiB is set

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@host ~]# fdisk -l /dev/sdb*


Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors

Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xeda68212

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048   104857599    52427776   83  Linux

Disk /dev/sdb1: 53.7 GB, 53686042624 bytes, 104855552 sectors

Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@host ~]#  mkfs.xfs -L fs4oracle /dev/sdb1

meta-data=/dev/sdb1              isize=256    agcount=4, agsize=3276736 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0, sparse=0
data     =                       bsize=4096   blocks=13106944, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=6399, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0


MOUNT FILESYSTEM


[root@host ~]# mkdir /u01 

[root@host ~]# mount /dev/sdb1 /u01
[root@host ~]# df -h | grep -i u01
/dev/sdb1             50G   33M   50G   1% /u01

[root@host ~]# mount | grep -i u01

/dev/sdb1 on /u01 type xfs (rw,relatime,seclabel,attr2,inode64,noquota)

[root@host ~]# vi  /etc/fstab 

[root@host ~]# umount /u01
[root@host ~]# mount | grep -i u01
[root@host ~]# mount -a
[root@host ~]# mount | grep -i u01
/dev/sdb1 on /u01 type xfs (rw,relatime,seclabel,attr2,inode64,noquota)


FS INFO

[root@host u01]# df


Filesystem          1K-blocks    Used Available Use% Mounted on
....
/dev/sdb1            52402180   32960  52369220   1% /u01


ADD GROUPS AND USERS AND DIRECTORIES 
*minimal

[root@host u01]# groupadd -g 54321 oinstall
[root@host u01]# groupadd -g 54322 dba
[root@host u01]# useradd -u 54321 -g oinstall -G dba oracle
[root@host u01]# useradd -u 54322 -g oinstall -G dba grid

[root@host u01]# mkdir -p /u01/app/grid
[root@host u01]# mkdir -p /u01/app/oracle
[root@host u01]# chown -R grid:oinstall /u01
[root@host u01]# chown oracle:oinstall /u01/app/oracle
[root@host u01]# chmod -R 775 /u01

INSTALL RPMSs

[root@host u01]#  yum install binutils \
compat-libcap1 compat-libstdc++ gcc gcc-c++ \
glibc glibc-devel ksh \
libaio libaio-devel libgcc libstdc++ libstdc++-devel \
libXi libXtst make sysstat \
unixODBC unixODBC-devel

RELATED READING

http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm
http://docs.oracle.com/database/121/LADBI/toc.htm
http://www.oracle.com/technetwork/articles/servers-storage-admin/ginnydbinstallonlinux-488779.html


-----
Obrigado pela leitura, espero que este post o tenha ajudado :)
Thank you for reading, hope this post was helpful  :) 

Comments