Pages

Tuesday, December 5, 2023

Archive logs is pointing to non exiting location

===============================
The Problem:
===============================
Archive destination is not available.
Oracle is running in ARCHIVE mode.
This is giving errors during startup

SQL> shutdown immediate
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Or
SQL> shutdown immediate;
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist

SQL> startup mount;
ORA-16032: parameter LOG_ARCHIVE_DEST_1 destination string cannot be translated
ORA-07286: sksagdi: cannot obtain device information.
Linux-x86_64 Error: 2: No such file or directory


The problem is this parameter (LOG_ARCHIVE_DEST_1) is pointing to non existent locatoin.
To change the value of LOG_ARCHIVE_DEST_1:


===============================
Steps to resolve Problem:
===============================

A. locate spfileigt.ora
/software/oracle/admin/igt/pfile/spfileigt.ora


STARTUP NOMOUNT;

B. Create a pfileigt.ora

SQL> create pfile='/software/oracle/admin/igt/pfile/orig_pfile.ora' 

from spfile='/software/oracle/admin/igt/pfile/spfileigt.ora';


File created.


C. Edit the new pfile.ora. change location for log_archive_dest_1

cp orig_pfile.ora pfile.ora

vi pfile.ora

Change from:*.log_archive_dest_1='location=/path/does/not/exist'
To:log_archive_dest_1='location=/path/does/exist'

For example:
diff orig_pfile.ora pfile.ora 
27c27
< *.log_archive_dest_1='location=/oracle_db/db2/db_igt/arch'
---
> *.log_archive_dest_1='location=/oracle_db/db1/db_igt/arch'

D. Replace between files and start instance from new spfile

cp spfileigt.ora orig_spfileigt.ora

CREATE SPFILE='/software/oracle/admin/igt/pfile/spfileigt.ora' 
FROM PFILE='/software/oracle/admin/igt/pfile/pfile.ora';
ERROR at line 1:
ORA-32002: cannot create SPFILE already being used by the instance

CREATE SPFILE='/software/oracle/admin/igt/pfile/spfileigt.ora_new' 
FROM PFILE='/software/oracle/admin/igt/pfile/pfile.ora';

SHUTDOWN IMMEDIATE;
ORA-01507: database not mounted
ORACLE instance shut down.

mv spfileigt.ora_new spfileigt.ora

cd /software/oracle/admin/igt/pfile
/software/oracle/admin/igt/pfile>% ls -l
-rw-r--r-- 1 oracle dba 1296 Dec  5 07:52 orig_pfile.ora
-rw-r----- 1 oracle dba 3584 Dec  5 07:52 orig_spfileigt.ora
-rw-r--r-- 1 oracle dba 1296 Dec  5 07:54 pfile.ora
-rw-r----- 1 oracle dba 3584 Dec  5 08:08 spfileigt.ora


E. Restart the database
SQL> STARTUP NOMOUNT;
ORACLE instance started.

Total System Global Area 8589930592 bytes
Fixed Size                 12456032 bytes
Variable Size            4328521728 bytes
Database Buffers         4227858432 bytes
Redo Buffers               21094400 bytes
SQL> ALTER DATABASE MOUNT;

Database altered.

F. Optionally - change database to be in NOARCHIVELOG mode
SQL> ALTER DATABASE NOARCHIVELOG;

Database altered.

SQL> ALTER DATABASE OPEN;

Database altered.

SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP;
ORACLE instance started.

Total System Global Area 8589930592 bytes
Fixed Size                 12456032 bytes
Variable Size            4328521728 bytes
Database Buffers         4227858432 bytes
Redo Buffers               21094400 bytes
Database mounted.
Database opened.
SQL> exit

G. Take backup with expdp

===================
In Short:
===================
Open two sessions
sqlplus 
STARTUP NOMOUNT;
CREATE PFILE='/software/oracle/admin/igt/pfile/orig_pfile.ora' 
FROM SPFILE='/software/oracle/admin/igt/pfile/spfileigt.ora';

Linux
cp orig_pfile.ora pfile.ora
vi pfile.ora
log_archive_dest_1='location=/oracle_db/db1/db_igt/arch

sqlplus 
CREATE SPFILE='/software/oracle/admin/igt/pfile/noarch_spfile.ora' 
FROM PFILE='/software/oracle/admin/igt/pfile/pfile.ora';

SHUTDOWN IMMEDIATE;

Linux 
cd /software/oracle/admin/igt/pfile
cp spfileigt.ora orig_spfileigt.ora
cp noarch_spfile.ora spfileigt.ora

sqlplus 
STARTUP NOMOUNT;
ALTER DATABASE MOUNT;
ALTER DATABASE NOARCHIVELOG;
ALTER DATABASE OPEN;
SHUTDOWN IMMEDIATE;
STARTUP;

No comments:

Post a Comment