ORA-01093: ALTER DATABASE CLOSE only permitted with no sessions connected

ORA-01093: ALTER DATABASE CLOSE only permitted with no sessions connected

Error occurred due to Switchover having active session

I am trying to switchover the primary database to standby database then i am getting the following error:

SQL> alter database commit to switchover to physical standby;
alter database commit to switchover to physical standby
*
ERROR at line 1:
ORA-01093: ALTER DATABASE CLOSE only permitted with no sessions connected

Solution:
For disconnect the active user you can use the clause WITH SESSION SHUTDOWN.

-- From primary if getting error:
PRIM> alter database commit to switchover to physical standby with session shutdown;

-- From Standby if getting error:
Standby> alter database commit to switchover to primary with session shutdown;

Note:
You can verify before switch over command with switchover_status column in v$database.
It tell you that any session is active at time of switchover or not.

Following value means session is active. use this command at both primary or Standby before switch over.

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE

Value of Switchover at primary and Standby as follow then it good to go for switchover the Dataguard environment

STAMDBY> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
TO PRIMARY

PRIM> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
TO STANDBY

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.