archive log list;
alter database recover managed standby database disconnect;
select PROCESS,CLIENT_PROCESS,THREAD#,SEQUENCE#,BLOCK# from v$managed_standby where process = 'MRP0' or client_process='LGWR';
alter database recover managed standby database cancel;
alter database recover managed standby database disconnect;
desc v$managed_standby;
select process,status,sequence# from v$managed_standby;
alter database recover managed standby database cancel;
shutdown immediate
exec DBMS_SERVICE.CREATE_SERVICE (service_name => 'cdb1_rw', network_name => 'cdb1_rw', failover_method => 'BASIC', failover_type => 'SELECT', failover_retries => 30, failover_delay => 10);
create or replace procedure cdb_rw_service
is
v_role VARCHAR(30);
begin
select DATABASE_ROLE into v_role from V$DATABASE;
if v_role = 'PRIMARY' then
DBMS_SERVICE.START_SERVICE('cdb1_rw');
else
DBMS_SERVICE.STOP_SERVICE('cdb1_rw');
end if;
end;
/
create or replace TRIGGER db_startup
after startup on database
begin
cdb_rw_service;
end;
/
create or replace TRIGGER db_rolechange
after db_role_change on database
begin
cdb_rw_service;
end;
/
exec cdb_rw_service;
cdb =
(DESCRIPTION =
(ADDRESS_LIST=
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.10)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.20)(PORT = 1521))
)
(CONNECT_DATA = (SERVICE_NAME = cdb1_rw)
(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES=30)(DELAY=10))
)
)