Friday, May 28, 2021

Recompile Invalid objects in PDB database (Multitenant)

 RECOMPILE INVALID OBJECTS IN PDB (PLUGGABLE DATABASE)

conn / as sysdba
alter session set container=PDB$SEED;

show con_name

select open_mode from v$database;

alter session set "_oracle_script"=TRUE;

alter pluggable database pdb$seed close immediate instances=all;

select open_mode from v$database;

alter pluggable database pdb$seed OPEN READ WRITE;

show con_name;

select open_mode from v$database;

@?/rdbms/admin/utlrp.sql

col COMP_NAME for a35;
col COMP_ID for a10;
set linesize 120;
select comp_id, comp_name, version, status from dba_registry;
select count(*) from dba_objects where status='INVALID';

col OBJECT_NAME for a30;

select object_name, object_type, owner from dba_objects where status='INVALID' order by owner;
select owner, object_type, count(*) from dba_objects where status = 'INVALID' group by owner, object_type;

alter pluggable database pdb$seed close immediate instances=all;

alter pluggable database pdb$seed OPEN READ ONLY;

show con_name;

select open_mode from v$database;

alter session set "_oracle_script"=FALSE;

Monday, May 24, 2021

ASM Diskgroups not mounting ORA-15040

 
ORA-15032 , ORA-15017 , ORA- 15040 , ASM Disk-group not found


ISSUE  after rebooting the server (ASM Disk groups not able to find)
The ASM diskgroup was nowhere to be found while querying the v$asm_diskgroup and v$asm_disks es.

ERROR: diskgroup ASM_DATA was not mounted
ORA-15032: not all alterations performed
ORA-15017: diskgroup "DATA" cannot be mounted
ORA-15040: diskgroup is incomplete


when ASM restarted
ran asmcmd > lsdg
No mount-points were visible
and while mounting the disk-groups manually its failing with the Error

ORA-15032 , ORA-15017 , ORA- 15040




Execute the following commands

$ORACLE_HOME/bin/kfod status=TRUE asm_diskstring='ORCL:*' disks=ALL

so running kfod again
/u01/app/grid/product/12.2.0/grid/bin/kfod status=TRUE asm_diskstring='/dev/oracleasm/disks/*' disks=ALL
 
--------------------------------------------------------------------------------
 Disk          Size Header    Path                                     User     Group
================================================================================
   1:     102400 MB MEMBER    /dev/oracleasm/disks/DATA_01         grid     oinstall
   2:     102400 MB MEMBER    /dev/oracleasm/disks/DATA_02         grid     oinstall
   3:     102400 MB MEMBER    /dev/oracleasm/disks/DATA_03         grid     oinstall
   4:     102400 MB MEMBER    /dev/oracleasm/disks/DATA_04         grid     oinstall
   5:     102400 MB MEMBER    /dev/oracleasm/disks/DATA_05         grid     oinstall
   6:     102400 MB MEMBER    /dev/oracleasm/disks/FRA_01          grid     oinstall
   7:     102400 MB MEMBER    /dev/oracleasm/disks/FRA_02          grid     oinstall
   8:     102400 MB MEMBER    /dev/oracleasm/disks/FRA_03          grid     oinstall
   9:     102400 MB MEMBER    /dev/oracleasm/disks/FRA_04          grid     oinstall
--------------------------------------------------------------------------------
ORACLE_SID ORACLE_HOME
================================================================================
      +ASM /u01/app/grid/product/12.2.0/grid
 
this display the correct disks so we need to change the diskstring to /dev/oracleasm/disks/*

Log in to the ASM instance as sysasm and set the asm_diskstring to what it was:

SQL> alter system set asm_diskstring='/dev/oracleasm/disks/*' scope=memory;
SQL> select name, state from v$asm_diskgroup;

NAME                           STATE
------------------------------ -----------
DATA                           DISMOUNTED
FRA                            DISMOUNTED
SQL> alter diskgroup DATA mount;

Diskgroup altered.

SQL> alter diskgroup FRA mount;

Diskgroup altered.

SYS@+ASM> select name, state from v$asm_diskgroup;

NAME                           STATE
------------------------------ -----------
DATA                           MOUNTED
FRA                            MOUNTED
Stop and restart HAS

crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'a04978'
CRS-2673: Attempting to stop 'ora.ASM_FRA.dg' on 'a04978'
CRS-2673: Attempting to stop 'ora.ASM_DATA.dg' on 'a04978'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'a04978'
CRS-2677: Stop of 'ora.ASM_FRA.dg' on 'a04978' succeeded
CRS-2677: Stop of 'ora.ASM_DATA.dg' on 'a04978' succeeded
CRS-2673: Attempting to stop 'ora.evmd' on 'a04978'
CRS-2673: Attempting to stop 'ora.asm' on 'a04978'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'a04978' succeeded
CRS-2677: Stop of 'ora.evmd' on 'a04978' succeeded
CRS-2677: Stop of 'ora.asm' on 'a04978' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'a04978'
CRS-2677: Stop of 'ora.cssd' on 'a04978' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'a04978' has completed
CRS-4133: Oracle High Availability Services has been stopped.
Start HAS

$ crsctl start has
CRS-4123: Oracle High Availability Services has been started.
 
Now restart the database and check disks are visible