ORA-01093: ALTER DATABASE CLOSE only permitted with no sessions connected
Tuesday, 27.05.2008 – DejanAko pokušavate uraditi prebacivanje primarne baze u standby bazu, može se desiti da dobijete ovu grešku:
ORA-01093: ALTER DATABASE CLOSE only permitted with no sessions connected
Prebacivanje (switchover) primarne baze u standby je moguće bez problema ukoliko u koloni v$database.SWITCHOVER_STATUS stoji vrijednost TO STANDBY. Međutim, ukoliko stoji vrijednost SESSIONS ACTIVE, onda će naredba “alter database commit to switchover to physical standby” javiti gorenavedenu grešku.
SQL> select switchover_status from v$database; SWITCHOVER_STATUS -------------------- SESSIONS ACTIVE 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
Listu aktivnih korisnika možete dobiti pomoću ovog upita:
SQL> select sid, process, program from v$session where type = 'USER' and sid <> (select distinct sid from v$mystat); SID PROCESS PROGRAM ---------- ------------ -------------------- 468 2340:3416 racgimon.exe 469 2340:3392 racgimon.exe 470 2340:1548 racgimon.exe 501 2340:3392 racgimon.exe
Rješenje je dodati klauzulu “WITH SESSION SHUTDOWN“, nakon čega će postupak prebacivanja (switchover) biti uspješan:
SQL> alter database commit to switchover to physical standby with session shutdown;
Ova naredba će prvo obustaviti sve korisničke radnje, pa tek potom obaviti prebacivanje primarne baze u standby bazu.
Napomena: U ovom slučaju smo racgimon.exe mogli zaustaviti i naredbom:
racgimon stop <instanca>
ili
racgimon stopd <ime_baze>