Monday, August 14, 2023

Unable to connect to PDB?

Unable to connect to PDB?


Issue: Same PDB name on 2 CDBs and tns connection will be in trouble.

12c Multitenant: How to Connect to PDBs with Same Name in Different CDBs (Doc ID 2123106.1)

Solution: Include INSTANCE_NAME in TNS entries 


DEVCDB (PDB1)

sqlplus user1/user1@PDB1_DEVCDB
sqlplus mallik/mallik@PDB1_DEVCDB

TESTCDB(PDB1)

sqlplus user2/user2@PDB1_TESTCDB
sqlplus mallik/mallik@PDB1_TESTCDB

Traditional TNS:
PDB1_DEVCDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab1.localdomain.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = PDB1) (INSTANCE_NAME=DEVCDB)
    )
  )

PDB1_TESTCDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab1.localdomain.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = PDB1)(INSTANCE_NAME=TESTCDB)
    )
  )

Best Practice for TNS:
PDB1_DEVCDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab1.localdomain.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = PDB1)(INSTANCE_NAME=DEVCDB)
    )
  )

PDB1_TESTCDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab1.localdomain.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = PDB1)(INSTANCE_NAME=TESTCDB)
    )
  )

Best Practice for Setup:

One Database (Normal Database / CDB Database) - DEVCDB 
One Oracle Home - /u01/app/oracle/product/19.0.0.0/dbhome_1
One Listener - LISTENER_DEVCDB (1521)

One Database (Normal Database / CDB Database) - TESTCDB 
One Oracle Home - /u01/app/oracle/product/19.0.0.0/dbhome_2
One Listener - LISTENER_TESTCDB (1522)

Current Setup (Not followed Best Practice):

One Oracle Home - /u01/app/oracle/product/19.0.0.0/dbhome_1
One Listener - LISTENER (1251)
Multiple DBs (DEVCDB - PDB1 & TESTCDB - PDB1)

Best Practice for TNS:

PDB1_DEVCDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab1.localdomain.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = PDB1)(INSTANCE_NAME=DEVCDB)
    )
  )

PDB1_TESTCDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab1.localdomain.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = PDB1)(INSTANCE_NAME=TESTCDB)
    )
  )

[oracle@oraclelab1 admin]$ pwd
/u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin
[oracle@oraclelab1 admin]$ cat listener.ora
LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab1.localdomain.com)(PORT = 1521))
  )

ADR_BASE_LISTENER = /u01/app/oracle
[oracle@oraclelab1 admin]$ cat tnsnames.ora
DEVCDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab1.localdomain.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = DEVCDB)
    )
  )

TESTCDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab1.localdomain.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = TESTCDB)
    )
  )

PDB1_DEVCDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab1.localdomain.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = PDB1)
    )
  )

PDB1_TESTCDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab1.localdomain.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = PDB1)
    )
  )

[oracle@oraclelab1 admin]$

Regards,
Mallik

Sunday, August 6, 2023

ACFS Administration (Create, Increase, Delete)

ACFS Administration (Create, Increase, Delete)

For the pre-requisite please refer the below blog post:

1. Verify the ACFS Modules Installed:

lsmod |grep ora

2. Verify the diskgroup ACFS_DG mount on all the RAC cluster nodes

crsctl stat res ora.ACFS_DG.dg -t

3. Create 10G ACFS volume acfs_vol out of 40G ACFS_DG diskgroup

asmcmd -p lsdg ACFS_DG
asmcmd volcreate -G ACFS_DG -s 1G acfs_vol

4. Verify the ACFS volume information 

asmcmd volinfo -G ACFS_DG acfs_vol

5. Check acfs volume services at cluster side

crsctl stat res -t | grep -i "advm"
crsctl stat res ora.ACFS_DG.ACFS_VOL.advm -t

6. Create ACFS file system for ACFS devices created by ACFS Volume

mkfs -t acfs /dev/asm/acfs_vol-160
mkdir -p /acfs_test
chown oracle:oinstall /acfs_test_mount_point

7. Register the ACFS device to oracle as a owner 

/sbin/acfsutil registry -a  /dev/asm/acfs_vol-160 /acfs_test_mount_point -u oracle

crsctl stat res -t | grep -i "acfs_dg"
crsctl stat res ora.acfs_dg.acfs_vol.acfs -t

8. Use srvctl command to mount and unmount ACFS filesystem

srvctl status filesystem -d /dev/asm/acfs_vol-160
srvctl stop filesystem -d /dev/asm/acfs_vol-160
srvctl start filesystem -d /dev/asm/acfs_vol-160

df -h /acfs_test_mount_point

9. Verify the ACFS Volume information again which is mounted on OS filesystem

asmcmd volinfo -G ACFS_DG acfs_vol

10. Verify the configuration of ACFS filesystem

srvctl config filesystem

11. Increase the ACFS Volume and ACFS filesystem by 1G which will make total 11G 

acfsutil size +1G –d /dev/asm/acfs_vol-160 /acfs_test_mount_point
asmcmd volinfo -G ACFS_DG acfs_vol
asmcmd -p lsdg ACFS_DG
df -h /acfs_test_mount_point

12. Delete ACFS filesystem and ACFS volume created in case if you are not needed anymore

srvctl stop filesystem -d /dev/asm/acfs_vol-160
/sbin/acfsutil rmfs /dev/asm/acfs_vol-160
asmcmd voldisable -G ACFS_DG acfs_vol
asmcmd voldelete -G ACFS_DG acfs_vol

asmcmd -p lsdg ACFS_DG

crsctl stat res -t | grep -i "acfs_dg"
crsctl stat res ora.acfs_dg.acfs_vol.acfs -t

Logs:

[root@oranode1 ~]# ps -ef|grep smon|grep -v 'grep\|grid'
oracle   13259     1  0 13:46 ?        00:00:00 asm_smon_+ASM1
oracle   13817     1  0 13:46 ?        00:00:00 ora_smon_DEVDB1
[root@oranode1 ~]#
[root@oranode1 ~]# lsmod |grep ora
oracleacfs           5173248  0
oracleadvm           1146880  0
oracleoks             753664  2 oracleadvm,oracleacfs
oracleasm              61440  1
[root@oranode1 ~]# crsctl stat res ora.ACFS_DG.dg -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ACFS_DG.dg(ora.asmgroup)
      1        ONLINE  ONLINE       oranode1                 STABLE
      2        ONLINE  ONLINE       oranode2                 STABLE
      3        OFFLINE OFFLINE                               STABLE
--------------------------------------------------------------------------------
[root@oranode1 ~]#

[root@oranode1 ~]#su - oracle
[oracle@oranode1 ~]$ asmcmd -p lsdg ACFS_DG
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512             512   4096  4194304     40956    40780                0           40780              0             N  ACFS_DG/
[oracle@oranode1 ~]$

[root@oranode1 ~]# asmcmd volcreate -G ACFS_DG -s 10G acfs_vol
[root@oranode1 ~]# su - oracle
[oracle@oranode1 ~]$ asmcmd volinfo -G ACFS_DG acfs_vol
Diskgroup Name: ACFS_DG

         Volume Name: ACFS_VOL
         Volume Device: /dev/asm/acfs_vol-160
         State: ENABLED
         Size (MB): 10240
         Resize Unit (MB): 64
         Redundancy: UNPROT
         Stripe Columns: 8
         Stripe Width (K): 1024
         Usage:
         Mountpath:

[oracle@oranode1 ~]$

[root@oranode1 ~]# crsctl stat res -t | grep -i "advm"
ora.ACFS_DG.ACFS_VOL.advm
ora.proxy_advm
[root@oranode1 ~]#

[root@oranode1 ~]# crsctl stat res ora.ACFS_DG.ACFS_VOL.advm -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ACFS_DG.ACFS_VOL.advm
               ONLINE  ONLINE       oranode1                 STABLE
               ONLINE  ONLINE       oranode2                 STABLE
--------------------------------------------------------------------------------
[root@oranode1 ~]#

[root@oranode1 ~]# mkfs -t acfs /dev/asm/acfs_vol-160
mkfs.acfs: version                   = 19.0.0.0.0
mkfs.acfs: on-disk version           = 46.0
mkfs.acfs: volume                    = /dev/asm/acfs_vol-160
mkfs.acfs: volume size               = 10737418240  (  10.00 GB )
mkfs.acfs: Format complete.
[root@oranode1 ~]#

[root@oranode1 ~]# su - oracle
[root@oranode1 ~]# mkdir -p /acfs_test
[root@oranode1 ~]# chown oracle:oinstall /acfs_test_mount_point

[root@oranode2 ~]# su - oracle
[root@oranode2 ~]# mkdir -p /acfs_test
[root@oranode2 ~]# chown oracle:oinstall /acfs_test_mount_point

[root@oranode1 ~]# /sbin/acfsutil registry -a  /dev/asm/acfs_vol-160 /acfs_test_mount_point -u oracle
acfsutil registry: mount point /acfs_test_mount_point successfully added to Oracle Registry
[root@oranode1 ~]#

[root@oranode1 ~]# crsctl stat res -t | grep -i "acfs_dg"
ora.ACFS_DG.ACFS_VOL.advm
ora.acfs_dg.acfs_vol.acfs
ora.ACFS_DG.dg(ora.asmgroup)

[root@oranode1 ~]# crsctl stat res ora.acfs_dg.acfs_vol.acfs -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.acfs_dg.acfs_vol.acfs
               ONLINE  ONLINE       oranode1                 mounted on /acfs_tes
                                                             t_mount_point,STABLE
               ONLINE  ONLINE       oranode2                 mounted on /acfs_tes
                                                             t_mount_point,STABLE
--------------------------------------------------------------------------------
[root@oranode1 ~]#

[root@oranode1 ~]# srvctl status filesystem -d /dev/asm/acfs_vol-160
ACFS file system /acfs_test_mount_point is mounted on nodes oranode1,oranode2

[root@oranode1 ~]# srvctl stop filesystem -d /dev/asm/acfs_vol-160
[root@oranode1 ~]# srvctl start filesystem -d /dev/asm/acfs_vol-160

[root@oranode1 ~]# srvctl status filesystem -d /dev/asm/acfs_vol-160
ACFS file system /acfs_test_mount_point is mounted on nodes oranode1,oranode2
[root@oranode1 ~]#

[root@oranode1 ~]# df -h /acfs_test_mount_point
Filesystem             Size  Used Avail Use% Mounted on
/dev/asm/acfs_vol-160   10G  570M  9.5G   6% /acfs_test_mount_point
[root@oranode1 ~]#
[root@oranode2 ~]# df -h /acfs_test_mount_point
Filesystem             Size  Used Avail Use% Mounted on
/dev/asm/acfs_vol-160   10G  570M  9.5G   6% /acfs_test_mount_point
[root@oranode2 ~]#

[oracle@oranode1 ~]$ asmcmd volinfo -G ACFS_DG acfs_vol
Diskgroup Name: ACFS_DG

         Volume Name: ACFS_VOL
         Volume Device: /dev/asm/acfs_vol-160
         State: ENABLED
         Size (MB): 10240
         Resize Unit (MB): 64
         Redundancy: UNPROT
         Stripe Columns: 8
         Stripe Width (K): 1024
         Usage: ACFS
         Mountpath: /acfs_test_mount_point

[oracle@oranode1 ~]$

[root@oranode1 ~]# srvctl config filesystem
Volume device: /dev/asm/acfs_vol-160
Diskgroup name: acfs_dg
Volume name: acfs_vol
Canonical volume device: /dev/asm/acfs_vol-160
Accelerator volume devices:
Mountpoint path: /acfs_test_mount_point
Mount point owner: oracle
Mount point group: oinstall
Mount permissions: owner:oracle:rwx,pgrp:oinstall:r-x,other::r-x
Mount users:
Type: ACFS
Mount options:
Description:
ACFS file system is enabled
ACFS file system is individually enabled on nodes:
ACFS file system is individually disabled on nodes:
[root@oranode1 ~]#

[root@oranode1 ~]# acfsutil size +1G -d /dev/asm/acfs_vol-160 /acfs_test_mount_point
acfsutil size: new file system size: 11811160064 (11264MB)
[root@oranode1 ~]#

[root@oranode1 ~]# su - oracle
[oracle@oranode1 ~]$ asmcmd volinfo -G ACFS_DG acfs_vol
Diskgroup Name: ACFS_DG

         Volume Name: ACFS_VOL
         Volume Device: /dev/asm/acfs_vol-160
         State: ENABLED
         Size (MB): 11264
         Resize Unit (MB): 64
         Redundancy: UNPROT
         Stripe Columns: 8
         Stripe Width (K): 1024
         Usage: ACFS
         Mountpath: /acfs_test_mount_point

[oracle@oranode1 ~]$ asmcmd -p lsdg ACFS_DG
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512             512   4096  4194304     40956    29504                0           29504              0             N  ACFS_DG/
[oracle@oranode1 ~]$

[root@oranode1 ~]# df -h /acfs_test_mount_point
Filesystem             Size  Used Avail Use% Mounted on
/dev/asm/acfs_vol-160   11G  572M   11G   6% /acfs_test_mount_point
[root@oranode1 ~]#

[root@oranode2 ~]# df -h /acfs_test_mount_point
Filesystem             Size  Used Avail Use% Mounted on
/dev/asm/acfs_vol-160   11G  572M   11G   6% /acfs_test_mount_point
[root@oranode2 ~]#

[root@oranode1 ~]# srvctl stop filesystem -d /dev/asm/acfs_vol-160
[root@oranode1 ~]# /sbin/acfsutil rmfs /dev/asm/acfs_vol-160
[root@oranode1 ~]# su - oracle
[oracle@oranode1 ~]$ asmcmd voldisable -G ACFS_DG acfs_vol
[root@oranode1 ~]# asmcmd voldelete -G ACFS_DG acfs_vol
[root@oranode1 ~]# su - oracle
[oracle@oranode1 ~]$ asmcmd -p lsdg ACFS_DG
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512             512   4096  4194304     40956    40772                0           40772              0             N  ACFS_DG/
[oracle@oranode1 ~]$

[root@oranode1 ~]# crsctl stat res -t | grep -i "acfs_dg"
ora.ACFS_DG.dg(ora.asmgroup)
[root@oranode1 ~]#

Regards,
Mallik

ACFS-9459: ADVM/ACFS is not supported on this OS version: '4.14.35-1902.300.11.el7uek.x86_64'

ACFS-9459: ADVM/ACFS is not supported on this OS version: '4.14.35-1902.300.11.el7uek.x86_64'

ACFS Support On OS Platforms (Certification Matrix). (Doc ID 1369107.1)


Why ACFS?
1. Oracle Automatic Storage Management Cluster File System (Oracle ACFS) is a multi-platform, scalable file system, and storage management technology that extends Oracle Automatic Storage Management (Oracle ASM) functionality to support customer files maintained outside of Oracle Database. 

2. Oracle ACFS supports many database and application files, including executables, database trace files, database alert logs, application reports, BFILEs, and configuration files. Other supported files are video, audio, text, images, engineering drawings, and other general-purpose application file data.

3. Oracle ACFS does not support files for the Oracle Grid Infrastructure home.

4. Oracle ACFS does not support Oracle Cluster Registry (OCR) and voting files.

5. Oracle ACFS functionality requires that the disk group compatibility attributes for ASM and ADVM be set to 11.2 or greater.

Default Oracle 19c Base release was not installed with ACFS drivers, While creating ACFS volume we get error, We need to apply the any RU patch to make use of the ACFS feature.

[root@oranode1 ~]# cd /u01/app/19.0.0.0/grid/bin/
[root@oranode1 bin]# ./acfsdriverstate supported
ACFS-9459: ADVM/ACFS is not supported on this OS version: '4.14.35-1902.300.11.el7uek.x86_64'
ACFS-9201: Not Supported
ACFS-9294: updating file /etc/sysconfig/oracledrivers.conf
[root@oranode1 bin]#

[root@oranode1 ~]# lsmod | grep ora
oracleasm              61440  1
[root@oranode1 ~]#

[oracle@oranode1 ~]$ . oraenv
ORACLE_SID = [oracle] ? +ASM1
The Oracle base has been set to /u01/app/oracle
[oracle@oranode1 ~]$ /u01/app/19.0.0.0/grid/OPatch/opatch lspatches
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)
29517247;ACFS RELEASE UPDATE 19.3.0.0.0 (29517247)
29517242;Database Release Update : 19.3.0.0.190416 (29517242)
29401763;TOMCAT RELEASE UPDATE 19.0.0.0.0 (29401763)
OPatch succeeded.
[oracle@oranode1 ~]$

[root@oranode1 bin]# ps -ef|grep smon |grep -v 'grep\|grid'
oracle   24378     1  0 12:49 ?        00:00:00 asm_smon_+ASM1
oracle   26072     1  0 12:49 ?        00:00:00 ora_smon_DEVDB1
[root@oranode1 bin]#

[root@oranode2 ~]# ps -ef|grep smon |grep -v 'grep\|grid'
oracle     716     1  0 12:49 ?        00:00:00 ora_smon_DEVDB2
oracle   30629     1  0 12:49 ?        00:00:00 asm_smon_+ASM2
[root@oranode2 ~]#

[root@oranode1 bin]# olsnodes
oranode1
oranode2
[root@oranode1 bin]#

[root@oranode1 ~]# which acfsutil
/usr/bin/which: no acfsutil in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/u01/app/19.0.0.0/grid/bin)
[root@oranode1 ~]#

[root@oranode1 ~]# acfsutil
bash: acfsutil: command not found...
[root@oranode1 ~]#

[root@oranode1 ~]# cd /u01/app/19.0.0.0/grid/bin/
[root@oranode1 bin]# ./acfsdriverstate supported
ACFS-9459: ADVM/ACFS is not supported on this OS version: '4.14.35-1902.300.11.el7uek.x86_64'
ACFS-9201: Not Supported
ACFS-9294: updating file /etc/sysconfig/oracledrivers.conf
[root@oranode1 bin]#

[root@oranode1 ~]# acfsroot install
ACFS-9459: ADVM/ACFS is not supported on this OS version: '4.14.35-1902.300.11.el7uek.x86_64'
[root@oranode1 ~]#

[root@oranode1 bin]# uname -r
4.14.35-1902.300.11.el7uek.x86_64
[root@oranode1 bin]#

After the patching acfsutil commands are working fine:

[oracle@oranode1 ~]$ /u01/app/19.0.0.0/grid/OPatch/opatch lspatches
34580338;TOMCAT RELEASE UPDATE 19.0.0.0.0 (34580338)
34444834;OCW RELEASE UPDATE 19.17.0.0.0 (34444834)
34428761;ACFS RELEASE UPDATE 19.17.0.0.0 (34428761)
34419443;Database Release Update : 19.17.0.0.221018 (34419443)
33575402;DBWLM RELEASE UPDATE 19.0.0.0.0 (33575402)
OPatch succeeded.
[oracle@oranode1 ~]$

[root@oranode1 ~]# which acfsutil
/usr/sbin/acfsutil
[root@oranode1 ~]# acfsutil
acfsutil: Version 19.0.0.0.0

The following commands are supported:

     accel       - Manage accelerators
     audit       - Manage Auditing
     blog        - Manage Binary Logs
     cluster     - Display and manage cluster information
     compat      - Manage compatibility levels
     compress    - Manage compression
     defrag      - Defragment a file system
     dumpstate   - Dump file system state for diagnosis
     encr        - Manage Encryption
     info        - Display file system information
     log         - Manage Kernel Logs
     meta        - Collect file system metadata
     plugin      - Manage plugins
     registry    - Add, delete, or display mount registry entries
     remote      - Manage ACFS remote files
     repl        - Manage Replication
     rmfs        - Remove a file system
     sec         - Manage security
     size        - Resize a file system
     scrub       - Check mirror consistency
     snap        - Manage Snapshots
     tag         - Manage Tags
     tune        - Modify or display tunable parameters
     version     - Display version information
     freeze      - Suspend file system updates
     thaw        - Resume file system updates
     lockstats   - Print lock contention statistics

For more information, run:  acfsutil -h <command>

[root@oranode1 ~]# cd /u01/app/19.0.0.0/grid/bin/
[root@oranode1 bin]# ./acfsdriverstate supported
ACFS-9544: Invalid files or directories found: 'missing[], extra[4.1.12]'
ACFS-9200: Supported

[root@oranode1 bin]# lsmod |grep ora
oracleacfs           5173248  0
oracleadvm           1146880  0
oracleoks             753664  2 oracleadvm,oracleacfs
oracleasm              61440  1
[root@oranode1 bin]#

In case lsmod did not show oracleadvm & oracleacfs modeues then perform the below command (Not Mandatory)

[root@oranode1 bin]# acfsroot install
ACFS-9544: Invalid files or directories found: 'missing[], extra[4.1.12]'
ACFS-9300: ADVM/ACFS distribution files found.
ACFS-9314: Removing previous ADVM/ACFS installation.
ACFS-9315: Previous ADVM/ACFS components successfully removed.
ACFS-9294: updating file /etc/sysconfig/oracledrivers.conf
ACFS-9307: Installing requested ADVM/ACFS software.
ACFS-9294: updating file /etc/sysconfig/oracledrivers.conf
ACFS-9308: Loading installed ADVM/ACFS drivers.
ACFS-9321: Creating udev for ADVM/ACFS.
ACFS-9323: Creating module dependencies - this may take some time.
ACFS-9154: Loading 'oracleoks.ko' driver.
ACFS-9154: Loading 'oracleadvm.ko' driver.
ACFS-9154: Loading 'oracleacfs.ko' driver.
ACFS-9327: Verifying ADVM/ACFS devices.
ACFS-9156: Detecting control device '/dev/asm/.asm_ctl_spec'.
ACFS-9156: Detecting control device '/dev/ofsctl'.
ACFS-9309: ADVM/ACFS installation correctness verified.
[root@oranode1 bin]#

[root@oranode1 bin]# ./acfsdriverstate supported
ACFS-9544: Invalid files or directories found: 'missing[], extra[4.1.12]'
ACFS-9200: Supported
[root@oranode1 bin]#

Regards,
Mallik

Wednesday, August 2, 2023

GI - Grid Infrastructure Maintenance on Restart Server

GI - Grid Infrastructure Maintenance for Restart Server

1. How to Stop and Start Database?
2. How to Stop and Start ASM Instance?
3. How to Stop and Start HAS?

Database:
==========
SQL> shut immediate 
SQL> startup;
SQL> startup force;

$srvctl status database -d TESTDB 
$srvctl config database -d TESTDB 
$srvctl stop database -d TESTDB 
$srvctl start database -d TESTDB 

ASM:
====
SQL> shut immediate 
SQL> startup;

$srvctl status asm
$srvctl config asm
$srvctl stop asm
$srvctl stop asm -f
$srvctl start asm

ASMCMD> shutdown ---immediate/--abort
ASMCMD> startup

HAS/OHASD:
==========
$crsctl check has 
$crsctl stop has 
$crsctl stop has -f
$crsctl start has 
$crsctl stat res -t -init

#systemctl status ohasd
#systemctl stop ohasd
#systemctl start ohasd

##### Verify the Database and ASM Instances on Oracle Restart Server ######

[root@oraclelab2 ~]# ps -ef|grep smon
root      9222  9133  0 11:47 pts/5    00:00:00 grep --color=auto smon
oracle   28574     1  0 Aug01 ?        00:00:01 asm_smon_+ASM
oracle   28737     1  0 Aug01 ?        00:00:01 ora_smon_TESTDB
[root@oraclelab2 ~]#

[root@oraclelab2 ~]# su - oracle
Last login: Wed Aug  2 09:11:49 IST 2023 on pts/1
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ . oraenv
ORACLE_SID = [oracle] ? +ASM
The Oracle base has been set to /u01/app/oracle
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ srvctl config asm
ASM home: <CRS home>
Password file: +OCR/orapwasm
Backup of Password file:
ASM listener: LISTENER
Spfile: +OCR/ASM/ASMPARAMETERFILE/registry.253.1135130687
ASM diskgroup discovery string: /dev/oracleasm/disks/*

[oracle@oraclelab2 ~]$ srvctl status asm
ASM is running on oraclelab2
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ . oraenv
ORACLE_SID = [+ASM] ? TESTDB
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ env |grep ORA
ORACLE_SID=TESTDB
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ srvctl status database -d TESTDB
Database is running.
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ srvctl config database -d TESTDB
Database unique name: TESTDB
Database name: TESTDB
Oracle home: /u01/app/oracle/product/19.0.0.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/TESTDB/PARAMETERFILE/spfile.265.1143706501
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: DATA,RECO
Services:
OSDBA group: oinstall
OSOPER group: oinstall
Database instance: TESTDB
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ ###Starting & Stopping Database####

[oracle@oraclelab2 ~]$ srvctl status database -d TESTDB
Database is running.
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle    9516  9227  0 11:48 pts/5    00:00:00 grep --color=auto smon
oracle   28574     1  0 Aug01 ?        00:00:01 asm_smon_+ASM
oracle   28737     1  0 Aug01 ?        00:00:01 ora_smon_TESTDB
[oracle@oraclelab2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Aug 2 11:49:18 2023
Version 19.17.0.0.0

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

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oraclelab2 ~]$ srvctl stop database -d TESTDB
[oracle@oraclelab2 ~]$ srvctl status database -d TESTDB
Database is not running.
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle    9633  9227  0 11:49 pts/5    00:00:00 grep --color=auto smon
oracle   28574     1  0 Aug01 ?        00:00:01 asm_smon_+ASM
[oracle@oraclelab2 ~]$ srvctl start database -d TESTDB
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ srvctl status database -d TESTDB
Database is running.
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle    9775     1  0 11:50 ?        00:00:00 ora_smon_TESTDB
oracle   10125  9227  0 11:50 pts/5    00:00:00 grep --color=auto smon
oracle   28574     1  0 Aug01 ?        00:00:01 asm_smon_+ASM
[oracle@oraclelab2 ~]$

#### Starting & Stopping ASM which will impact Databases which are residing under ASM #####

[oracle@oraclelab2 ~]$ . oraenv
ORACLE_SID = [TESTDB] ? +ASM
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ env |grep ORA
ORACLE_SID=+ASM
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/19.0.0.0/grid
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ srvctl status asm
ASM is running on oraclelab2
[oracle@oraclelab2 ~]$ srvctl config asm
ASM home: <CRS home>
Password file: +OCR/orapwasm
Backup of Password file:
ASM listener: LISTENER
Spfile: +OCR/ASM/ASMPARAMETERFILE/registry.253.1135130687
ASM diskgroup discovery string: /dev/oracleasm/disks/*
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ srvctl stop asm
PRCR-1065 : Failed to stop resource ora.asm
CRS-2974: unable to act on resource 'ora.asm' on server 'oraclelab2' because that would require stopping or relocating resource 'ora.testdb.db' but the appropriate force flag was not specified
[oracle@oraclelab2 ~]$

 # Above command failed due to fact that TESTDB database act as client connection to ASM #
 # Use force option to stop ASM #

[oracle@oraclelab2 ~]$ srvctl stop asm -f
[oracle@oraclelab2 ~]$ srvctl status asm
ASM is not running.
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle   10496  9227  0 11:53 pts/5    00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$

# We stopped ASM but underlying database TESTDB also went down, Once we start the ASM TESTDB database also will comes back online automatically #

[oracle@oraclelab2 ~]$ srvctl start asm
[oracle@oraclelab2 ~]$ srvctl status asm
ASM is running on oraclelab2
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle   10658     1  0 11:55 ?        00:00:00 asm_smon_+ASM
oracle   10806     1  0 11:55 ?        00:00:00 ora_smon_TESTDB
oracle   11201  9227  0 11:55 pts/5    00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$

#### Starting & Stopping HAS will impact ASM as well as Database since both ASM and Database will run on top of HAS ####

# In order to stop ans start HAS we have use crsctl utility and run as root user #

[root@oraclelab2 ~]# . oraenv
ORACLE_SID = [root] ? +ASM
The Oracle base has been set to /u01/app/oracle
[root@oraclelab2 ~]#

[root@oraclelab2 ~]# env |grep ORA
ORACLE_SID=+ASM
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/19.0.0.0/grid
[root@oraclelab2 ~]#

[root@oraclelab2 ~]# crsctl check has
CRS-4638: Oracle High Availability Services is online
[root@oraclelab2 ~]#

[root@oraclelab2 ~]# crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'oraclelab2'
CRS-2673: Attempting to stop 'ora.testdb.db' on 'oraclelab2'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'oraclelab2'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'oraclelab2' succeeded
CRS-2677: Stop of 'ora.testdb.db' on 'oraclelab2' succeeded
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'oraclelab2'
CRS-2677: Stop of 'ora.DATA.dg' on 'oraclelab2' succeeded
CRS-2673: Attempting to stop 'ora.DGROUPC.dg' on 'oraclelab2'
CRS-2673: Attempting to stop 'ora.OCR.dg' on 'oraclelab2'
CRS-2673: Attempting to stop 'ora.RECO.dg' on 'oraclelab2'
CRS-2677: Stop of 'ora.RECO.dg' on 'oraclelab2' succeeded
CRS-2677: Stop of 'ora.DGROUPC.dg' on 'oraclelab2' succeeded
CRS-2677: Stop of 'ora.OCR.dg' on 'oraclelab2' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'oraclelab2'
CRS-2677: Stop of 'ora.asm' on 'oraclelab2' succeeded
CRS-2673: Attempting to stop 'ora.evmd' on 'oraclelab2'
CRS-2677: Stop of 'ora.evmd' on 'oraclelab2' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'oraclelab2'
CRS-2677: Stop of 'ora.cssd' on 'oraclelab2' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'oraclelab2' has completed
CRS-4133: Oracle High Availability Services has been stopped.

[root@oraclelab2 ~]# crsctl start has
CRS-4123: Oracle High Availability Services has been started.
[root@oraclelab2 ~]#

[root@oraclelab2 ~]# crsctl check has
CRS-4638: Oracle High Availability Services is online
[root@oraclelab2 ~]#

[root@oraclelab2 ~]# ps -ef|grep smon
oracle   11911     1  0 11:58 ?        00:00:00 asm_smon_+ASM
oracle   12062     1  0 11:59 ?        00:00:00 ora_smon_TESTDB
root     12913 12802  0 12:05 pts/6    00:00:00 grep --color=auto smon
[root@oraclelab2 ~]#

##### We can stop & start HAS using systemctl utility ####

[root@oraclelab2 ~]# systemctl status ohasd
● ohasd.service - LSB: Start and Stop Oracle High Availability Service
   Loaded: loaded (/etc/rc.d/init.d/ohasd; bad; vendor preset: disabled)
   Active: active (exited) since Fri 2023-06-16 19:15:25 IST; 1 months 16 days ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3529 ExecStart=/etc/rc.d/init.d/ohasd start (code=exited, status=0/SUCCESS)
    Tasks: 0
   Memory: 0B

Jun 16 19:15:25 oraclelab2.localdomain.com systemd[1]: Starting LSB: Start and Stop Oracle High Availability Service...
Jun 16 19:15:25 oraclelab2.localdomain.com ohasd[3529]: Starting ohasd:
Jun 16 19:15:25 oraclelab2.localdomain.com su[3566]: (to oracle) root on none
Jun 16 19:15:25 oraclelab2.localdomain.com ohasd[3529]: CRS-4123: Oracle High Availability Services has been started.
Jun 16 19:15:25 oraclelab2.localdomain.com systemd[1]: Started LSB: Start and Stop Oracle High Availability Service.

[root@oraclelab2 ~]# systemctl stop ohasd

[root@oraclelab2 ~]# ps -ef|grep smon
root     19131 17810  0 13:32 pts/4    00:00:00 grep --color=auto smon

[root@oraclelab2 ~]# systemctl start ohasd

[root@oraclelab2 ~]# systemctl status ohasd
● ohasd.service - LSB: Start and Stop Oracle High Availability Service
   Loaded: loaded (/etc/rc.d/init.d/ohasd; bad; vendor preset: disabled)
   Active: active (exited) since Wed 2023-08-02 13:32:49 IST; 5s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 19023 ExecStop=/etc/rc.d/init.d/ohasd stop (code=exited, status=0/SUCCESS)
  Process: 19172 ExecStart=/etc/rc.d/init.d/ohasd start (code=exited, status=0/SUCCESS)

Aug 02 13:32:49 oraclelab2.localdomain.com systemd[1]: Starting LSB: Start and Stop Oracle High Availability Service...
Aug 02 13:32:49 oraclelab2.localdomain.com ohasd[19172]: Starting ohasd:
Aug 02 13:32:49 oraclelab2.localdomain.com su[19199]: (to oracle) root on none
Aug 02 13:32:49 oraclelab2.localdomain.com ohasd[19172]: CRS-4123: Oracle High Availability Services has been started.
Aug 02 13:32:49 oraclelab2.localdomain.com systemd[1]: Started LSB: Start and Stop Oracle High Availability Service.

[root@oraclelab2 ~]# ps -ef|grep smon
root     19587 17810  0 13:33 pts/4    00:00:00 grep --color=auto smon

[root@oraclelab2 ~]# ps -ef|grep smon
oracle   19691     1  0 13:33 ?        00:00:00 asm_smon_+ASM
root     19724 17810  0 13:33 pts/4    00:00:00 grep --color=auto smon
[root@oraclelab2 ~]#

[root@oraclelab2 ~]# ps -ef|grep smon
oracle   19691     1  0 13:33 ?        00:00:00 asm_smon_+ASM
oracle   19853     1  0 13:33 ?        00:00:00 ora_smon_TESTDB
root     21350 17810  0 13:50 pts/4    00:00:00 grep --color=auto smon
[root@oraclelab2 ~]#

Extra Note:

1. Stop & Start ASM instance using SQL command line:

[oracle@oraclelab2 ~]$ sqlplus / as sysasm

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Aug 2 13:53:09 2023
Version 19.17.0.0.0

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

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> shut immediate; >>>>>>>>>>>>>>>>>>> In case immediate did not work then we can use abort 
ASM diskgroups volume disabled
ASM diskgroups dismounted
ASM instance shutdown
SQL>

[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle   21845 21370  0 13:54 pts/4    00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$ sqlplus / as sysasm

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Aug 2 13:54:11 2023
Version 19.17.0.0.0

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

Connected to an idle instance.

SQL> startup;
ASM instance started

Total System Global Area 1137173320 bytes
Fixed Size                  8905544 bytes
Variable Size            1103101952 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle   21914     1  0 13:54 ?        00:00:00 asm_smon_+ASM
oracle   22053 21370  0 13:55 pts/4    00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$

2. Stop & Start ASM instance using ASMCMD command line:

ASMCMD [+] > shutdown --immediate
ASM diskgroups volume disabled
ASM diskgroups dismounted
ASM instance shutdown
Connected to an idle instance.
ASMCMD [+] > exit
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle   22669 21370  0 13:58 pts/4    00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ asmcmd -p
Connected to an idle instance.
ASMCMD [+] > startup;
ASM instance started

Total System Global Area 1137173320 bytes
Fixed Size                  8905544 bytes
Variable Size            1103101952 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled
ASMCMD [+] > exit

[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle   22859     1  0 13:59 ?        00:00:00 asm_smon_+ASM
oracle   22987 21370  0 13:59 pts/4    00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle   22859     1  0 13:59 ?        00:00:00 asm_smon_+ASM
oracle   23938     1  0 14:11 ?        00:00:00 ora_smon_TESTDB
oracle   24249 21370  0 14:11 pts/4    00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$

3. Stop & Start Database using SQL command line or using srvctl utility

[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle   24762     1  0 14:13 ?        00:00:00 asm_smon_+ASM
oracle   25212     1  0 14:16 ?        00:00:00 ora_smon_TESTDB
oracle   27293 21370  0 14:42 pts/4    00:00:00 grep --color=auto smon

[oracle@oraclelab2 ~]$ srvctl status database -d TESTDB
[oracle@oraclelab2 ~]$ srvctl stop database -d TESTDB

[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle   24762     1  0 14:13 ?        00:00:00 asm_smon_+ASM
oracle   25052 21370  0 14:15 pts/4    00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ srvctl start database -d TESTDB
[oracle@oraclelab2 ~]$ srvctl status database -d TESTDB
Database is running.
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle   24762     1  0 14:13 ?        00:00:00 asm_smon_+ASM
oracle   25212     1  0 14:16 ?        00:00:00 ora_smon_TESTDB
oracle   27293 21370  0 14:42 pts/4    00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Aug 2 14:43:55 2023
Version 19.17.0.0.0

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

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle   24762     1  0 14:13 ?        00:00:00 asm_smon_+ASM
oracle   27415 21370  0 14:44 pts/4    00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Aug 2 14:44:37 2023
Version 19.17.0.0.0

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 3707763120 bytes
Fixed Size                  8903088 bytes
Variable Size             721420288 bytes
Database Buffers         2969567232 bytes
Redo Buffers                7872512 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle   24762     1  0 14:13 ?        00:00:00 asm_smon_+ASM
oracle   27507     1  0 14:44 ?        00:00:00 ora_smon_TESTDB
oracle   28042 21370  0 14:46 pts/4    00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ srvctl status database -d TESTDB
Database is running.
[oracle@oraclelab2 ~]$

Regards,
Mallik

Automation Script | Archivelog Generation Hourly Monitoring

1. List out all the running databases and pic one database where we want to monitore the archive log generation from last 1 month. [oracle@o...