Thursday, November 14, 2019

ORA-00204:ORA-00202:ORA-27070:OSD-04006:O/S-Error:/Database not able to startup showing an error in reading control file

Database not able to startup showing an error in reading control file with following error
ORA-00204:ORA-00202:ORA-27070:OSD-04006:

ORA-00204: error in reading (block 3, # blocks 8) of control file                     
ORA-00202: control file: 'E:\oracle\ORADATA\LOCAL\CONTROL01.CTL'                       
ORA-27070: async read/write failed                                                     
OSD-04006: ReadFile() failure, unable to read from file                               
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.


When I startup the database getting the following error:


SQL> startup
ORACLE instance started.

Total System Global Area 3206836224 bytes
Fixed Size                  2180024 bytes
Variable Size            1996491848 bytes
Database Buffers         1191182336 bytes
Redo Buffers               16982016 bytes
ORA-00204: error in reading (block 3, # blocks 10) of control file
ORA-00202: control file: 'E:\oracle\ORADATA\LOCAL\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.

try to shutdown the database and do the following steps:

Shutdown immediate;
Startup or startup nomount;

If you get this kind of error while starting the database or try to mount the database then need to check the control file. are you able to access the control file path.?

to check the control file location stater the database with no mount state and use the below command

show parameter contrl

you may see the following path which have the control file locations.

SQL> show parameter control

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      E:\ORACLE\ORADATA\LOCAL\CONTRO
                                                 L01.CTL, C:\APP\ADMINISTRATOR\
                                                 FLASH_RECOVERY_AREA\LOCAL\CONT
                                                 ROL02.CTL
control_management_pack_access       string      DIAGNOSTIC+TUNING
SQL>


Conclusion :
The above error says control file may be corrupt.
So you need to start the database using contril2.ctl or you can copy the cocntrol2.ctl and rename to control1.ctl

and try to startup the database.



Monday, September 23, 2019

ORA-00119 :ORA-00132 invalid specification for system parameter LOCAL_LISTENER

ORA-00119 : invalid specification for system parameter LOCAL_LISTENER


When I try to start the database getting the following error :

SQL> STARTUP
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00132: syntax error or unresolved network name ‘LISTENER_LOCAL’

Solution :

Open tnsnames.ora file and check for "LISTENER_LOCAL" listener description.

Usually you will find the tns entry like as follow :


ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = test)
    )
  )


In the TNS list if you didn't find the alias name like 'LISTENER_LOCAL'

Please add one more entry with the string with database you try to point:



LISTENER_LOCAL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST =)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = )
    )
  )


Save the file and try to start the database.

SQL>STARTUP
ORACLE instance started.


Total System Global Area 1912602624 bytes
Fixed Size                  2005192 bytes
Variable Size             369100600 bytes
Database Buffers         1526726656 bytes
Redo Buffers               14770176 bytes
Database mounted.
Database opened.

Tuesday, June 11, 2019

Change noarchivelog mode to archivelog mode in RAC


To check database is in archive log mode or not :

Run the command archive log list;

[oracle@node4 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jun 10 12:29:02 2019

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL>
SQL> archive log list
Database log mode        No Archive Mode
Automatic archival        Disabled
Archive destination        /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/arch
Oldest online log sequence     2
Current log sequence        3
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

Based on above result database is in  "no archive mode".
This means database is not in archive log mode.

To enable the database in archive log mode in RAC  run the below commands.

1. Stop the database using SRVCTL.
2. Start database in mount state.
3. Run the command to enable the archive mode "alter database archivelog;"
4. Stop the database using SRVCTL.
5. Start database using SRVCTL.
6. Set the archive destination to ASM DISK by running the command
alter system set log_archive_dest_1='LOCATION=+FRADG/' scope=both sid='*';

After that connect to Sql and run  archive log list


Stop the database using SRVCTL :

[oracle@node4 ~]$ srvctl stop database -d racdb
[oracle@node4 ~]$

Start databse in mount state :

[oracle@node4 ~]$ srvctl start database -d racdb -o mount
[oracle@node4 ~]$
[oracle@node4 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jun 10 12:29:02 2019

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select instance_name,status,archiver from gv$instance;

INSTANCE_NAME STATUS       ARCHIVE
---------------- ------------ -------
racdb1 MOUNTED      STOPPED
racdb2 MOUNTED      STOPPED

SQL>

Run the command to enable the archive mode :

SQL> alter database archivelog;

Database altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[oracle@node4 ~]$

Stop the database using SRVCTL :

[oracle@node4 ~]$ srvctl stop database -d racdb
[oracle@node4 ~]$

Start the database using SRVCTL

[oracle@node4 ~]$ srvctl start database -d racdb
[oracle@node4 ~]$

Set the archive destination to ASM DISK by running the command  :

[oracle@node4 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jun 10 12:32:40 2019

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> alter system set log_archive_dest_1='LOCATION=+FRADG/' scope=both sid='*';

System altered.

SQL> select instance_name,status,archiver from gv$instance;

INSTANCE_NAME STATUS       ARCHIVE
---------------- ------------ -------
racdb1 OPEN       STARTED
racdb2 OPEN       STARTED

SQL>

Check archive log mode now :
SQL> archive log list
Database log mode        Archive Mode
Automatic archival        Enabled
Archive destination        +FRADG
Oldest online log sequence     2
Next log sequence to archive   3
Current log sequence        3
SQL>

To check log switch run the command

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> archive log list
Database log mode        Archive Mode
Automatic archival        Enabled
Archive destination        +FRADG
Oldest online log sequence     4
Next log sequence to archive   5
Current log sequence        5
SQL> 

ADD DISKS TO ASM DISKGROUP

How do I add a disks to ASM DISKGROUP ?

1. Create partition of disk /dev/sde which we got new LUN from Storage.

you can check the disks as fdisk -l

for formatting the disks :::

[root@node4 Ora-Soft]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x494214d4.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1):  >> enter
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261):  >> enter
Using default value 261

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

2.  Create ASM disk using oracleasm utility

[root@node4 Ora-Soft]# /etc/init.d/oracleasm createdisk ASMDISK2 /dev/sdc1
Marking disk "ASMDISK2" as an ASM disk:                    [  OK  ]

3  check Scadisks and Listdisks using oracleasm utility 

[root@node4 ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks:               [  OK  ]
[root@node4 ~]# /etc/init.d/oracleasm listdisks
ASMDISK1
ASMDISK2
ASMDISK3
[root@node4 ~]#


4. Now Add the newly created oracle ASM disk to existing ASM diskgroup with the help of following query:

Login to grid user and loin as sysasm and run the following Query.

[grid@node4 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jun 10 17:12:36 2019

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> select * from v$asm_operation;

no rows selected

SQL> ALTER DISKGROUP DATADG ADD DISK 'ORCL:ASMDISK2' REBALANCE POWER 11;

Diskgroup altered.

SQL> set lines 300
SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT      POWER     ACTUAL    SOFAR   EST_WORK   EST_RATE EST_MINUTES ERROR_CODE
------------ ----- ---- ---------- ---------- ---------- ---------- ---------- ----------- ------------
   1 REBAL RUN 11    11      288       1012   1366 0

Check Diskgroup size: 

SQL> SELECT NAME,TOTAL_MB/1024 as TOTAL_GB,FREE_MB /1024 as FREE_GB,(TOTAL_MB-FREE_MB)/1024 as USED_GB FROM v$asm_diskgroup; 

NAME TOTAL_GB    FREE_GB USED_GB
------------------------------ ---------- ---------- ----------
DATADG        3.99804688 2.01464844 1.98339844
FRADG        1.99902344 1.81347656 .185546875
VOTEDISK        1.99902344 1.61230469  .38671875

ORA-15032: not all alterations performed ORA-15260: permission denied on ASM disk group

When you add disks to ASM if you will get the following error :

SQL> ALTER DISKGROUP DATADG ADD DISK 'ORCL:DATADG2' REBALANCE POWER 11;
ALTER DISKGROUP DATADG ADD DISK 'ORCL:DATADG2' REBALANCE POWER 11
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15260: permission denied on ASM disk group

Solution : 
Connect as sysasm and try to run the commands.

[grid@node4 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jun 10 17:12:36 2019

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> select * from v$asm_operation;                                    

no rows selected

SQL> ALTER DISKGROUP DATADG ADD DISK 'ORCL:DATADG2' REBALANCE POWER 11;

Diskgroup altered.

Monday, January 14, 2019

Check maximum number of processes & processes used by schema

To check maximum number of processes & processes used  by schema :

select resource_name, current_utilization, max_utilization from v$resource_limit where resource_name in ('processes','sessions');

-- processes/sessions are getting is by running max utilization is the high level ::

SELECT inst_id,resource_name, current_utilization, max_utilization, limit_value FROM gv$resource_limit
WHERE resource_name in ('processes','sessions');



--See which machines/schemas are causing any process exhaustion ::

--number of processes using by schema or machine


select distinct
        s.inst_id,
        s.username,
        s.machine,
        count(*)
from    gv$session s,
        gv$process p
where   s.paddr       =  p.addr
and     s.inst_id     =  p.inst_id
GROUP BY         s.inst_id,
        s.username,
        s.machine
ORDER BY 4 desc;