Thursday, 19 February 2026

how to fix opc user expiry issue in base database service for oracle@Azure

Environment: It is oracle@Azure and base database service provisioned 


if OPC user password has been expired and you need to follow below step to fix this issue.


In Step 1, I'm sharing Oracle Doc to login into your instance in rescue mode. Once you login into rescue mode. Then need to execute other command to fix password expiration issue in Step 2 and Step 3.


Step 1

=====

Video Form

=======

1) OCI Compute - How To Reset Forgotten Root Password Using Serial Console For Oracle Linux 7, 8, and 9 [Video] KB101078


URL : fa-etmi-saasfaprod1.fa.ocs.oraclecloud.com/fscmUI/redwood/myknowledge/content/container/main/article?answerId=2940603


Oracle Document

============

OCI: How To Reset Forgotten Root Password Using Serial Console For Oracle Linux 6, 7, 8, and 9 Instances (Doc ID 2489923.1)

URL - mosemp.us.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=196232300826152&id=2489923.1&_afrWindowMode=0&_adf.ctrl-state=uu8heermb_841


Above video is for password reset. Though, you don't need to do password reset. Just eecute below command in Step 2 to fix opc user expiration issue.


Step 2

=====

Once you're login into rescue mode then execute below commands.

# chage -l opc (Check the status of password expiration.)


If it's expired then set it to never

# chage -m 0 -M 99999 -I -1 -E -1 opc

# chage -l opc


Output should like below output once it set to never expire password.

Last password change : 

Password expires : never

Password inactive : never

Account expires : never

Minimum number of days between password change : 0

Maximum number of days between password change : 99999

Number of days of warning before password expires : 7


Step 3

====

If it's OL 8 then run below command as mentioned in Oracle doc step 1. Check if SELinux is enabled then run below SELinux command.


Force an SELinux relable.

bash-4.4# touch /.autorelabel

bash-4.4#

When ready, resume normal bootup.


bash-4.4# sync

bash-4.4#

bash-4.4# sync

bash-4.4#

bash-4.4# exec /usr/sbin/init


A> Reboot the broken node from the OCI console (Not Stop And Start)

B> The serial console will show you the boot process.

C> Interrupt the boot process when prompted "Press any key"

D> Enter the Grub menu, 'e' to edit , select the like starting with "kernel", 'e' to edit , add "init=/bin/bash" at the end of the line:

++ Scroll down to the last line, which starts with initrdefi.

++ Press the left arrow key to get to the end of the long, wrapped line that starts with linuxefi.

++ Press the space bar then add init=/bin/bash to the end of the line

++ Press Crtl-x to start the instance.

** Important **

For troubleshooting ssh connectivity issues, if grub asks for password, below values may be provided:

Username: root

Password: grub######


eg

we could successfully change the password of OPC User as below

you should have correct root Password for editing the boot menu.

we append init=bin/bash

it is importatant to remount,rw / then it is possible to set a new password for opc and logon 

[root@vmlhmdbc002 /]# cp /etc/shadow /etc/shadow.0

cp: cannot create regular file '/etc/shadow.0': Read-only file system

[root@vmlhmdbc002 /]# mount -o remount,rw /

[root@vmlhmdbc002 /]# cp /etc/shadow /etc/shadow.0

 

[root@vmlhmdbc002 /]# passwd opc

Changing password for user opc.

New password: 

Retype new password: 

passwd: all authentication tokens updated successfully.

 

[root@vmlhmdbc002 /]# touch /.autorelabel

[root@vmlhmdbc002 /]# sync

[root@vmlhmdbc002 /]# sync

[root@vmlhmdbc002 /]# exec /usr/sbin/init


Test:

ssh -i key_orabasec001.pem opc@vmleasyc002.ocidefault.ocieasyadbba.oraclevcn.com

[opc@vmleasyc002 ~]$ whoami

opc

opc@vmleasyc002 ~]$  chage -l opc

Last password change                                    : Feb 18, 2026

Password expires                                        : never

Password inactive                                       : never

Account expires                                         : never

Minimum number of days between password change          : 0

Maximum number of days between password change          : 99999

Number of days of warning before password expires       : 7

 

Sharing couple of Oracle Docs. Please follow below Oracle docs to attach boot volume to another instance and fix OPC password issue.

Note : Take a backup of impacted node prior to do any activity for safer side.

1) How to Reset the Password on OCI Oracle Linux Instances?

KB114663

URL: fa-etmi-saasfaprod1.fa.ocs.oraclecloud.com/fscmUI/redwood/myknowledge/content/container/main/article?answerId=2408898

2) OPC password expired in OCICKB31429

URL : fa-etmi-saasfaprod1.fa.ocs.oraclecloud.com/fscmUI/redwood/myknowledge/content/container/main/article?answerId=2510982


No comments:

Post a Comment