Friday, September 2, 2022

ORA-01586: database must be mounted EXCLUSIVE and not open for this operation

 You can choose among multiple options to drop Oracle databases. 

1. DBCA (Silent Method or GUI)

2. Command Line Interface (startup mount restrict and then issue drop database) using sqlplus or rman
3. Manually cleaning up files

SQL> drop database;
drop database
*
ERROR at line 1:
ORA-01586: database must be mounted EXCLUSIVE and not open for this operation

We are decommissioning the RAC database here. So we need to change the parameter cluster_database=FALSE.

Set your database profile.

srvctl stop database -d <DB_name>
SQL> startup mount;
SQL> alter system enable restricted session;
SQL> alter system set cluster_database=FALSE scope=spfile;
SQL>Drop Database;
Database dropped.

How to find temporary MySQL Root Password after installation

 Sometimes once MySQL installation is done. You will not be able to find the temporary password, here I was working on the latest MySQL version 8.0.30-commercial MySQL Enterprise Server.

[root@Sajidserver01 ~]# grep -i pass /var/log/mysqld.log

Remove the /var/lib/mysql and restart mysqld as below

[root@Sajidserver01 ~]#cd /var/lib
[root@Sajidserver01 ~]#rm -rf mysql 
[root@Sajidserver01 ~]#systemctl stop mysqld
[root@Sajidserver01 ~]#systemctl start mysqld

Once it is done, you will find the new temporary password generated in mysqld.log below.

[root@Sajidserver01 ~]# grep -i pass /var/log/mysqld.log 
2022-09-01T21:32:34.029030Z 6 [Note] [MY-0454] [Server] A temporary password is generated for root@localhost: S2<3!chrde

Once it is done you can reset your password as per your standards using /usr/bin/mysql_secure_installation.