Wednesday, 11 November 2020

 

Restart Enable Database OR ADD & Remove Database with Modify in ASM/CRS as Services 12CR1

 

ADD Database in ASM/Cluster Services for Auto Start & Stop (Reboot)

 1- Add Database in OCR from Oracle User

 [oracle@oda12 ~]$ hmdb     ------------------------- (Environment write in .bash_profile)

 [oracle@oda12 ~]$ cd $ORACLE_HOME

[oracle@oda12 db_1]$ pwd

 /u01/app/oracle/product/12.1.0/db_1

 [oracle@oda12 db_1]$ srvctl add database -d hmdb -o /u01/app/oracle/product/12.1.0/db_1

 Note: 

When we add database in ASM Services we will use switch “–o”. Its mean you are defining Oracle Home like above and if you perfume database adding step from grid user you will face below mention error.   

 [grid@oda12 ~]$ srvctl add database -d hmdb -o /u01/app/oracle/product/12.1.0/db_1

 PRCD-1025 : Failed to create database hmdb

 PRKH-1014 : Current user "grid" is not the oracle owner user "oracle" of oracle home "/u01/app/oracle/product/12.1.0/db_1"

 2- Check Status of Database from Grid User

 [grid@oda12 ~]$ srvctl status database -db HMDB

Database is not running.

 3- Start Database & Check Again Status of Database from Grid User

 [grid@oda12 ~]$ srvctl start database -db HMDB

 [grid@oda12 ~]$ srvctl status database -db HMDB

Database is running.

 [grid@oda12 ~]$ crsctl stat res -t

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

Name           Target  State        Server                   State details

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

Local Resources

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

ora.CRS.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.DATA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.FRA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.HMDB_LSN.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.LISTENER.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.asm

               ONLINE  ONLINE       oda12                    Started,STABLE

ora.ons

               OFFLINE OFFLINE      oda12                    STABLE

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

Cluster Resources

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

ora.cssd

      1        ONLINE ONLINE       oda12                    STABLE

ora.diskmon

      1        OFFLINE OFFLINE                               STABLE

ora.evmd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.hmdb.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

ora.orcl.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

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

[grid@oda12 ~]$

[oracle@oda12 db_1]$ sqlplus / as sysdba

 SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 29 01:47:26 2020

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

 Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics

and Real Application Testing options

 SQL> show parameter db_name

 NAME                                 TYPE        VALUE

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

db_name                              string      hmdb

 SQL> select INSTANCE_NAME,STATUS,VERSION from v$INSTANCE;

 INSTANCE_NAME    STATUS       VERSION

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

hmdb             OPEN         12.1.0.2.0

 SQL> col NAME format a70

 SQL> select name from v$datafile;

 NAME

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

+DATA/HMDB/DATAFILE/system.267.1053832677

+DATA/HMDB/DATAFILE/sysaux.268.1053832775

+DATA/HMDB/DATAFILE/undotbs1.269.1053832851

+DATA/HMDB/DATAFILE/users.271.1053832873

 SQL>

[root@oda12 ~]# reboot

login as: oracle

oracle@192.168.10.10's password:

Last login: Thu Oct 29 01:35:00 2020

[oracle@oda12 ~]$ hmdb

[oracle@oda12 ~]$ sqlplus / as sysdba

 SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 29 02:17:28 2020

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

 Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics

and Real Application Testing options

 SQL> show parameter db_name

 NAME                                 TYPE        VALUE

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

db_name                              string      hmdb

 SQL> select INSTANCE_NAME,STATUS,VERSION from v$INSTANCE;

 INSTANCE_NAME    STATUS       VERSION

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

hmdb             OPEN         12.1.0.2.0

 SQL>  col NAME format a70

 SQL> select name from v$datafile;

 NAME

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

+DATA/HMDB/DATAFILE/system.267.1053832677

+DATA/HMDB/DATAFILE/sysaux.268.1053832775

+DATA/HMDB/DATAFILE/undotbs1.269.1053832851

+DATA/HMDB/DATAFILE/users.271.1053832873

 SQL>

 Note: Database is Properly Start and Stop.

 4- Check Database Configuration from Grid User

 [grid@oda12 ~]$ srvctl config database -d hmdb

Database unique name: hmdb

Database name:

Oracle home: /u01/app/oracle/product/12.1.0/db_1

Oracle user: oracle

Spfile:

Password file:

Domain:

Start options: open

Stop options: immediate

Database role: PRIMARY

Management policy: AUTOMATIC

Disk Groups: DATA,FRA

Services:

OSDBA group:

OSOPER group:

Database instance: hmdb

[grid@oda12 ~]$

                                 Remove Database from Cluster Services

 1- Check Database Status from Grid User

 [grid@oda12 ~]$ srvctl status database -d HMDB

Database is running.

 [grid@oda12 ~]$ crsctl stat res -init -t

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

Name           Target  State        Server                   State details

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

Local Resources

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

ora.CRS.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.DATA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.FRA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.HMDB_LSN.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.LISTENER.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.asm

               ONLINE  ONLINE       oda12                    Started,STABLE

ora.ons

               OFFLINE OFFLINE      oda12                    STABLE

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

Cluster Resources

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

ora.cssd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.diskmon

      1        OFFLINE OFFLINE                               STABLE

ora.evmd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.hmdb.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

ora.orcl.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

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

2- Stop Database from Grid User 

[grid@oda12 ~]$ srvctl stop database -db HMDB

3- Remove Database into OCR from Grid User

 [grid@oda12 ~]$ srvctl remove  database -db HMDB –f

 OR

 [grid@oda12 ~]$ srvctl remove  database -db HMDB

PRKO-3141 : Database HMDB could not be removed because it was running

 Note:

If Your Database is running so you will remove your database with switch “–f” for force fully. 

 4- Check Database Status Again from Grid User

 [grid@oda12 ~]$ srvctl status database -db HMDB

PRCD-1120 : The resource for database HMDB could not be found.

PRCR-1001 : Resource ora.hmdb.db does not exist

 [grid@oda12 ~]$ crsctl stat res -init -t

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

Name           Target  State        Server                   State details

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

Local Resources

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

ora.CRS.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.DATA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.FRA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.HMDB_LSN.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.LISTENER.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.asm

               ONLINE  ONLINE       oda12                    Started,STABLE

ora.ons

               OFFLINE OFFLINE      oda12                    STABLE

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

Cluster Resources

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

ora.cssd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.diskmon

      1        OFFLINE OFFLINE                               STABLE

ora.evmd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.orcl.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

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

 [oracle@oda12 admin]$ sqlplus / as sysdba

 SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 29 03:00:28 2020

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

 Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics

and Real Application Testing options

 SQL> show parameter db_name

 NAME                                 TYPE        VALUE

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

db_name                              string      hmdb

 SQL> select INSTANCE_NAME, STATUS, VERSION from v$INSTANCE;

 INSTANCE_NAME    STATUS       VERSION

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

hmdb             OPEN         12.1.0.2.0

 SQL>

SQL> exit

Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics

and Real Application Testing options

[oracle@oda12 admin]$ exit

logout

 [root@oda12 ~] # reboot

 PolicyKit daemon disconnected from the bus.

We are no longer a registered authentication agent.

login as: root

root@192.168.10.10's password:

Last login: Thu Oct 29 01:29:31 2020 from 192.168.10.9

 [root@oda12 ~]# su - oracle

Last login: Thu Oct 29 01:26:01 PKT 2020 on pts/1

 [oracle@oda12 ~]$ hmdb     ------------------------- (Environment write in .bash_profile)

[oracle@oda12 ~]$ sqlplus / as sysdba

 SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 29 01:35:10 2020

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

 Connected to an idle instance.

 SQL>

 [grid@oda12 ~]$ srvctl status database -db HMDB

PRCD-1120 : The resource for database HMDB could not be found.

PRCR-1001 : Resource ora.hmdb.db does not exist

 [grid@oda12 ~]$ crsctl stat res -init -t

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

Name           Target  State        Server                   State details

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

Local Resources

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

ora.CRS.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.DATA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.FRA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.HMDB_LSN.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.LISTENER.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.asm

               ONLINE  ONLINE       oda12                    Started,STABLE

ora.ons

               OFFLINE OFFLINE      oda12                    STABLE

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

Cluster Resources

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

ora.cssd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.diskmon

      1        OFFLINE OFFLINE                               STABLE

ora.evmd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.orcl.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

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

 [grid@oda12 ~]$ crsctl stat res -t

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

Name           Target  State        Server                   State details

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

Local Resources

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

ora.CRS.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.DATA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.FRA.dg

               ONLINE  ONLINE       oda12                    STABLE

ora.HMDB_LSN.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.LISTENER.lsnr

               ONLINE  ONLINE       oda12                    STABLE

ora.asm

               ONLINE  ONLINE       oda12                    Started,STABLE

ora.ons

               OFFLINE OFFLINE      oda12                    STABLE

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

Cluster Resources

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

ora.cssd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.diskmon

      1        OFFLINE OFFLINE                               STABLE

ora.evmd

      1        ONLINE  ONLINE       oda12                    STABLE

ora.orcl.db

      1        ONLINE  ONLINE       oda12                    Open,STABLE

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

             ADD Database Spfile in ASM/CRS through Modification

1- Source DBS Environment and Check Spfile Location

[oracle@oda12 ~]$ hmdb

[oracle@oda12 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 29 21:45:18 2020

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

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics

and Real Application Testing options

SQL> show parameter spfile

NAME                              TYPE         VALUE

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

spfile                                string       /u01/app/oracle/product/12.1.0/db_1/dbs/spfilehmdb.ora

2- Create Pfile and Check Pfile is Creating in Default Location

SQL> create pfile from spfile;

File created.

SQL> exit

Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics

and Real Application Testing options

[oracle@oda12 ~]$ cd $ORACLE_HOME/dbs

[oracle@oda12 dbs]$ ls init

inithmdb.ora init.ora      initorcl.ora

[oracle@oda12 dbs]$ ls inithmdb.ora

inithmdb.ora

[oracle@oda12 dbs]$ pwd

/u01/app/oracle/product/12.1.0/db_1/dbs

[oracle@oda12 dbs]$ ls /u01/app/oracle/product/12.1.0/db_1/dbs/inithmdb.ora

/u01/app/oracle/product/12.1.0/db_1/dbs/inithmdb.ora

3- Create Spfile in ASM File (Disk Group)

[oracle@oda12 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 29 22:18:57 2020

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

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics

and Real Application Testing options

SQL> create spfile='+DATA' from pfile='/u01/app/oracle/product/12.1.0/db_1/dbs/inithmdb.ora';

File created.

4- Check Spfile Location ASM File (Disk Group) from Grid User

 [grid@oda12 ~]$ asmcmd

ASMCMD> cd DATA

ASMCMD> ls

HMDB/

ORCL/

ASMCMD> cd HMDB

ASMCMD> ls

BACKUPSET/

CONTROLFILE/

DATAFILE/

ONLINELOG/

PARAMETERFILE/

TEMPFILE/

ASMCMD> cd PARAMETERFILE/

ASMCMD> ls

spfile.277.1055110761

ASMCMD> find +data sp*

+data/HMDB/PARAMETERFILE/spfile.277.1055110761

+data/ORCL/PARAMETERFILE/spfile.265.1052778363

5- Add and Modify Spfile in ASM/CRS from Grid User

[grid@oda12 ~]$ srvctl config database -d hmdb

Database unique name: hmdb

Database name:

Oracle home: /u01/app/oracle/product/12.1.0/db_1

Oracle user: oracle

Spfile:

Password file:

Domain:

Start options: open

Stop options: immediate

Database role: PRIMARY

Management policy: AUTOMATIC

Disk Groups: DATA, FRA

Services:

OSDBA group:

OSOPER group:

Database instance: hmdb

[oracle@oda12 dbs]$ srvctl modify database -d hmdb -p +data/HMDB/PARAMETERFILE/spfile.277.1055110761

[grid@oda12 ~]$ srvctl config database -d hmdb

Database unique name: hmdb

Database name:

Oracle home: /u01/app/oracle/product/12.1.0/db_1

Oracle user: oracle

Spfile: +data/HMDB/PARAMETERFILE/spfile.277.1055110761

Password file:

Domain:

Start options: open

Stop options: immediate

Database role: PRIMARY

Management policy: AUTOMATIC

Disk Groups: DATA, FRA

Services:

OSDBA group:

OSOPER group:

Database instance: hmdb

6- Verify The Database is Running with newly migrate Spfile from Oracle User

[oracle@oda12 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 29 22:24:07 2020

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

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics

and Real Application Testing options

SQL> show parameter spfile

NAME                            TYPE        VALUE

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

spfile                              string      /u01/app/oracle/product/12.1.0/db_1/dbs/spfilehmdb.ora

7- Stop Then Start database from Grid user

[grid@oda12 ~]$ srvctl stop database -d hmdb

[grid@oda12 ~]$ srvctl start database -d hmdb

8- Verify Again the Database is Running with newly migrate Spfile from Oracle User

[oracle@oda12 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 29 22:26:03 2020

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

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics

and Real Application Testing options

SQL> show parameter spfile

NAME                             TYPE       VALUE

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

spfile                               string      +DATA/HMDB/PARAMETERFILE/spfile.277.1055110761

Completed.

Note: My Future Post Will Linked with this Post

How TO Install DBS Out of ASM with Oracle Restart Enabled Single Instance


Note:
We will create hmdb database environment with recommended Path
 
$ vi  hmdb.env

# for oracle
 
TMP=/tmp;
TMPDIR=/tmp;
 
ORACLE_BASE=/u01/app/oracle;
ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1;
ORACLE_SID=hmdb;
ORACLE_HOSTNAME=oda12.oracle.com;
ORACLE_UNQNAME=hmdb;
TZ=Etc/GMT-5;
LD_LIBRARY_PATH=$ORACLE_PATH/lib:/lib:/usr/lib;
PATH=$ORACLE_HOME/bin:$PATH;
EDITOR=vi;
CLASS_PATH=$ORACLE_HOME/Jre;
export TMP TMPDIR ORACLE_BASE ORACLE_HOME ORACLE_SID ORACLE_HOSTNAME ORACLE_UNQNAME TZ PATH EDITOR LD_LIBRARY_PATH CLASS_PATH
 
$dbca

Select : Create Database

Click : Next

Global Database Name: hmdb

Storage Type: File System

Database File Location: {ORACLE_BASE}/oradata

Fast Recovery Area: :{ORACLE_BASE}/fast_recovery_area

Database Character Set: AL32UTF8

Administrative Password: Admin_6677

Confirm Password: Admin_6677

[Uncheck] Create As Container Database

Click: Next

Click: Finish



Click: Close

Note: 

Oracle Restart Enabled option automatically configure when you will create database through DBCA Utility.

 Completed.

Note: My Future Post Will Linked with this Post.

How to Installation Linux and Grid Infrastructure Installation with Database Creation in ASM Storage

Installation of Linux 7.5 64bit

Operating System : Oracle Enterprise Linux 7.564it
Database & Grid Software : 12.1.0.2.0 64Bit EE
Space for OS Installation: 100GB
RAM : 4.2 GB 

Note:
Minimum RAM is recommended for grid Infrastructure. 
 
Click:-  Create a New Virtual Machine

Click:- Next with Typical (Recommended) Option

Select :- I will install the operating system later. Option and Click:- Next 


Select :- Linux option with version there you will use. Click:- Next

Write:- Virtual Machine Name and Machine. Click:- Next

Name: grid_oda

Location: E:\grid_oda

Write: -Storage for Machine and Select: - Split virtual disk into multiple files Click: - Next

Storage: 100GB

Click: - Customize Hardware

Memory   : 4096 (4GB)

Processor : 2 and 1

Select:- ISO Image file I Selected Linux 7.5 64bit

Select: - Network and Display setting as per Images

Click: - Close and Finish 

Set Operation System Configuration Gird Infrastructure and Data

   

1- Disbale Selinux (selinux must disabled)

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

$ getenforce

$ getenforce 0

$ sestatus

$ vi /etc/selinux/config

 # This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=enforcing            ------------ Change it (SELINUX=disabled)

# SELINUXTYPE= can take one of these two values:

#     targeted - Targeted processes are protected,

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

$ reboot

2- Disbale Firewall

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

$ systemctl status  firewalld.service

$ systemctl stop firewalld.service

$ systemctl disable  firewalld.service

$ systemctl status  firewalld.service

 3- Set Host file  

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

 $ vi /etc/hosts

 192.168.10.10    oda12.oracle.com oda12

 :wq!

 4- Install RPM for Oracle Database and Grid ASM CRS/SRV

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

 $ su - root

$ cd /u01/binary/Drv7.5/drv7.5/

 $ mkdir /media/cdrom

 $ mount /dev/sr0 /media/cdrom

 $ cp media.repo /etc/yum.repos.d/

 $ cd /media/cdrom/Packages/

 $ yum --disablerepo=\* --enablerepo=media install oracle-database-server-12cR2-preinstall-1.0-3.el7.x86_64

 $ ls *.rpm

oracleasmlib-2.0.12-1.el7.x86_64.rpm  oracleasm-support-2.1.11-2.el7.x86_64.rpm

 $ cd /u01/binary

 $ rpm -ivh oracleasmlib-2.0.12-1.el7.x86_64.rpm

 $ rpm -ivh oracleasm-support-2.1.11-2.el7.x86_64.rpm

 Note:

when we Installed Oracle Database preinstall rpm, rpm create oracle user, grid user and dba and oinstall group.

 Grid recommendation: 

You will create groups with fix IDs that`s why we will delete all users and groups and we will create all users and groups manually with fix Ids. 

 5- Users Delete on

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

 userdel oracle

userdel grid

 6- Group delete on both Machine or Node

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

 groupdel dba

groupdel oinstall

 7- User Drictory delete on both Machine or Node

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

 rm -rf /home/oracle

rm -rf /home/grid

 8- Add Group on both Machine or Node

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

 groupadd -g 1000 oinstall

groupadd -g 1100 asmadmin

groupadd -g 1200 dba

groupadd -g 1201 oper

groupadd -g 1300 asmdba

groupadd -g 1301 asmoper

9- Add user on both machine or node

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

useradd -u 1100 -g oinstall -G dba,asmadmin,asmdba,asmoper -d /home/grid -s /bin/bash -c "GI Owner" grid

useradd -u 1101 -g oinstall -G dba,asmdba,oper -d /home/oracle -s /bin/bash -c "OR Owner" oracle

10- Show Error (We can igrnore this error because of pervious oracle user some file available in "bin/bash"

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

 Creating mailbox file: File exists

 11- Create Directory for Oracle & Grid on OS

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

 mkdir -p /u01/app/grid

mkdir -p /u01/app/grid/product/12.1.0/home

mkdir -p /u01/app/oracle/product/12.1.0/db_1

mkdir -p /u01/app/oraInventory

 12- Set Users Password Oracle,Grid on OS

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

 passwd grid        (password=grid)

passwd oracle   (password=oracle)

 13- Change Ownership on Directories

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

 chown -R grid:oinstall /u01/app/grid

chown -R grid:oinstall /u01/app/oraInventory

chown -R grid:oinstall /u01/app/grid

chown -R oracle:oinstall /u01/app/oracle

chmod -R 775 /u01

 14- Write Bash_Profile for "GRID USER"

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

 vi /home/grid/.bash_profile

 # for Grid

 TMP=/tmp;

TMPDIR=/tmp;

 ORACLE_BASE=/u01/app/grid;

ORACLE_HOME=/u01/app/grid/product/12.1.0/home;

ORACLE_SID=+ASM;

PATH=$ORACLE_HOME/bin:$PATH;

EDITOR=vi;

 export TMP TMPDIR ORACLE_BASE ORACLE_HOME ORACLE_SID PATH EDITOR

export PATH

 :wq!

 15- Write Bash_Profile for "ORACLE USER"

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

vi /home/oracle/.bash_profile

 # for oracle

 TMP=/tmp;

TMPDIR=/tmp;

 ORACLE_BASE=/u01/app/oracle;

ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1;

ORACLE_SID=orcl;

ORACLE_HOSTNAME=oda12.oracle.com;

ORACLE_UNQNAME=orcl;

TZ=Etc/GMT-5;

LD_LIBRARY_PATH=$ORACLE_PATH/lib:/lib:/usr/lib;

PATH=$ORACLE_HOME/bin:$PATH;

EDITOR=vi;

CLASS_PATH=$ORACLE_HOME/Jre;

 export TMP TMPDIR ORACLE_BASE ORACLE_HOME ORACLE_SID ORACLE_HOSTNAME ORACLE_UNQNAME TZ PATH EDITOR LD_LIBRARY_PATH CLASS_PATH

export PATH

 :wq!

 16- Add New Limit for Grid "limits.conf" (oracle preinstall rpm alredy set Limit for Oracle DBS)

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

vi /etc/security/limits.conf

 grid soft nproc 2047

grid hard nproc 16384

grid soft nofile 1024

grid hard nofile 65536

VM Tab -> Settings... 

Click: Add...

Select: Hard Disk

Click: Next

Click: SCSI (Recommended)

Click: Next

Select: Create a new virtual disk

Click: Next

Maximum disk size (GB): 10

Select: Allocate all disk space now.

Select: Split virtual disk into multiple files

Click: Next

Click: Finish

1) Two Disks add 10 10 GB for CRS (AMS Cluster Installation)

2) Two Disks add 10 10 GB for FRA (Archive log and Backup)

3) Two Disks Add 20 20 GB for DATA (Database Only)

OS Disk Partition Formatting for Ready to Use

Note:  Perform All steps on ROOT User

1- Disk Formatting

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

$  fdisk -l

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 0x63812638.

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): 1

First sector (2048-20971519, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519):

Using default value 20971519

Partition 1 of type Linux and of size 10 GiB is set

Command (m for help): w

The partition table has been altered!

$ fdisk /dev/sdc

$ fdisk /dev/sdd

$ fdisk /dev/sde

$ fdisk /dev/sdf

$ fdisk /dev/sdg

Note:  All disks format as per above practice.

2- Listing Of Format Disk

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

$ fdisk -l

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 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: 0x63812638

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048    20971519    10484736   83  Linux

Note: All Disk show like this.

3- Configuring the Oracle ASM library

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

$ oracleasm configure -i

Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library

driver.  The following questions will determine whether the driver is

loaded on boot and what permissions it will have.  The current values

will be shown in brackets ('[]').  Hitting <ENTER> without typing an

answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface []: grid

Default group to own the driver interface []: asmadmin

Start Oracle ASM library driver on boot (y/n) [n]: y

Scan for Oracle ASM disks on boot (y/n) [y]:

Writing Oracle ASM library driver configuration: done

3- Start Oracle ASM library

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

$ /etc/init.d/oracleasm start

/etc/init.d/oracleasm is deprecated in favor of userspace tool: /usr/sbin/oracleasm

############# OR #############

$ /usr/sbin/oracleasm init

Creating /dev/oracleasm mount point: /dev/oracleasm

Loading module "oracleasm": oracleasm

Configuring "oracleasm" to use device physical block size

Mounting ASMlib driver filesystem: /dev/oracleasm

4- Create Disk Label for AMS

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

/usr/sbin/oracleasm createdisk DISK1 /dev/sdb1

Writing disk header: done

Instantiating disk: done

$ /usr/sbin/oracleasm createdisk DISK2 /dev/sdc1

$  /usr/sbin/oracleasm createdisk DISK3 /dev/sdd1

$ /usr/sbin/oracleasm createdisk DISK4 /dev/sde1

$  /usr/sbin/oracleasm createdisk DISK5 /dev/sdf1

$  /usr/sbin/oracleasm createdisk DISK6 /dev/sdg1

$ cd /dev/oracleasm/disks/

$ ls -lrt

total 0

brw-rw---- 1 grid asmadmin 8, 17 Oct  1 19:47 DISK1

brw-rw---- 1 grid asmadmin 8, 33 Oct  1 19:48 DISK2

brw-rw---- 1 grid asmadmin 8, 49 Oct  1 19:48 DISK3

brw-rw---- 1 grid asmadmin 8, 65 Oct  1 19:48 DISK4

brw-rw---- 1 grid asmadmin 8, 81 Oct  1 19:49 DISK5

brw-rw---- 1 grid asmadmin 8, 97 Oct  1 19:50 DISK6

Installation of Grid Infrastructure

Select :- Install and Configure Oracle Grid Infrastructure for a Standalone Server  Click :- Next

Click: - Next

Disk group name: CRS

Redundancy: Normal [O]

 High      :  Three disk mirroring with the same size of disk.  

Normal :  Two disk mirroring with the same size of disk.

External: Single disk no mirroring.

Candidate Disks [O]

Click: - Next

Note:  We are just installing cluster service with sprite group this disk group dedicated for ASM Configuration    

Select: - Use same passwords for these accounts [o]

Select: - sys password option [Admin_6677] Click: - Next

Note: 

Sys Password option and write sys password there with strong character [Admin_6677] we use this password when we will install DBS ASM SYS password and DBS sys password would be same.

Click: - Next

Click:- Next

Click :- Next

Click:- Next

Click:- Next

Click:- Install

Run on ROOT USER terminal

$ /u01/app/oraInventory/orainstRoot.sh 

$ /u01/app/grid/product/12.1.0/home/root.sh

ADD Disk Group Through ASMCA Utility

Note:

We will add two disk group for Database and Archive log both groups are same size with normal redundancy. Disk groups add on grid user with ASMCA utility.

Click:- Create     (For Disk Group Creation)

Disk Group Name: FRA

Redundancy : Normal

Select: Two Disks  

Note:

This group for FRA with the same Size (Flush Recovery Area).This group contain archivelog and backups. 

Click:- OK 

Click:- OK

Disk Group Name: DATA

Redundancy : Normal

Select: Two Disks 

Note:

This group for DATA with the same Size (Database Files).This group contain dbs file,redolog ,controlfile .

Click:- OK 

Click:-OK

Note:

We can see three disk group for deferent purpose.

CRS Disk Group : Standalone ASM Cluster Configuration ASM spfile and etc..

DATA Disk Group: For Datafile, Controlfile, redolog files etc...

FRA Disk Group: For Archivelog file and Backup.

Click:- Exit and Yes 

Oracle Database Software Installation

Click: Next and Yes

Select : Install database software only

Click: Next

Select : Single instance database installation

Click: Next

Click: Next

Click: Next

Click: Next

Click: Next

Click: Install

Click: OK 

Click: Close

Database Creation

Select: Create Database

Click: Next

Global Database Name: orcl

 Database Files Location: +DATA

 Fast Recovery Area: +FRA

 Database Character Set: AL32UTF8

 Administrator Password: Admin_6677

 Confirm Password: Admin_6677

 [Uncheck] Create As Container Database

Click:  Next

Click: - OK and Close

 
Completed.

Note: My Future Post Will Linked with this Post