ORA-01586: database must be mounted EXCLUSIVE and not open for this operation ao tentar apagar o banco de dados

oracle-11g-logo

Se você obteve o erro “ORA-01586: database must be mounted EXCLUSIVE and not open for this operation” após uma tentativa de apagar seu banco “drop database;”, este post pode te ajudar. Provavelmente este banco que você está tentando apagar é um Oracle RAC, acertei? Se sim, continue lendo…

 

Coloquei o banco no estado mounted e habilitei o modo restrito. No entanto, após tentar apagar o banco,  eis que resulta em um “ORA-01586: database must be mounted EXCLUSIVE and not open for this operation” , como se pode ver abaixo:

 

SQL> startup mount
ORACLE instance started.

Total System Global Area 2137886720 bytes
Fixed Size                  2248080 bytes
Variable Size            1660945008 bytes
Database Buffers          469762048 bytes
Redo Buffers                4931584 bytes
Database mounted.
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;

System altered.

SQL> select instance_name, status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
ORCL         MOUNTED

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

Para resolver o problema, vamos seguir os seguintes passos:

  • Alterar o parâmetro cluster_database para FALSE no spfile:


SQL> show parameters cluster_database

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cluster_database                     boolean     TRUE
cluster_database_instances           integer     2

SQL> alter system set cluster_database=FALSE scope=spfile;

System altered.

  • Efetuar o stop da instância no NODE 2. (Se tiver mais de 2 nós, efetue o stop dos demais e só deixe o nó 1 ativo):

oracle@ /oracle/app/oracle/product/11.2.0.4/bin $ ./srvctl stop instance -d ORCL -i ORCL2 -o immediate

 

  • Verificar o status das instâncias: (Somente o NODE 1 deve estar no ar):

oracle@ /oracle/app/oracle/product/11.2.0.4/bin $ ./srvctl status database -d ORCL
Instance ORCL1 is running on node tech01
Instance ORCL2 is not running on node tech02

  • No NODE 1, efetuar o stop e o startup no estado mount e, posteriormente habilitar o modo restrito:

SQL> shutdown immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 2137886720 bytes
Fixed Size                  2248080 bytes
Variable Size            1610613360 bytes
Database Buffers          520093696 bytes
Redo Buffers                4931584 bytes
Database mounted.

SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;

System altered.

SQL> select instance_name, status from gv$instance;

INSTANCE_NAME    STATUS
---------------- ------------
ORCL1          MOUNTED

 

  • Verificar as alterações refletidas após o stop/start da base de dados:

SQL> show parameters cluster_database

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cluster_database                     boolean     FALSE
cluster_database_instances           integer     1



 

  • Apagar a base de dados:
SQL> drop database;

Database dropped.

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
SQL>

kindregards

 

Related posts

Leave a Comment