Sunday, January 15, 2023

Client Connectivity in Data Guard Configuration | HA service

Client Connectivity in Data Guard Configuration





create database service on primary database server


exec DBMS_SERVICE.CREATE_SERVICE (service_name => 'ddb_ha', network_name => 'ddb_ha');



create or replace procedure start_db_ha_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('ddb_ha');

else

DBMS_SERVICE.STOP_SERVICE('ddb_ha');

end if;

end;

/





TRIGGER TO START SERVICE ON DB STARTUP:


create or replace TRIGGER db_hasrv_on_startup

after startup on database

begin

start_db_ha_service;

end;

/


TRIGGER TO START SERVICE ON DB ROLECHANGE:


create or replace TRIGGER db_hasrv_on_role_change

after db_role_change on database

begin

start_db_ha_service;

end;

/


Start the new service on primary


SQL> exec start_db_ha_service;

SQL> alter system archive log current;






SQL>

SQL>

SQL> exec DBMS_SERVICE.CREATE_SERVICE (service_name => 'ddb_ha', network_name => 'ddb_ha');


PL/SQL procedure successfully completed.


SQL> create or replace procedure start_db_ha_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('ddb_ha');

else

DBMS_SERVICE.STOP_SERVICE('ddb_ha');

end if;

end;

/  2    3    4    5    6    7    8    9   10   11   12


Procedure created.


SQL> create or replace TRIGGER db_hasrv_on_startup

after startup on database

begin

start_db_ha_service;

end;

/

  2    3    4    5    6

Trigger created.


SQL>

SQL> create or replace TRIGGER db_hasrv_on_role_change

after db_role_change on database

begin

start_db_ha_service;

end;

/  2    3    4    5    6


Trigger created.


SQL>

SQL>

SQL> exec start_db_ha_service;


PL/SQL procedure successfully completed.


SQL>

SQL> alter system archive log current;


System altered.


SQL> alter system archive log current;


System altered.


SQL> /


System altered.


SQL> /


System altered.


SQL>

SQL>



tnsnames.ora (client site)




DDB =

  (DESCRIPTION =

    (ADDRESS_LIST=

      (ADDRESS = (PROTOCOL = TCP)(HOST = 9.82.83.159)(PORT = 1521))

      (ADDRESS = (PROTOCOL = TCP)(HOST = 72.471.436.842)(PORT = 1521))

    )

   (CONNECT_DATA = (SERVICE_NAME = ddb_ha)

     (FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES=60)(DELAY=20))

   )

  )  

  

  

  

  

About the Author : Anurag Pandey | Database cloud Architect | Oracle | SQL Server | PostgreSQL | AI and Data Platform Enthusiast

Anurag Pandey is a Database Architect with expertise in Oracle, PostgreSQL, SQL Server, Linux, and enterprise database platforms and specializes in database architecture, performance tuning, high availability, disaster recovery, cloud modernization, and operational excellence. With extensive experience in enterprise-scale environments, Anurag is passionate about leveraging AI, automation, and modern data platforms to improve reliability, scalability, and business outcomes. He actively contributes to technical communities through knowledge sharing, architecture guidance, and thought leadership in database and data engineering domains.

Follow more articles at

Visit Blog

Saturday, January 14, 2023

Use Orapwd utility to create Password File In Oracle

 Use Orapwd utility to create Password File In Oracle

  

  

orapwd file=orapwddb password=Rdx$1234567890 force=y

   

to avoid password verification:

  

orapwd file=orapwddb password=Rdx1234567890 force=y format=12




[oracle@dbs]$ sqlplus "/as sysdba"


SQL*Plus: Release 19.0.0.0.0 - Production on Sat Jan 14 13:07:04 2023

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle.  All rights reserved.



Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0


SQL> alter user sys identified by Rdx1234567890;


User altered.


About the Author : Anurag Pandey | Database cloud Architect | Oracle | SQL Server | PostgreSQL | AI and Data Platform Enthusiast

Anurag Pandey is a Database Architect with expertise in Oracle, PostgreSQL, SQL Server, Linux, and enterprise database platforms and specializes in database architecture, performance tuning, high availability, disaster recovery, cloud modernization, and operational excellence. With extensive experience in enterprise-scale environments, Anurag is passionate about leveraging AI, automation, and modern data platforms to improve reliability, scalability, and business outcomes. He actively contributes to technical communities through knowledge sharing, architecture guidance, and thought leadership in database and data engineering domains.

Follow more articles at

Visit Blog

How to Disable firewall on linux server : firewalld

 How to Disable firewall on linux server  : firewalld



[root@oracle ~]#

[root@oracle ~]#

[root@oracle ~]# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon

   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)

   Active: active (running) since Sat 2023-01-14 10:02:49 UTC; 50min ago

     Docs: man:firewalld(1)

 Main PID: 933 (firewalld)

   CGroup: /system.slice/firewalld.service

           └─933 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid


Jan 14 10:02:48 oracle systemd[1]: Starting firewalld - dynamic firewall daemon...

Jan 14 10:02:49 oracle systemd[1]: Started firewalld - dynamic firewall daemon.

[root@oracle ~]#

[root@oracle ~]#

[root@oracle ~]# service firewalld stop

Redirecting to /bin/systemctl stop firewalld.service

[root@oracle ~]#

[root@oracle ~]# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon

   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)

   Active: inactive (dead) since Sat 2023-01-14 10:55:01 UTC; 9s ago

     Docs: man:firewalld(1)

  Process: 933 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)

 Main PID: 933 (code=exited, status=0/SUCCESS)


Jan 14 10:02:48 oracle systemd[1]: Starting firewalld - dynamic firewall daemon...

Jan 14 10:02:49 oracle systemd[1]: Started firewalld - dynamic firewall daemon.

Jan 14 10:55:01 oracle systemd[1]: Stopping firewalld - dynamic firewall daemon...

Jan 14 10:55:01 oracle systemd[1]: Stopped firewalld - dynamic firewall daemon.

[root@oracle ~]#

[root@oracle ~]#

[root@oracle ~]# systemctl disable firewalld

Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.

Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

[root@oracle ~]#

[root@oracle ~]#

[root@oracle ~]#

[root@oracle ~]# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon

   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)

   Active: inactive (dead)

     Docs: man:firewalld(1)


Jan 14 10:02:48 oracle systemd[1]: Starting firewalld - dynamic firewall daemon...

Jan 14 10:02:49 oracle systemd[1]: Started firewalld - dynamic firewall daemon.

Jan 14 10:55:01 oracle systemd[1]: Stopping firewalld - dynamic firewall daemon...

Jan 14 10:55:01 oracle systemd[1]: Stopped firewalld - dynamic firewall daemon.

[root@oracle ~]#

[root@oracle ~]#

[root@oracle ~]#

About the Author : Anurag Pandey | Database cloud Architect | Oracle | SQL Server | PostgreSQL | AI and Data Platform Enthusiast

Anurag Pandey is a Database Architect with expertise in Oracle, PostgreSQL, SQL Server, Linux, and enterprise database platforms and specializes in database architecture, performance tuning, high availability, disaster recovery, cloud modernization, and operational excellence. With extensive experience in enterprise-scale environments, Anurag is passionate about leveraging AI, automation, and modern data platforms to improve reliability, scalability, and business outcomes. He actively contributes to technical communities through knowledge sharing, architecture guidance, and thought leadership in database and data engineering domains.

Follow more articles at

Visit Blog

Oracle RAC vs RAC One Node

Oracle RAC One Node is best understood as Oracle RAC infrastructure with only one active database instance at a time , plus the ability to r...