Thursday, April 15, 2021

Block Change Tracking

 

Block Change Tracking

Block changing tracking improves the performance of incremental backups by recording changed blocks in the block change tracking file. During an incremental backup, instead of scanning all data blocks to identify which blocks have changed, RMAN uses this file to identify the changed blocks that need to be backed up.

You can enable block change tracking when the database is either open or mounted. This section assumes that you intend to create the block change tracking file as an Oracle Managed File in the database area, which is where the database maintains active database files such as data files, control files, and online redo log files.

To determine if block change tracking is enabled, check the STATUS and FILENAME columns in the V$BLOCK_CHANGE_TRACKING view, using the following statement from the SQL or RMAN prompt:

SELECT status, filename FROM V$BLOCK_CHANGE_TRACKING;

From Oracle 10g, the background process Block Change Tracking Writer (CTWR) will do the job of writing modified block details to block change tracking file.

 

In a Real Applications Clusters (RAC) environment, the change tracking file must be located on shared storage accessible from all nodes in the cluster.

 

Enabling and Disabling Oracle Change Tracking file

 

We can enable or disable change tracking when the database is either open or mounted. To alter the change tracking setting, we must use SQL*Plus to connect to the target database with administrator privileges.

 

To store the change tracking file in the database area, set DB_CREATE_FILE_DEST in the target database. Then issue the following SQL statement to enable change tracking:

 

SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;  


We can also create the change tracking file in a desired location, using the following SQL statement:

 

SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '/u02/rman/rman_change_track.f';


The REUSE option tells Oracle to overwrite any existing file with the specified name.

 

SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '/u02/rman/rman_change_track.f' REUSE;


To disable change tracking, use this SQL statement:

 

SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;  


If the change tracking file was stored in the database area, then it will be deleted when we disable change tracking.

 

Checking Whether Change Tracking is enabled

 

From SQL*Plus, we can query V$BLOCK_CHANGE_TRACKING to determine whether change tracking is enabled or not. 

 

SQL> select status from V$BLOCK_CHANGE_TRACKING;

        ENABLED   => block change tracking is enabled.

        DISABLED  => block change tracking is disabled.

 

Query V$BLOCK_CHANGE_TRACKING to display the filename.

 

SQL> select filename from V$BLOCK_CHANGE_TRACKING;

 

Moving the Change Tracking File in Oracle

 

If you need to move the change tracking file, the ALTER DATABASE RENAME FILE command updates the control file to refer to the new location.


1. If necessary, determine the current name of the change tracking file:


SQL> SELECT filename FROM V$BLOCK_CHANGE_TRACKING;

        /u01/app/rman/rman_change_track.f

2. Shutdown the database.


SQL> SHUTDOWN IMMEDIATE

3. Using host operating system commands, move the change tracking file to its new location.


$ mv /u02/rman/rman_change_track.f /u01/app/rman/rman_change_track.f

4. Mount the database and move the change tracking file to a location that has more space. For example:


SQL> STARTUP MOUNT


SQL> ALTER DATABASE RENAME FILE '/u01/app/rman/rman_change_track.f' TO '/u01/app/rman/rman_change_track.f';

5. Open the database.


SQL> ALTER DATABASE OPEN;

 

SQL> SELECT filename FROM V$BLOCK_CHANGE_TRACKING;

        /u01/app/rman/rman_change_track.f

If you cannot shutdown the database, then you must disable change tracking and re-enable it, at the new location:

 

SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;

SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '/u01/app/rman/rman_change_track.f';

 

If you choose this method, you will lose the contents of the change tracking file. Until the next time you complete a level 0 incremental backup, RMAN will have to scan the entire file.

 

Estimating Size of the Change Tracking File on Disk

The size of the change tracking file is proportional to the size of the database and the number of enabled threads of redo. The size is not related to the frequency of updates to the database.

 

Typically, the space required for block change tracking is approximately 1/30,000 the size of the data blocks to be tracked. The following two factors that may cause the file to be larger than this estimate suggests:


·                     To avoid overhead of allocating space as database grows, the change tracking file size starts at 10MB, and new space is allocated in 10MB increments. Thus, for any database up to approximately 300GB the file size is no smaller than 10MB, for up to approximately 600GB the file size is no smaller than 20MB, and so on.


·                     For each datafile, a minimum of 320K of space is allocated in the change tracking file, regardless of the size of the file. Thus, if you have a large number of relatively small datafiles, the change tracking file is larger than for databases with a smaller number of larger datafiles containing the same data.


SELECT FILE#, INCREMENTAL_LEVEL, COMPLETION_TIME, BLOCKS, DATAFILE_BLOCKS FROM V$BACKUP_DATAFILE WHERE INCREMENTAL_LEVEL > 0 AND BLOCKS / DATAFILE_BLOCKS > .5 ORDER BY COMPLETION_TIME;

 

Difference between dbtechstack,dbtier and dbconfig

 

Difference between dbtechstack,dbtier and dbconfig

When running adcfgclone on database node we had three modes in which it can be executed.

perl adcfgclone.pl dbTier
 
 It will configure the ORACLE_HOME on the target database tier node and  recreate the controlfiles. This is Used for cold backup.
  

 
perl adcfgclone.pl dbTechStack
 
It will configure the ORACLE_HOME on the target database tier node only. Relink the oracle home.

This is to clone the database Separetely Using Rman hot backup
 
The below steps has to be performed manually
1. Create the Target Database control files.
2. Start the Target System Database in open mode
3. Run the library update script against the Database

cd $RDBMS_ORACLE_HOME/appsutil/install/[CONTEXT NAME]
sqlplus "/ as sysdba" @adupdlib.sql [libext]

 Where [libext] should be set to 'sl' for HP-UX, 'so' for any other UNIX platform,
or 'dll' for Windows.

 
perl adcfgclone.pl dbconfig
 
It is used to configure the database with  context file.Database should be in open mode.
 
cd $RDBMS_ORACLE_HOME/appsutil/clone/bin
perl adcfgclone.pl dbconfig target_context_file

Where Target Context File is:
$RDBMS_ORACLE_HOME/appsutil/target_context_file.xml


Friday, April 9, 2021

ORA-01157 and ORA-01110

ORA-01157 is raised when Database Writer (DBWR) is unable to find and lock a Datafile. This may be due to various reasons like
- Datafile is deleted or corrupt
- Datafile is renamed or moved
- Mount point is incorrect
- Issues with Read/write permission on Datafile

To solve ORA-01157 we can use one of the following steps:
- If datafile is deleted or corrupt and is not of TEMP or UNDO tablespace then we need to recoved it by using a valid backup.
- If datafile is deleted or corrupt and is not of TEMP or UNDO tablespace but that tablespace do not containt important segments, that can be dropped offline
- If datafile is renamed or moved then we need to get it in its original position
- If Mount point is incorrect, simply recreate the mount point
- if it is due to permission then we need to grant the permission at OS level

I faced ORA-01157 at my local environment, when I was restoring a cold backup. Fortunatially it was with a tablespace which was added for testing purpose and was not critical. So I simply drop the datafile using "OFFLINE DROP" clause and opened the database.

 


SQL> select tablespace_name,status,contents from dba_tablespaces;

select tablespace_name,status,contents from dba_tablespaces

                                            *

ERROR at line 1:

ORA-01219: database or pluggable database not open: queries allowed on fixed

tables or views only

 

SQL> select open_mode from v$database;

 

OPEN_MODE

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

MOUNTED

 

SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-01157: cannot identify/lock data file 2 - see DBWR trace file

ORA-01110: data file 2: '/u01/app/oracle/oradata/RMAN/datafile/apex01.dbf'

 

..............................................................................................................................

Solution

 

SQL> select NAME from v$datafile where file#=2;

 

NAME

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

/u01/app/oracle/oradata/RMAN/datafile/apex01.dbf

 

SQL> alter database datafile 2 offline drop;

 

Database altered.

 

SQL> alter database open;

 

Database altered.

 

 


Sunday, April 4, 2021

Installation of Grid Infrastructure for a Standalone server (Oracle Restart) 12c (12.1.0.2)

 

Installation of Grid Infrastructure for a Standalone server (Oracle Restart)
12c (12.1.0.2)

Stage-1 Oracle Grid and DB Installation Prerequisites

 Step:-1 Oracle Installation Prerequisites

 Besides installing the dependent packages, preinstall package would automatically set the kernel parameters and create the 'oracle' user and user groups such as 'oinstall' and 'dba'.

yum install oracle-rdbms-server-12cR1-preinstall –y

[root@ranesh yum.repos.d]# yum install oracle-rdbms-server-12cR1-preinstall -y

 

Step:-2 Oracle ASM Prerequisites

 Install ASM Packages for ASm Configuration

yum install oracleasm-support

yum install kmod-oracleasm

 [root@ranesh yum.repos.d]# yum install oracleasm-support

 [root@ranesh yum.repos.d]# yum install kmod-oracleasm –y

 

The oracleasmlib package cannot be downloaded from YUM repository:

# yum install oracleasmlib
Loaded plugins: security
ol6_latest                                               | 1.4 kB     00:00
ol6_u3_base                                              | 1.4 kB     00:00
ol6_u3_base/primary                                      | 2.7 MB     00:07
ol6_u3_base                                                           8452/8452
Setting up Install Process
No package oracleasmlib available.
Error: Nothing to do
#

 

However, we need to download oracleasmlib from Oracle’s website and install it using rpm. To download it directly within terminal using wget utility, we can use below command.

 

# wget http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.12-1.el6.x86_64.rpm

After downloading we will have to install it using rpm.

                                                 ( Or)

Download- Intel EM64T (x86_64) Architecture

https://www.oracle.com/linux/downloads/linux-asmlib-v6-downloads.html

                                     

 

[root@ranesh yum.repos.d]# chmod -R 775 oracleasmlib-2.0.12-1.el6.x86_64.rpm

[root@ranesh yum.repos.d]# rpm -ivh oracleasmlib-2.0.12-1.el6.x86_64.rpm

Preparing...                          ################################# [100%]

Updating / installing...

   1:oracleasmlib-2.0.12-1.el6        ################################# [100%]

 

Step:-3 Set Static IP Address and enter hosts file

 

 

After installation the RPM’s using Yum.Change to static IP and restart

 

Go to System->Preferences-Network Connections-IPV4-Change Manaul

Service network restart.

Hosts File

The "/etc/hosts" file must contain a fully qualified name for the server.

 

[root@ranesh yum.repos.d]# cat  /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain4

192.168.145.134  ranesh.asm  ranesh

[root@ranesh yum.repos.d]# service network restart

Restarting network (via systemctl):                        [  OK  ]

 

Step:-4 Set the password for the "oracle" user.

[root@ranesh ]# passwd oracle

Changing password for user oracle.

New password:

BAD PASSWORD: it is based on a dictionary word

BAD PASSWORD: is too simple

Retype new password:

passwd: all authentication tokens updated successfully.

 

Step:-5 Set secure Linux to permissive by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.

 

SELINUX=permissive

 

[root@ranesh yum.repos.d]# vi /etc/selinux/config

[root@ranesh yum.repos.d]# cat /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=permissive

# SELINUXTYPE= can take one of three two values:

#     targeted - Targeted processes are protected,

#     minimum - Modification of targeted policy. Only selected processes are protected.

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

 # setenforce Permissive

 

Step:-6 If you have the Linux firewall enabled, you will need to disable or configure it, as shown here or here. To disable it, do the following.

 # systemctl stop firewalld

# systemctl disable firewall

 

Step:-7 Create the directory structures and set ownership and permissions for Grid and Oracle software will be installed.

 [root@ranesh ~]# mkdir -p  /u01/app/oracle/12.1.0.2/grid

[root@ranesh ~]# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1

[root@ranesh ~]# chown -R oracle:oinstall /u01

 [root@ranesh ~]# chmod -R 775 /u01


 Step:-8 Setting up the .bash_profile for both 'grid' and 'oracle' user.

 Log in as the "oracle" user and add the following lines at the end of the "/home/oracle/.bash_profile" file.

 

[root@ranesh ~]# su - oracle

[oracle@oracleasm ~]$ vi .bash_profile

[oracle@oracleasm ~]$ cat .bash_profile

export TMP=/tmp

export TMPDIR=$TMP

 export ORACLE_HOSTNAME=ranesh.asm

export ORACLE_UNQNAME=prodasm

export ORACLE_BASE=/u01/app/oracle

export GRID_HOME=/u01/app/oracle/12.1.0.2/grid

export DB_HOME=$ORACLE_BASE/product/12.1.0.2/db_1

export ORACLE_HOME=$DB_HOME

export ORACLE_SID=prodasm

export ORACLE_TERM=xterm

export BASE_PATH=/usr/sbin:$PATH

export PATH=$ORACLE_HOME/bin:$BASE_PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

 

alias grid='. /home/oracle/grid_env'

alias db='. /home/oracle/db_env'

 

Grid

Create a file called "/home/oracle/grid_env" with the following contents.

 

export ORACLE_SID=+ASM

export ORACLE_HOME=$GRID_HOME

export PATH=$ORACLE_HOME/bin:$BASE_PATH

 

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

 

Database

Create a file called "/home/oracle/db_env" with the following contents.

 

export ORACLE_SID=prodasm

export ORACLE_HOME=$DB_HOME

export PATH=$ORACLE_HOME/bin:$BASE_PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

 

Once the "/home/oracle/.bash_profile" has been run, you will be able to switch between environments as follows.

 [oracle@oracleasm ~]$ . .bash_profile

[oracle@oracleasm ~]$ . db_env

[oracle@oracleasm ~]$ echo $ORACLE_HOME

/u01/app/oracle/product/12.1.0.2/db_1

[oracle@oracleasm ~]$ . grid_env

[oracle@oracleasm ~]$ echo $ORACLE_HOME

/u01/app/oracle/12.1.0.2/grid


 Step:-9 Adding Disk in Vmware

 Shutdown VMWare


 Hard Disk And Click Add Button


Add Hardware Wizard and click next



Select SCSCI and click Next


Select create new virtual disk and click Next

Enter ASM Disk size and click Next




Create folder ASMDISK and browse location and Save Next



 Click Finish to create



ASM Disk is creating now



After disk is created click Advanced button 

Select Independent and click Ok





Power on the Vmware  

Login in to Root User and  check fdisk –l

 

[root@ranesh ~]# fdisk -l

 

Disk /dev/sda: 128.8 GB, 128849018880 bytes, 251658240 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: 0x00065635

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     2099199     1048576   83  Linux

/dev/sda2         2099200   251658239   124779520   8e  Linux LVM

 

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors---------asm disk

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

 

 

 

 

 

Partition the disks

 

[root@ranesh ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

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

 

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

First sector (2048-41943039, default 2048):

Using default value 2048

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

Using default value 41943039

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

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.


Check fdisk –l

 


Stage 2 Grid Installation ----

 

One by one

unzip p17694377_121020_Linux-x86-64_1of8.zip

unzip p17694377_121020_Linux-x86-64_2of8.zip

unzip p17694377_121020_Linux-x86-64_3of8.zip

unzip p17694377_121020_Linux-x86-64_4of8.zip

 

 

[oracle@ranesh 12102]$ ls -ltr

drwxr-xr-x. 7 oracle oinstall 4096 Jul 11  2014 grid

drwxrwxr-x. 7 oracle oinstall 4096 Apr  3 17:44 database

 

Step:-2 Run precheck utility

 

[root@ranesh ~]# rpm -iv  /u01/app/12102/grid/rpm/cvuqdisk-1.0.9-1.rpm

Preparing packages...

Using default group oinstall to install package

cvuqdisk-1.0.9-1.x86_64

 

[oracle@ranesh app]$ cd grid/

[oracle@ranesh grid]$ ls

install      response  runcluvfy.sh  sshsetup  welcome.html

readme.html  rpm       runInstaller  stage

 

[oracle@ranesh grid]$ ./runcluvfy.sh stage -pre hacfg

Performing pre-checks for Oracle Restart configuration

Total memory check passed

Available memory check passed

Swap space check failed

Check failed on nodes:

            ranesh

Free disk space check passed for "ranesh:/usr,ranesh:/var,ranesh:/etc,ranesh:/sbin,ranesh:/tmp"

Check for multiple users with UID value 54321 passed

User existence check passed for "oracle"

Group existence check passed for "oinstall"

Group existence check passed for "dba"

Membership check for user "oracle" in group "oinstall" [as Primary] passed

Membership check for user "oracle" in group "dba" passed

Run level check passed

Hard limits check passed for "maximum open file descriptors"

Soft limits check passed for "maximum open file descriptors"

Hard limits check passed for "maximum user processes"

Soft limits check passed for "maximum user processes"

System architecture check passed

Kernel version check passed

Kernel parameter check passed for "semmsl"

Kernel parameter check passed for "semmns"

Kernel parameter check passed for "semopm"

Kernel parameter check passed for "semmni"

Kernel parameter check passed for "shmmax"

Kernel parameter check passed for "shmmni"

Kernel parameter check passed for "shmall"

Kernel parameter check passed for "file-max"

Kernel parameter check passed for "ip_local_port_range"

Kernel parameter check passed for "rmem_default"

Kernel parameter check passed for "rmem_max"

Kernel parameter check passed for "wmem_default"

Kernel parameter check passed for "wmem_max"

Kernel parameter check passed for "aio-max-nr"

Kernel parameter check passed for "panic_on_oops"

Package existence check passed for "binutils"

Package existence check passed for "compat-libcap1"

Package existence check passed for "compat-libstdc++-33(x86_64)"

Package existence check passed for "libgcc(x86_64)"

Package existence check passed for "libstdc++(x86_64)"

Package existence check passed for "libstdc++-devel(x86_64)"

Package existence check passed for "sysstat"

Package existence check passed for "gcc"

Package existence check passed for "gcc-c++"

Package existence check passed for "ksh"

Package existence check passed for "make"

Package existence check passed for "glibc(x86_64)"

Package existence check passed for "glibc-devel(x86_64)"

Package existence check passed for "libaio(x86_64)"

Package existence check passed for "libaio-devel(x86_64)"

Package existence check passed for "nfs-utils"

Check for multiple users with UID value 0 passed

Current group ID check passed

Starting check for consistency of primary group of root user

Check for consistency of root user's primary group passed

Pre-check for Oracle Restart configuration was unsuccessful.

Step:-3 Configuring ASM

 

At this point ASMLib and its support packages are now installed, however not configured yet. Before we start to configure ASMLib, ensure following os user and os groups are created. In our case, it's already done.

 

[oracle@ranesh ~]$ rpm -qa | grep oracleasm

oracleasmlib-2.0.12-1.el6.x86_64

oracleasm-support-2.1.11-2.el7.x86_64

kmod-oracleasm-2.0.8-28.0.1.el7.x86_64

 

If we’ve all three packages installed, then we’re good to proceed further with configuration of ASM Driver. We’ll have to perform below action as a root user.

 

[root@ranesh ~]# 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 []: oracle

Default group to own the driver interface []: oinstall

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

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

Writing Oracle ASM library driver configuration: done

 

[root@ranesh ~]# /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

[root@ranesh ~]# /usr/sbin/oracleasm createdisk DISK1 /dev/sdb1

Writing disk header: done

Instantiating disk: done

 

[oracle@ranesh ~]$ cd /dev/oracleasm/disks

[oracle@ranesh disks]$ ls -lrt

total 0

brw-rw----. 1 oracle oinstall 8, 17 Apr  4 12:51 DISK1

 Now we’re good to initiate Database‘s and Grid Infrastructure‘s installation. We’ll install Grid Infrastructure first and then Database. From oracle user

 

[oracle@ranesh grid]$ pwd

/u01/app/grid

[oracle@ranesh app]$ cd grid/

[oracle@ranesh grid]$ ./runInstaller

Starting Oracle Universal Installer...

 

Checking Temp space: must be greater than 415 MB.   Actual 5401 MB    Passed

Checking swap space: must be greater than 150 MB.   Actual 4607 MB    Passed

Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2021-04-04_03-21-45PM. Please wait ...[oracle@ranesh grid]$


Step:-2 Click Next




Click next

 

Step:-3 Set the redundancy to "External", click the "Change Discovery Path" button and set the path to "/dev/oracleasm/disks*". Return the main screen and select all disks and click the "Next" button.

Note : If your created disks are not visible, Select Show All Disks from drop down or you can also try changing Discovery Path. Changing ASM Disks’ discovery path. Enter path of your oracleasm disk and click OK.







Step:-4 Provide password for sysasm and asmsnmp user, in my case I’m setting same password for both users. set your password and click NEXT.



Step:-5 Enterprise Manager Cloud Control setup, leave it unchecked and click Next.





Step:-6 Select groups and click NEXT.

Note : Users of the selected group will be able to perform dba operations and will be able to connect as sysasm.




Note : You’ll be prompted with warning saying you have selected same group for OSOPER and OSASM, as we’ve selected same group. here we can click and Yes and ignore this warning.

 

Step:-7 Select ORACLE_BASE and ORACLE_HOME for Grid Infrastructure and click NEXT.

Note : If you notice here, you’ve no remedy to change ORACLE_HOME for Grid Infrastructure, and it’s the location where we have placed setup of Grid Infrastructure.



Step:-8  If you want the root scripts to run automatically, enter the relevant credentials. I prefer to run them manually. Click the "Next" button.

Note: Supply root password to Automatically run configuration script or leave it unchecked to run script manually and click NEXT



Step:-9 Wait while the prerequisite checks complete. If you have any issues use the "Fix & Check Again" button

Click Install





We’ve Successfully Installed Oracle Grid Infrastructure 12c.

[oracle@ranesh grid]$ crsctl stat res -t

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

Name                    Target  State                Server                   State details       Local Resources

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

ora.DATA.dg       ONLINE  ONLINE       ranesh                  STABLE        ora.LISTENER.lsnr

               ONLINE  ONLINE       ranesh                   STABLE

ora.asm

               ONLINE  ONLINE       ranesh                   Started,STABLE

ora.ons

               OFFLINE OFFLINE      ranesh                   STABLE

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

Cluster Resources

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

ora.cssd

      1        ONLINE  ONLINE       ranesh                   STABLE

ora.diskmon

      1        OFFLINE OFFLINE                               STABLE

ora.evmd

      1        ONLINE  ONLINE       ranesh                   STABLE

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

 

We’ve Successfully Installed Oracle Grid Infrastructure 12c.

 

Stage-3 Continue with Oracle DB installation….

[oracle@ranesh ~]$ ls

db_env  grid_env

[oracle@ranesh ~]$ . db_env

 [oracle@ranesh app]$ cd database/

[oracle@ranesh database]$ ls

install  readme.html  response  rpm  runInstaller  sshsetup  stage  welcome.html

[oracle@ranesh database]$ ./runInstaller

Starting Oracle Universal Installer...

 Checking Temp space: must be greater than 500 MB.   Actual 3602 MB    Passed

Checking swap space: must be greater than 150 MB.   Actual 4603 MB    Passed

Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2021-04-04_04-24-34PM. Please wait ...

Install the Database Software

Step:-1 Uncheck the security updates checkbox and click the "Next" button and "Yes" on the subsequent warning dialog.



Step:-2 Select the "Install database software only" option, then click the "Next" button.



Step:-3 Select Single instance database installation and click NEXT.




Step:-4 Click NEXT.


Step:-5 Select Enterprise Edition and click NEXT



Step:-6 Select the directory for Oracle base and Oracle Home in software location field, which we have created and click NEXT.



Step:-7 Select group as oracle and click NEXT.



Step;-8 For any prerequisite failure click on Fix & check Again button. and run the fixup script from the given location as a root user. Failures which says yes in Fixable column will be fixed.




Step:-9 Installation Summary, verify your selections and click on Install. 



Run the 
root.sh script as a root user from the location shown above
 

[root@ranesh db_1]# sh root.sh

Performing root user operation.

 The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /u01/app/oracle/product/12.1.0.2/db_1

 Enter the full pathname of the local bin directory: [/usr/local/bin]:

The contents of "dbhome" have not changed. No need to overwrite.

The contents of "oraenv" have not changed. No need to overwrite.

The contents of "coraenv" have not changed. No need to overwrite.

 Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root script.

Now product-specific root actions will be performed.




Continue Stage-4 Creating ASM Diskgroup and Database….

[oracle@ranesh ~]$ . grid_env 

[oracle@ranesh ~]$ asmca




SQL> SELECT name, free_mb, total_mb, total_mb-free_mb "USED_MB", free_mb/total_mb*100 "%FREE" FROM v$asm_diskgroup;

 NAME                                                  FREE_MB   TOTAL_MB    USED_MB      %FREE

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

DATA                                         20417      20479           62 99.6972508


SQL> select name,path,mount_status,header_status,mode_status,state,total_mb,free_mb from v$asm_disk;

NAME        PATH MOUNT_S HEADER_STATU MODE_ST STATE TOTAL_MB    FREE_MB

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

DATA_0000        /dev/oracleasm/disks/DISK1 CACHED MEMBER      ONLINE  NORMAL    20479      20417



Database creation Using DBCA.

[oracle@ranesh ~]$ . db_env

[oracle@ranesh ~]$ cd $ORACLE_HOME

[oracle@ranesh db_1]$ dbca



Select the Advanced option


Select the General Purpose option



SID: This is the short name for your database. It equates to your environment variable ORACLE_SID.




Enterprise Manager Cloud Control setup, leave it unchecked and click Next.



Provide password for sys and system user, in my case I’m setting same password for both users. set your password and click NEXT.



In the Specify Network Configuration Details window, select already created Grid listener and click Next


In the Select Database Storage Option window, select Database file location as +DATA and click Next




In the Select Oracle Data Vault Config option window, select default uncheck all and click Next



In the Specify Configuration Options window, specify appropriate SGA and PGA values and click Next




leave it checked create Database and click Next.



Once Prerequisite checks complete click Next



In the Summary window, review summary and click Finish



ASM Database Creation is Progress..


ASM Database Creation is Completed



[oracle@ranesh ~]$ . db_env

[oracle@ranesh ~]$

[oracle@ranesh ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sun Apr 4 17:55:40 2021

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> select name from v$datafile;

NAME

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

+DATA/PRODASM/DATAFILE/system.258.1069004527

+DATA/PRODASM/DATAFILE/sysaux.257.1069004377

+DATA/PRODASM/DATAFILE/undotbs1.260.1069004717

+DATA/PRODASM/DATAFILE/users.259.1069004713


SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DATA/PRODASM/CONTROLFILE/current.261.1069004777
/u01/app/oracle/fast_recovery_area/PRODASM/controlfile/o1_mf_j6mcjk5j_.ctl


SQL> select member from v$logfile;


MEMBER
--------------------------------------------------------------------------------
+DATA/PRODASM/ONLINELOG/group_3.264.1069004785
/u01/app/oracle/fast_recovery_area/PRODASM/onlinelog/o1_mf_3_j6mcjvh3_.log
+DATA/PRODASM/ONLINELOG/group_2.263.1069004783
/u01/app/oracle/fast_recovery_area/PRODASM/onlinelog/o1_mf_2_j6mcjqwp_.log
+DATA/PRODASM/ONLINELOG/group_1.262.1069004781
/u01/app/oracle/fast_recovery_area/PRODASM/onlinelog/o1_mf_1_j6mcjom6_.log


[oracle@ranesh ~]$ . grid_env
[oracle@ranesh ~]$ asmcmd
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576     20479    18753                0           18753              0             N  DATA/


[oracle@ranesh ~]$ asmcmd
ASMCMD> cd data
ASMCMD> ls
ASM/
PRODASM/
orapwasm
ASMCMD> cd PRODASM/
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
ASMCMD> cd DATAFILE/
ASMCMD> ls
SYSAUX.257.1069004377
SYSTEM.258.1069004527
UNDOTBS1.260.1069004717
USERS.259.1069004713

ASMCMD> pwd
+data/PRODASM/DATAFILE

Listener Status


[oracle@ranesh ~]$ lsnrctl status


LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 04-APR-2021 18:04:14

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ranesh.asm)(PORT=1521)))

STATUS of the LISTENER

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

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production

Start Date                04-APR-2021 16:12:28

Uptime                    0 days 1 hr. 51 min. 47 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/oracle/12.1.0.2/grid/network/admin/listener.o                                                                                        ra

Listener Log File         /u01/app/oracle/diag/tnslsnr/ranesh/listener/alert/log                                                                                        .xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ranesh.asm)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Services Summary...

Service "+ASM" has 1 instance(s).

  Instance "+ASM", status READY, has 1 handler(s) for this service...

Service "prodasm" has 1 instance(s).

  Instance "prodasm", status READY, has 1 handler(s) for this service...

Service "prodasmXDB" has 1 instance(s).

  Instance "prodasm", status READY, has 1 handler(s) for this service...

The command completed successfully


[oracle@ranesh db_1]$ tnsping prodasm

 Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ranesh.asm)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = prodasm)))

OK (70 msec)

























Table import and export.

Create Data Pump Directory. The first step in Oracle Data Pump is to create an OS level directory which will be used by Oracle for perform...