Sunday, 10 May 2020

Oracle DB installation on ASM(automatic storage management)


ASM-RAC installation require the installation of oracle grid before installing DB.

Installation of Grid Infrastructure on CentOS Linux release 7.6.1810 (Core)

Download given from Oracle for testing we have used Oracle 12c Release 2

linuxx64_12201_database.zip and linuxx64_12201_grid_home.zip

yum install kmod-oracleasm
yum install oracleasm-support
wget http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.12-1.el6.x86_64.rpm
wget http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.4-1.el6.x86_64.rpm
rpm -ivh oracleasmlib-2.0.12-1.el6.x86_64.rpm
rpm -ivh oracleasmlib-2.0.4-1.el6.x86_64.rpm

groupadd -g 54327 asmdba; groupadd -g 54328 asdoper; groupadd -g 54329 asmadmin
# id oracle
uid=1000(oracle) gid=1000(oracle) groups=1000(oracle),10(wheel),1001(oinstall),54327(asmdba),54329(asmadmin),54331(backupdba),54333(dgdba),54334(kmdba),54335(asmoper)
[root@centos02 ~]# id grid
uid=1001(grid) gid=1001(oinstall) groups=1001(oinstall),1000(oracle),54327(asmdba),54329(asmadmin),54331(backupdba),54335(asmoper),54336(racdba)

multiple 2G disk and created partition using fdisk /dev/sdd
press n and select all default and w
repeat for all drive

oracleasm configure -i
oracleasm init
oracleasm createdisk crs1 /dev/sdb1
oracleasm createdisk crs2 /dev/sdc1
oracleasm createdisk crs3 /dev/sdd1

oracleasm createdisk data1 /dev/sdc1
oracleasm createdisk fra1 /dev/sdd1

[root@centos02 disks]# pwd
/dev/oracleasm/disks
[root@centos02 disks]# ls -ltr
total 0
brw-rw----. 1 grid oinstall 8, 33 May 10 02:04 DATA1
brw-rw----. 1 grid oinstall 8, 49 May 10 02:04 FRA1
brw-rw----. 1 grid oinstall 8, 81 May 10 04:46 CRS3
brw-rw----. 1 grid oinstall 8, 65 May 10 04:46 CRS2
brw-rw----. 1 grid oinstall 8, 17 May 10 04:46 CRS1
[root@centos02 disks]#


[root@centos02 dev]# mkdir -p /u01/app/oracle/product/12.2.0/db_home
[root@centos02 dev]# chown -R oracle:oinstall /u01
[root@centos02 dev]# mkdir -p /u01/app/grid/12.2.0/grid_home
[root@centos02 dev]# chown -R grid:oinstall /u01/app/grid
[root@centos02 dev]# chmod -R 775 /u01

Edit .bash_profile for grid user

vi /home/grid/.bash_profile
if [ -f ~/.bashrc ] ; then
. ~/.bashrc
fi
ORACLE_SID=+ASM; export ORACLE_SID
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
ORACLE_HOME=/u01/app/grid/12.2.0/grid_home; export ORACLE_HOME
JAVA_HOME=/usr/bin/java ; export JAVA_HOME
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN

/u01/app/grid/12.2.0/grid_home
[grid@centos02 grid_home]$ unzip linuxx64_12201_grid_home.zip
[grid@centos02 grid_home]$ ./gridSetup.sh

Follow wizard.  Step 10 shows selected


[grid@centos02 grid_home]$ ps -ef | grep -i pmon
grid      1426     1  0 04:08 ?        00:00:00 asm_pmon_+ASM
[grid@centos02 grid_home]$ asmca


[grid@centos02 grid_home]$ sqlplus sys as sysasm;

SQL*Plus: Release 12.2.0.1.0 Production on Sun May 10 05:41:10 2020

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Enter password:
Connected to an idle instance.

SQL> startup
ASM instance started

Total System Global Area 1140850688 bytes
Fixed Size                  8629704 bytes
Variable Size            1107055160 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
SQL> select instance_name, status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
+ASM             STARTED


Troubleshooting
------------------------------------------------------------------------------------------------------------------------

ora:12457 TNS:lost connection
chmod 6751 $ORACLE_HOME/bin/oracle
chmod 6751 $GRID_HOME/bin/oracle

The above permission are required to have DG group available in DBCA. If suid and guid are needed.  Better to change the mount option and remove nosuid.

Oracle High Availability Service not start
Start Oracle High Availability service
crsctl status resource -t
crsctl start has

--------------------------------------------------------------------------------------------------------------------------


su - oracle

[oracle@centos02 ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

ORACLE_HOSTNAME=centos02; export ORACLE_HOSTNAME
ORACLE_SID=orcl; export ORACLE_SID
ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_home; export ORACLE_HOME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin
export PATH

cd /u01/app/oracle/product/12.2.0/
unzip linuxx64_12201_database.zip
cd database
./runInstaller




once DB creation is complete using oracle user

$sqlplus sys as sysdba

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
+DATA/ORCL/DATAFILE/system.256.1040061529
+DATA/ORCL/DATAFILE/sysaux.257.1040061691
+DATA/ORCL/DATAFILE/undotbs1.258.1040061771
+DATA/ORCL/4700A987085B3DFAE05387E5E50A8C7B/DATAFILE/system.266.1040061997
+DATA/ORCL/4700A987085B3DFAE05387E5E50A8C7B/DATAFILE/sysaux.265.1040061997
+DATA/ORCL/DATAFILE/users.259.1040061779
+DATA/ORCL/4700A987085B3DFAE05387E5E50A8C7B/DATAFILE/undotbs1.267.1040061997
+DATA/ORCL/A54DDDE3191E4A19E0530A97A8C039F7/DATAFILE/system.271.1040063257
+DATA/ORCL/A54DDDE3191E4A19E0530A97A8C039F7/DATAFILE/sysaux.272.1040063257
+DATA/ORCL/A54DDDE3191E4A19E0530A97A8C039F7/DATAFILE/undotbs1.270.1040063257
+DATA/ORCL/A54DDDE3191E4A19E0530A97A8C039F7/DATAFILE/users.274.1040063397

11 rows selected.

SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DATA/ORCL/CONTROLFILE/current.260.1040061903
+FRA/ORCL/CONTROLFILE/current.256.1040061903

SQL> select name, open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
ORCL      READ WRITE

SQL> select instance_name, status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
orcl             OPEN


Bye...