Showing posts with label 12C. Show all posts
Showing posts with label 12C. Show all posts

Friday, 5 June 2026

SSH Equivalency Setup in Oracle Exadata – Step-by-Step Guide

 

SSH Equivalency Setup in Oracle Exadata – Step-by-Step Guide

Introduction

SSH equivalency is a mandatory requirement in Oracle Exadata environments. It enables passwordless SSH communication between database servers, storage servers (cells), and other Exadata components.

SSH equivalency is used during:

  • Exadata deployment

  • OneCommand setup

  • Patching activities

  • Exachk execution

  • Automation scripts

  • Cluster operations

This guide demonstrates how to configure SSH equivalency securely in an Oracle Exadata environment.


Environment Details

Example Exadata Environment:

HostnameType
db01Database Server
db02Database Server
cell01Storage Server
cell02Storage Server
cell03Storage Server

User:

oracle

Step 1: Verify Connectivity

From db01, verify connectivity to all nodes.

ping db02
ping cell01
ping cell02
ping cell03

Expected Result:

64 bytes from db02
64 bytes from cell01

Step 2: Generate SSH Key

Login as oracle user.

su - oracle

Generate SSH key.

ssh-keygen -t rsa

Press Enter for all prompts.

Verify key files:

ls -ltr ~/.ssh

Expected:

id_rsa
id_rsa.pub

Step 3: Copy Public Key to Remote Servers

Copy public key to all target nodes.

ssh-copy-id oracle@db02

ssh-copy-id oracle@cell01

ssh-copy-id oracle@cell02

ssh-copy-id oracle@cell03

Enter password when prompted.


Step 4: Verify Passwordless Login

Test SSH connectivity.

ssh db02 hostname

ssh cell01 hostname

ssh cell02 hostname

ssh cell03 hostname

Expected Output:

db02
cell01
cell02
cell03

No password should be requested.


Step 5: Configure Reverse Connectivity

Perform the same steps from db02 to db01.

Generate keys:

ssh-keygen -t rsa

Copy keys:

ssh-copy-id oracle@db01

Validate:

ssh db01 hostname

Step 6: Validate SSH Equivalency

Execute the following command from each database node.

ssh db01 date

ssh db02 date

ssh cell01 date

ssh cell02 date

ssh cell03 date

All commands should execute without password prompts.


Step 7: Verify Authorized Keys

Check authorized_keys file.

cat ~/.ssh/authorized_keys

Ensure public keys from all participating nodes are present.

Permissions:

chmod 700 ~/.ssh

chmod 600 ~/.ssh/authorized_keys

chmod 600 ~/.ssh/id_rsa

Common Issues and Troubleshooting

Permission Denied

Error:

Permission denied (publickey)

Solution:

chmod 700 ~/.ssh

chmod 600 ~/.ssh/authorized_keys

Host Key Verification Failed

Error:

Host key verification failed

Solution:

ssh-keygen -R hostname

Reconnect:

ssh hostname

SSH Timeout

Verify:

ping hostname

nslookup hostname

Check firewall configuration.


Validation Checklist

CheckStatus
SSH keys generated
Public keys copied
Passwordless login working
Authorized keys validated
Permissions verified

Conclusion

SSH equivalency is a critical prerequisite for Oracle Exadata administration, patching, and automation activities. Properly configured passwordless SSH improves operational efficiency and reduces manual intervention during maintenance and deployment tasks.

Always validate connectivity and file permissions after configuration to avoid failures during patching and cluster operations.

Sunday, 21 September 2025

ORA-01102: cannot mount database in EXCLUSIVE mode

The ORA-01102 error "cannot mount database in EXCLUSIVE mode" occurs when an Oracle instance tries to mount the database in exclusive mode but another instance has already mounted the database either exclusively or in parallel mode.

1. Shutdown any other instances that may have the database mounted:

SHUTDOWN IMMEDIATE;

2. Kill any remaining Oracle background or shadow processes related to the database using OS commands:

kill -9 <process_ids>

[oracle@muthu ~]$ ps -ef|grep pmon

oracle    1821     1  0 16:40 ?        00:00:00 ora_pmon_oradbsby

oracle    2750     1  0 16:41 ?        00:00:00 ora_pmon_oradb

oracle    2936  2626  0 16:42 pts/0    00:00:00 grep --color=auto pmon

[oracle@muthu ~]$ kill -9 2750

[oracle@muthu ~]$ kill -9 1821

3. Check and remove the stale lock file lk<SID> in the $ORACLE_HOME/dbs directory if it exists.

4. Remove any leftover shared memory segments and semaphores related to the Oracle SID.

5. In RAC, verify the cluster_database parameter is set to TRUE for all instances.

6. After cleaning up, start the database again:

STARTUP MOUNT;

This error is mostly about ensuring no conflicting instance is holding the database open and cleaning up orphaned processes or locks so the instance can mount the database exclusively without conflict.

Saturday, 20 September 2025

To recover the lost logs in oracle database

***

Oracle Database Recovery and Backup Task Documentation

This document describes the steps performed for deleting redo log files, performing an RMAN point-in-time recovery, and backing up the database with archived logs in an Oracle 12c environment with a multitenant container database (CDB) and pluggable database (PDB).

***

Environment and Initial Setup

- Oracle Database version: 12c Release 12.2.0.1.0 (64-bit Enterprise Edition)
- Working with Container Database (CDB) and Pluggable Database (PDB1)
- OS user: oracle
- Date and time of operations: Sep 20, 2025, around 18:30 to 18:50 +04 timezone

***

Step 1: Switch Container and Create Table

1. Set container to PDB1:
SQL> alter session set container=PDB1;

Session altered.

2. Verify PDB status:SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         3 PDB1                           READ WRITE NO

3. Create a simple table named `emp` with columns `id` (int) and `name` (varchar(100)):
SQL> create table emp(id int,name varchar(100));

Table created.

4. Insert one row into the `emp` table:
SQL> insert into emp values (1,'Muthu');

1 row created.

SQL> commit;

Commit complete.

5. Validate the data insertion:
SQL> select * from emp;

        ID        NAME
--------------------------------------------------------------------------------
         1         Muthu

6. Check the current System Change Number (SCN):

SQL> select current_scn from v$database;

CURRENT_SCN
-----------
    2779187

7. Confirm the current date/time from the OS shell:
SQL> !date
Sat Sep 20 18:32:15 +04 2025

***

Step 2: List and Remove Redo Log Files

1. List redo log members (files):

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/oradb/redo03.log
/u01/app/oracle/oradata/oradb/redo02.log
/u01/app/oracle/oradata/oradb/redo01.log

2. List the contents of Oracle data directory:
SQL> !ls -lrt /u01/app/oracle/oradata/oradb/
total 2498756
drwxr-x---. 2 oracle oinstall      4096 Sep  4  2020 pdbseed
drwxr-x---. 2 oracle oinstall       104 Sep  4  2020 pdb1
-rw-r-----. 1 oracle oinstall 142614528 Sep 20 18:20 temp01.dbf
-rw-r-----. 1 oracle oinstall 209715712 Sep 20 18:36 redo01.log
-rw-r-----. 1 oracle oinstall 209715712 Sep 20 18:37 redo02.log
-rw-r-----. 1 oracle oinstall 849354752 Sep 20 18:37 system01.dbf
-rw-r-----. 1 oracle oinstall 639639552 Sep 20 18:37 sysaux01.dbf
-rw-r-----. 1 oracle oinstall 283123712 Sep 20 18:37 undotbs01.dbf
-rw-r-----. 1 oracle oinstall   5251072 Sep 20 18:37 users01.dbf
-rw-r-----  1 oracle oinstall 209715712 Sep 20 18:37 redo03.log
-rw-r-----. 1 oracle oinstall  18726912 Sep 20 18:38 control01.ctl

3. Remove all redo log files from directory:

SQL> !rm /u01/app/oracle/oradata/oradb/redo*

4. Confirm redo log files removal by listing directory again:

SQL> !ls -lrt /u01/app/oracle/oradata/oradb/
total 1884344
drwxr-x---. 2 oracle oinstall      4096 Sep  4  2020 pdbseed
drwxr-x---. 2 oracle oinstall       104 Sep  4  2020 pdb1
-rw-r-----. 1 oracle oinstall 142614528 Sep 20 18:20 temp01.dbf
-rw-r-----. 1 oracle oinstall 849354752 Sep 20 18:37 system01.dbf
-rw-r-----. 1 oracle oinstall 639639552 Sep 20 18:37 sysaux01.dbf
-rw-r-----. 1 oracle oinstall 283123712 Sep 20 18:37 undotbs01.dbf
-rw-r-----. 1 oracle oinstall   5251072 Sep 20 18:37 users01.dbf
-rw-r-----. 1 oracle oinstall  18726912 Sep 20 18:38 control01.ctl

***

Step 3: Shutdown Database and Mount for Recovery

1. Shutdown the database immediately:
SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount;
ORACLE instance started.

Total System Global Area  801112064 bytes
Fixed Size                  8797872 bytes
Variable Size             423625040 bytes
Database Buffers          360710144 bytes
Redo Buffers                7979008 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

***

Step 4: RMAN Point-in-Time Recovery to a Specific Sequence

1. Start RMAN and connect to target database:

[oracle@muthu trace]$ rman target /

Recovery Manager: Release 12.2.0.1.0 - Production on Sat Sep 20 18:40:06 2025

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

connected to target database: ORADB (DBID=2803495960, not open)

2. Run recovery commands:
RMAN> run
{
set until sequence 3;
restore database;
recover database;
alter database open resetlogs;
}2> 3> 4> 5> 6> 7>

executing command: SET until clause
Starting restore at 20-SEP-2025 18:40:21
using target database control file instead of recovery catalog
flashing back control file to SCN 2780743
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK

skipping datafile 5; already restored to file /u01/app/oracle/oradata/oradb/pdbseed/system01.dbf
skipping datafile 6; already restored to file /u01/app/oracle/oradata/oradb/pdbseed/sysaux01.dbf
skipping datafile 8; already restored to file /u01/app/oracle/oradata/oradb/pdbseed/undotbs01.dbf
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/oradb/system01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/oradb/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/oradb/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/oradb/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fra/oradb/ORADB/backupset/2025_09_20/o1_mf_nnndf_TAG20250920T183632_ndxgzjpn_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fra/oradb/ORADB/backupset/2025_09_20/o1_mf_nnndf_TAG20250920T183632_ndxgzjpn_.bkp tag=TAG20250920T183632

starting media recovery

archived log for thread 1 with sequence 1 is already on disk as file /u01/app/oracle/fra/oradb/ORADB/archivelog/2025_09_20/o1_mf_1_1_ndxgz7r8_.arc
archived log for thread 1 with sequence 2 is already on disk as file /u01/app/oracle/fra/oradb/ORADB/archivelog/2025_09_20/o1_mf_1_2_ndxh0h3t_.arc
archived log file name=/u01/app/oracle/fra/oradb/ORADB/archivelog/2025_09_20/o1_mf_1_1_ndxgz7r8_.arc thread=1 sequence=1
archived log file name=/u01/app/oracle/fra/oradb/ORADB/archivelog/2025_09_20/o1_mf_1_2_ndxh0h3t_.arc thread=1 sequence=2
media recovery complete, elapsed time: 00:00:01
Finished recover at 20-SEP-2025 18:40:53


Statement processed

RMAN>


***

Step 5: Validate Recovery and Backup
[oracle@muthu trace]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Sat Sep 20 18:44:09 2025

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL>  select name,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
ORADB     READ WRITE

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO

SQL> alter session set container=PDB1;

Session altered.

SQL> select current_scn from v$database;

CURRENT_SCN
-----------
    2782820

SQL> !date
Sat Sep 20 18:44:28 +04 2025


SQL> select * from emp;

        ID        NAME
--------------------------------------------------------------------------------
         1         Muthu
[oracle@muthu trace]$ rman target /

Recovery Manager: Release 12.2.0.1.0 - Production on Sat Sep 20 18:47:20 2025

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

connected to target database: ORADB

RMAN> backup database plus archivelog;

Finished Control File and SPFILE Autobackup at 20-SEP-2025 18:48:26

Sample Text

Sample text