Friday, 20 November 2020

Oracle Database Migration from Linux file System to ASM file System in12CR1

 1- Write Non-ASM DBS Environment in .bash_file and Source

[oracle@oda12 ~]$ vi .bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

# User specific environment and startup programs

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

# 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;

TNS_ADMIN=/u01/app/oracle/product/12.1.0/db_1/network/admin;

alias hmdb='source /home/oracle/hmdb.env'

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

export PATH

:wq!

[oracle@oda12 ~]$ source .bash_profile

 [oracle@oda12 ~]$ hmdb

2- Check Achivelog Mode is Enable in Database

 [oracle@oda12 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 15 01:41:41 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, OLAP, Advanced Analytics and Real Application Testing options

SQL> set lines 250 pages 250

SQL> select INSTANCE_NAME,HOST_NAME,ARCHIVER,DATABASE_STATUS ,VERSION from v$instance;

INSTANCE_NAME    HOST_NAME                                                        ARCHIVE DATABASE_STATUS   VERSION

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

hmdb             oda12.oracle.com                                                 STOPPED ACTIVE            12.1.0.2.0

SQL> archive log list

Database log mode             No Archive Mode

Automatic archival             Disabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     22

Current log sequence           24

SQL> show parameter db_recovery

NAME                                 TYPE        VALUE

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

db_recovery_file_dest                string      /u01/app/oracle/fast_recovery_area

db_recovery_file_dest_size           big integer 4560M

3- Enable Achivelog Mode in Database

SQL> shut immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount;

ORACLE instance started.

Total System Global Area 1308622848 bytes

Fixed Size                  2924064 bytes

Variable Size             452985312 bytes

Database Buffers          838860800 bytes

Redo Buffers               13852672 bytes

Database mounted.

SQL>  alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     22

Next log sequence to archive   24

Current log sequence           24

SQL>

SQL> alter system switch logfile;

System altered.

SQL> archive log list

Database log mode                     Archive Mode

Automatic archival                      Enabled

Archive destination                     USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence       23

Next log sequence to archive    25

Current log sequence                 25

4- Check and verify All Datafiles, redolog file,controlfile,tempfile with ASM Disk Groups etc..

SQL> select name from v$database;

NAME

---------

HMDB

SQL> col NAME format a30

SQL> col PATH format a30

SQL> select NAME,STATE,TOTAL_MB,PATH from v$asm_disk;

NAME                           STATE      TOTAL_MB PATH

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

DISK1                          NORMAL        10239 ORCL:DISK1

DISK2                          NORMAL        10239 ORCL:DISK2

DISK3                          NORMAL        10239 ORCL:DISK3

DISK4                          NORMAL        10239 ORCL:DISK4

DISK5                          NORMAL        20479 ORCL:DISK5

DISK6                          NORMAL        20479 ORCL:DISK6

6 rows selected.

[root@oda12 ~]# su - grid

Last login: Thu Oct 15 01:31:56 PKT 2020

[grid@oda12 ~]$ 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  NORMAL  N         512   4096  1048576     20478    20352                0           10176              0             N  CRS/

MOUNTED  NORMAL  N         512   4096  1048576     40958    36698                0           18349              0             N  DATA/

MOUNTED  NORMAL  N         512   4096  1048576     20478    20012                0           10006              0             N  FRA/

ASMCMD> exit

[grid@oda12 ~]$ exit

logout

[root@oda12 ~]# su - oracle

[oracle@oda12 ~]$ hmdb

[oracle@oda12 ~]$

[oracle@oda12 ~]$ sqlplus / as sysdb 

SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 15 01:41:41 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, OLAP, Advanced Analytics and Real Application Testing options

SQL>  col NAME format a70

SQL>  select name from v$datafile;

NAME

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

/u01/app/oracle/oradata/HMDB/datafile/o1_mf_system_hqh83991_.dbf

/u01/app/oracle/oradata/HMDB/datafile/o1_mf_sysaux_hqh81kwf_.dbf

/u01/app/oracle/oradata/HMDB/datafile/o1_mf_undotbs1_hqh85f2m_.dbf

/u01/app/oracle/oradata/HMDB/datafile/o1_mf_users_hqh85cxr_.dbf

SQL> col NAME format a75

SQL> select name from v$controlfile;

NAME

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

/u01/app/oracle/oradata/HMDB/controlfile/o1_mf_hqh86fch_.ctl

/u01/app/oracle/fast_recovery_area/HMDB/controlfile/o1_mf_hqh86fd7_.ctl

SQL> col member format a75

SQL> select member from v$logfile;

MEMBER

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

/u01/app/oracle/oradata/HMDB/onlinelog/o1_mf_3_hqh86jjz_.log

/u01/app/oracle/fast_recovery_area/HMDB/onlinelog/o1_mf_3_hqh86jpb_.log

/u01/app/oracle/oradata/HMDB/onlinelog/o1_mf_2_hqh86j0q_.log

/u01/app/oracle/fast_recovery_area/HMDB/onlinelog/o1_mf_2_hqh86j7j_.log

/u01/app/oracle/oradata/HMDB/onlinelog/o1_mf_1_hqh86hkv_.log

/u01/app/oracle/fast_recovery_area/HMDB/onlinelog/o1_mf_1_hqh86hms_.log

6 rows selected.

SQL> show parameter control_files

NAME                   TYPE       VALUE

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

control_files         string     /u01/app/oracle/oradata/HMDB/controlfile/o1_mf_hqh86fch_.ctl

                  , /u01/app/oracle/fast_recovery_area/HMDB/controlfile/o1_mf_hqh86fd7_.ctl

5- Define Disk group for controlfile, datafile, redologfile, tempfile with archivelog in Spfile from Sqlplus Prompt

SQL> ALTER SYSTEM SET control_files='+DATA' scope=spfile;

System altered.

SQL> show parameter db_create_file_dest

NAME                                 TYPE        VALUE

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

db_create_file_dest                  string      /u01/app/oracle/oradata

SQL> ALTER SYSTEM SET db_create_file_dest='+DATA' scope=spfile;

System altered.

SQL>  show parameter db_recovery_file_dest

NAME                                 TYPE        VALUE

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

db_recovery_file_dest                string      /u01/app/oracle/fast_recovery_area

db_recovery_file_dest_size           big integer 4560M

SQL> ALTER SYSTEM SET db_recovery_file_dest='+FRA' scope=spfile;

System altered.

Here We Start Migration through RMAN Utility

6- Shutdown Database and Startup No-Mount Mode

SQL> shut immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>

SQL> startup nomount;

ORACLE instance started.

Total System Global Area 1308622848 bytes

Fixed Size                  2924064 bytes

Variable Size             452985312 bytes

Database Buffers          838860800 bytes

Redo Buffers               13852672 bytes

SQL> exit

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

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

7- Restore Controlfile in ASM through RMAN Utility and Startup Database in Mount Mode

[oracle@oda12 ~]$ rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Thu Oct 15 03:12:19 2020

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

connected to target database: HMDB (not mounted)

RMAN> restore controlfile from '/u01/app/oracle/oradata/HMDB/controlfile/o1_mf_hqh86fch_.ctl';

Starting restore at 15-OCT-20

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=14 device type=DISK

channel ORA_DISK_1: copied control file copy

output file name=+DATA/HMDB/CONTROLFILE/current.266.1053832453

Finished restore at 15-OCT-20

RMAN> exit

Recovery Manager complete.

 [oracle@oda12 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 15 03:14:54 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> select status from v$instance;

STATUS

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

STARTED

SQL> alter database mount;

Database altered.

SQL> select status from v$instance;

STATUS

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

MOUNTED

SQL>exit

8- Taking Backup as Copy in ASM Disk Group and Switch Database to Copy

[oracle@oda12 ~]$ rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Thu Oct 15 03:12:19 2020

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

connected to target database: HMDB (not mounted)

RMAN> BACKUP AS COPY DATABASE FORMAT '+DATA';

Starting backup at 15-OCT-20

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=250 device type=DISK

channel ORA_DISK_1: starting datafile copy

input datafile file number=00001 name=/u01/app/oracle/oradata/HMDB/datafile/o1_mf_system_hqh83991_.dbf

output file name=+DATA/HMDB/DATAFILE/system.267.1053832677 tag=TAG20201015T031757 RECID=1 STAMP=1053832766

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:37

channel ORA_DISK_1: starting datafile copy

input datafile file number=00003 name=/u01/app/oracle/oradata/HMDB/datafile/o1_mf_sysaux_hqh81kwf_.dbf

output file name=+DATA/HMDB/DATAFILE/sysaux.268.1053832775 tag=TAG20201015T031757 RECID=2 STAMP=1053832849

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:16

channel ORA_DISK_1: starting datafile copy

input datafile file number=00004 name=/u01/app/oracle/oradata/HMDB/datafile/o1_mf_undotbs1_hqh85f2m_.dbf

output file name=+DATA/HMDB/DATAFILE/undotbs1.269.1053832851 tag=TAG20201015T031757 RECID=3 STAMP=1053832865

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:16

channel ORA_DISK_1: starting datafile copy

copying current control file

output file name=+DATA/HMDB/CONTROLFILE/backup.270.1053832869 tag=TAG20201015T031757 RECID=4 STAMP=1053832871

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03

channel ORA_DISK_1: starting datafile copy

input datafile file number=00006 name=/u01/app/oracle/oradata/HMDB/datafile/o1_mf_users_hqh85cxr_.dbf

output file name=+DATA/HMDB/DATAFILE/users.271.1053832873 tag=TAG20201015T031757 RECID=5 STAMP=1053832873

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

including current SPFILE in backup set

channel ORA_DISK_1: starting piece 1 at 15-OCT-20

channel ORA_DISK_1: finished piece 1 at 15-OCT-20

piece handle=+DATA/HMDB/BACKUPSET/2020_10_15/nnsnf0_tag20201015t031757_0.272.1053832875 tag=TAG20201015T031757 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 15-OCT-20

RMAN> SWITCH DATABASE TO COPY;

datafile 1 switched to datafile copy "+DATA/HMDB/DATAFILE/system.267.1053832677"

datafile 3 switched to datafile copy "+DATA/HMDB/DATAFILE/sysaux.268.1053832775"

datafile 4 switched to datafile copy "+DATA/HMDB/DATAFILE/undotbs1.269.1053832851"

datafile 6 switched to datafile copy "+DATA/HMDB/DATAFILE/users.271.1053832873"

9- Verify Datafiles and Controlfiles

[root@oda12 ~]# su - grid

Last login: Thu Oct 15 03:04:43 PKT 2020 on pts/0

[grid@oda12 ~]$ asmcmd

ASMCMD> ls

CRS/

DATA/

FRA/

ASMCMD> cd DATA

ASMCMD> ls

HMDB/

ORCL/

ASMCMD> cd DATA/HMDB/DATAFILE

ASMCMD> ls

SYSAUX.268.1053832775

SYSTEM.267.1053832677

UNDOTBS1.269.1053832851

USERS.271.1053832873

ASMCMD> cd DATA/HMDB/CONTROLFILE/

ASMCMD> ls

Backup.270.1053832869

current.266.1053832453

ASMCMD>

ASMCMD> cd ..

ASMCMD> cd ..

ASMCMD> ls

HMDB/

ORCL/

ASMCMD> cd HMDB

ASMCMD> ls

BACKUPSET/

CONTROLFILE/

DATAFILE/

ASMCMD> cd BACKUPSET/

ASMCMD> ls

2020_10_15/

ASMCMD> cd 2020_10_15/

ASMCMD> ls

nnsnf0_TAG20201015T031757_0.272.1053832875

ASMCMD> ls --permission

User  Group  Permission  Name

              rw-rw-rw-  nnsnf0_TAG20201015T031757_0.272.1053832875

ASMCMD> exit

[oracle@oda12 ~]$ sqlplus / as sysdba 

SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 15 03:41:31 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> 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

10- Migrate Tempfile in ASM Through RMAN Utility and Startup database in Open Mode

SQL> select name from v$tempfile;

NAME

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

/u01/app/oracle/oradata/HMDB/datafile/o1_mf_temp_hqh86ypn_.tmp

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 ~]$

[oracle@oda12 ~]$ rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Thu Oct 15 03:46:11 2020

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

connected to target database: HMDB (DBID=719363102, not open)

RMAN> run

{

set newname for tempfile '/u01/app/oracle/oradata/HMDB/datafile/o1_mf_temp_hqh86ypn_.tmp' to '+DATA';

switch tempfile all;

}

executing command: SET NEWNAME

using target database control file instead of recovery catalog

renamed tempfile 1 to +DATA in control file

RMAN> exit

[oracle@oda12 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 15 10:13:49 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> alter database open;

Database altered.

SQL> select status from v$instance;

STATUS

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

OPEN

SQL> select name from v$tempfile;

NAME

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

+DATA/HMDB/TEMPFILE/temp.273.1053857497

11- Migrate Redolog File in ASM Disk Group

SQL>  select group#, status from v$log;

    GROUP# STATUS

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

         1 CURRENT

         2 INACTIVE

         3 INACTIVE

SQL> select member from V$logfile;

MEMBER

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

/u01/app/oracle/oradata/HMDB/onlinelog/o1_mf_3_hqh86jjz_.log

/u01/app/oracle/fast_recovery_area/HMDB/onlinelog/o1_mf_3_hqh86jpb_.log

/u01/app/oracle/oradata/HMDB/onlinelog/o1_mf_2_hqh86j0q_.log

/u01/app/oracle/fast_recovery_area/HMDB/onlinelog/o1_mf_2_hqh86j7j_.log

/u01/app/oracle/oradata/HMDB/onlinelog/o1_mf_1_hqh86hkv_.log

/u01/app/oracle/fast_recovery_area/HMDB/onlinelog/o1_mf_1_hqh86hms_.log

6 rows selected.

SQL>

SQL> desc V$logfile

 Name                                      Null?    Type

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

 GROUP#                                              NUMBER

 STATUS                                               VARCHAR2(7)

 TYPE                                                    VARCHAR2(7)

 MEMBER                                             VARCHAR2(513)

 IS_RECOVERY_DEST_FILE                 VARCHAR2(3)

 CON_ID                                               NUMBER

SQL> desc v$log;

 Name                                      Null?    Type

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

 GROUP#                                              NUMBER

 THREAD#                                             NUMBER

 SEQUENCE#                                        NUMBER

 BYTES                                                   NUMBER

 BLOCKSIZE                                          NUMBER

 MEMBERS                                           NUMBER

 ARCHIVED                                        VARCHAR2(3)

 STATUS                                             VARCHAR2(16)

 FIRST_CHANGE#                             NUMBER

 FIRST_TIME                                      DATE

 NEXT_CHANGE#                              NUMBER

 NEXT_TIME                                       DATE

 CON_ID                                             NUMBER

SQL> select  GROUP#,MEMBERS, STATUS,BYTES/1024/1024 "MB" from v$log;

GROUP#    MEMBERS STATUS     MB

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

         1          2 CURRENT                 50

         2          2 INACTIVE                 50

         3          2 INACTIVE                 50

SQL> alter database drop logfile group 3;

Database altered.

SQL> alter database add logfile group 4 size 50m;

Database altered.

SQL> alter database add logfile group 5 size 50m;

Database altered.

SQL> alter database add logfile group 6 size 50m;

Database altered.

SQL> alter database drop logfile group 2;

Database altered.

SQL> select GROUP#,MEMBERS, STATUS,BYTES/1024/1024 "MB" from v$log;

GROUP#    MEMBERS STATUS      MB

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

         1          2 CURRENT                  50

         4          2 UNUSED                   50

         5          2 UNUSED                   50

         6          2 UNUSED                   50

SQL> alter system switch logfile;

System altered.

SQL> select  GROUP#,MEMBERS, STATUS,BYTES/1024/1024 "MB" from v$log;

    GROUP#    MEMBERS STATUS        MB

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

         1          2 ACTIVE                      50

         4          2 CURRENT                  50

         5          2 UNUSED                   50

         6          2 UNUSED                   50

SQL> alter system switch logfile;

System altered.

SQL> select  GROUP#,MEMBERS, STATUS,BYTES/1024/1024 "MB" from v$log;

    GROUP#    MEMBERS STATUS                   MB

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

         1          2 ACTIVE                   50

         4          2 ACTIVE                   50

         5          2 CURRENT                  50

         6          2 UNUSED                   50

SQL> alter system checkpoint;

System altered.

SQL>  select  GROUP#,MEMBERS, STATUS,BYTES/1024/1024 "MB" from v$log;

    GROUP#    MEMBERS STATUS                   MB

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

         1          2 INACTIVE                 50

         4          2 INACTIVE                 50

         5          2 CURRENT                  50

         6          2 UNUSED                   50

SQL> alter database drop logfile group 1;

Database altered.

12- Verify Redolog file location

SQL> select member from V$logfile;

MEMBER

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

+DATA/HMDB/ONLINELOG/group_4.274.1053858807

+FRA/HMDB/ONLINELOG/group_4.260.1053858811

+DATA/HMDB/ONLINELOG/group_5.275.1053858831

+FRA/HMDB/ONLINELOG/group_5.261.1053858855

+DATA/HMDB/ONLINELOG/group_6.276.1053858907

+FRA/HMDB/ONLINELOG/group_6.262.1053858937

6 rows selected.

SQL> exit

[root@oda12 ~]# su - grid

Last login: Thu Oct 15 10:10:14 PKT 2020

[grid@oda12 ~]$ asmcmd

ASMCMD> ls

CRS/

DATA/

FRA/

ASMCMD> cd +DATA/HMDB/ONLINELOG

ASMCMD> ls

group_4.274.1053858807

group_5.275.1053858831

group_6.276.1053858907

ASMCMD> cd +FRA/HMDB/ONLINELOG

ASMCMD> ls

group_4.260.1053858811

group_5.261.1053858855

group_6.262.1053858937

ASMCMD>

 

Note:

Your Oracle Database Migration Linux File System to ASM has been Completed. 

My Future Post Will Linked with this Post 

Thursday, 12 November 2020

 

How to Configuring Oracle Listener in ASM Auto Start and Stop

(Add & Remove with Modify)12CR1

Start Listener from Oracle User

 

[oracle@oda12 ~]$ lsnrctl start HMDB_LSN

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 06-OCT-2020 23:02:01

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

Starting /u01/app/oracle/product/12.1.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production

System parameter file is /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora

Log messages written to /u01/app/oracle/diag/tnslsnr/oda12/hmdb_lsn/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oda12.oracle.com)(PORT=1525)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oda12.oracle.com)(PORT=1525)))

STATUS of the LISTENER

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

Alias                     HMDB_LSN

Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production

Start Date                06-OCT-2020 23:02:01

Uptime                    0 days 0 hr. 0 min. 0 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora

Listener Log File         /u01/app/oracle/diag/tnslsnr/oda12/hmdb_lsn/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oda12.oracle.com)(PORT=1525)))

Services Summary...

Service "HMDB" has 1 instance(s).

  Instance "HMDB", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

Important Note:

No Need to create and start listener on database side like above example. When you will Configure Database Listener in ASM so ASM automatically create listener in ASM resource for database.

                                                     Add Listener

1- Check Existing Listener Status from Grid User

[grid@oda12 ~]$ srvctl status listener

Listener LISTENER is enabled

Listener LISTENER is running on node(s): oda12

2- Add New Create Listener as a part of ASM Services/Cluster from Grid User

[grid@oda12 ~]$  srvctl add listener -listener  HMDB_LSN

PRCN-2061 : Failed to add listener ora.HMDB_LSN.lsnr

PRCN-2065 : Ports 1525 are not available on the nodes given

PRCN-2067 : Port 1525 is not available on nodes: oda12.oracle.com

Note:

It`s mean your database Non-ASM Listener is already running on database side that`s why this error is occurring.

[grid@oda12 ~]$ srvctl add listener -l HMDB_LSN  -p 1525

Note:

You will define -p switch for deferent port if you are not going to default port.

3- Check Listeners Configuration from grid user

[grid@oda12 ~]$ srvctl config listener

Name: HMDB_LSN

Type: Database Listener

Home: /u01/app/grid/product/12.1.0/home

End points: TCP:1525

Listener is enabled.

Name: LISTENER

Type: Database Listener

Home: /u01/app/grid/product/12.1.0/home

End points: TCP:1521

Listener is enabled.

4- Check new listener status as a local resource from grid user

[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

               OFFLINE OFFLINE      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

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

5- Start new listener from grid user

[grid@oda12 ~]$ srvctl start listener -l hmdb_lsn

6- Check again new listener status as a local resource from grid user

[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

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

7- Check listener tnsping from Oracle User

[oracle@oda12 ~]$ tnsping HMDB_LSN

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 07-OCT-2020 19:30:34

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

Used parameter files:

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oda12.oracle.com)(PORT = 1525)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hmdb)))

OK (10 msec)

[oracle@oda12 ~]$ tnsping HMDB_LSN

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 07-OCT-2020 19:30:37

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

Used parameter files:

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oda12.oracle.com)(PORT = 1525)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hmdb)))

OK (10 msec)

[oracle@oda12 ~]$

8- Check listener status from Grid User

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

Listener HMDB_LSN is enabled

Listener HMDB_LSN is running on node(s): oda12

Listener Modification

Note:

I am producing error in listener like I will change listener port with default port value and then I will modify.

1- Check listener status from Grid User

[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  INTERMEDIATE oda12                    Not All Endpoints Re

                                                             gistered,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

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

Show Error:

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

Name                                  Target   State         Server  State details

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

ora.HMDB_LSN.lsnr   ONLINE   INTERMEDIATE  oda12   Not All Endpoints Registered,STABLE 

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

Error is above mention let’s start our work

2- Check listener configuration from Grid User

[grid@oda12 ~]$ srvctl config listener -l HMDB_LSN

Name: HMDB_LSN

Type: Database Listener

Home: /u01/app/grid/product/12.1.0/home

End points: TCP:1521

Listener is enabled.

Note:

You can see there this is port issue which is create by self.

3- Modify listener from grid user

[grid@oda12 ~]$ srvctl modify listener -l hmdb_lsn -p 1525

4- Check modification listener configuration from Grid User

[grid@oda12 ~]$ srvctl config listener -l HMDB_LSN

Name: HMDB_LSN

Type: Database Listener

Home: /u01/app/grid/product/12.1.0/home

End points: TCP:1525

Listener is enabled.

5- Reboot Server Machine or all Services from Root User

[root@oda12 ~]$ reboot

6- Check Listener Status After Solution Applied from Grid User

[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

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

7- Listener Status from Grid User

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

Listener HMDB_LSN is enabled

Listener HMDB_LSN is running on node(s): oda12

8- Stop listener from Grid User

[grid@oda12 ~]$ srvctl stop listener -l HMDB_LSN

9- Check again listener status from Grid User

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

Listener HMDB_LSN is enabled

Listener HMDB_LSN is not running

10- Check again listener tnsping from Oracle User

[oracle@oda12 ~]$ tnsping HMDB_LSN

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 07-OCT-2020 19:45:31

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

Used parameter files:

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oda12.oracle.com)(PORT = 1525)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hmdb)))

TNS-12541: TNS:no listener

Note:

we can see it is working now.

11- start listener tnsping from Grid User

[grid@oda12 ~]$ srvctl start listener -l HMDB_LSN

12- Check again listener status from Grid User

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

Listener HMDB_LSN is enabled

Listener HMDB_LSN is running on node(s): oda12

13- Check again listener tnsping from Oracle User

[oracle@oda12 ~]$ tnsping HMDB_LSN

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 07-OCT-2020 19:49:49

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

Used parameter files:

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oda12.oracle.com)(PORT = 1525)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hmdb)))

OK (0 msec)

Note:

Issue has been resolved. Now we can see that listener is proper working in ASM services/Cluster Services start and stop properly.

Remove Listener

1- Check and Identify listener from Grid User

[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

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

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

Listener HMDB_LSN is enabled

Listener HMDB_LSN is running on node(s): oda12

2- Stop listener and check status from Grid User

[grid@oda12 ~]$ srvctl stop listener -l HMDB_LSN

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

Listener HMDB_LSN is enabled

Listener HMDB_LSN is not running

3- Disable Listener Service and Check Status from Grid User

[grid@oda12 ~]$ srvctl disable listener -l HMDB_LSN

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

Listener HMDB_LSN is disabled

Listener HMDB_LSN is not running

4- Remove Listener and Check Status from Grid User

[grid@oda12 ~]$ srvctl remove  listener -l HMDB_LSN

[grid@oda12 ~]$ srvctl status listener -l HMDB_LSN

PRCR-1001 : Resource ora.HMDB_LSN.lsnr 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.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

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

Completed.

Note: My Future Post Will Linked with this Post