OCI Load Balancer

What is Load Balancer.

Load balancer provide automated traffic distribution from one entry point to multiple servers reachable from your VCN. They improve resource utilization, facilitate scaling, and help ensure high availability.

Types of Load Balancers?

OCI provides two types of Load Balancers.

1. Load balancer

The load balancer service provides a reverse proxy solution that hides the IP of the client from backend application server and vice versa. It is capable of performing advanced layer 7 (HTTP/HTTPS), layer 4 (TCP) load balancing and SSL offloading.

Best for: Websites, mobile apps, SSL termination, and advanced HTTP handling.

2. Network load balancer.

The network load balancer service provides a pass-through (non-proxy solution) that is capable of preserving the client header (source and destination IP). It is built for speed, optimized for long running connections, high throughput and low latency.

Best for: Scaling network virtual appliances such as firewalls, real-time streaming, long running connections, Voice over IP (VoIP), Internet of Things (IoT), and trading platforms.

    Which load balancer is right for me?

    Load balancerNetwork load balancer
    The load balancer service provides a reverse proxy solution that hides the IP of the client from backend application server and vice versa. It is capable of performing advanced layer 7 (HTTP/HTTPS), layer 4 (TCP) load balancing and SSL offloading.
    Best for: Websites, mobile apps, SSL termination, and advanced HTTP handling.
    The network load balancer service provides a pass-through (non-proxy solution) that is capable of preserving the client header (source and destination IP). It is built for speed, optimized for long running connections, high throughput and low latency.
    Best for: Scaling network virtual appliances such as firewalls, real-time streaming, long running connections, Voice over IP (VoIP), Internet of Things (IoT), and trading platforms.
    Can load balance applications and processes.
    HTTP / HTTPS / TCP
    Can load balance packet forwarding, network traffic, and applications.
    TCP / UDP / ICMP / IP
    Acts as a reverse proxy.Can preserve the client header information.
    Can achieve up to 8Gbps per load balancer.Capable of scaling to multi-terabits per seconds.
    Supports backend autoscaling.Supports backend autoscaling.
    Can terminate SSL connections.Low-latency network integrated load balancer.
    Can have a web application firewall.Network load balancers are Always Free tier.
    One load balancer instance for free (limited to 10 Mbps).
    Additional instances billed hourly.

    Find more about OCI Load Balancer

    Click Load “Balancers” under the “Networking”

    I will choose public as it’s for webservers.

    Network and security team, will discuss about more options.

    You need to add the backends at this point.

    2 backends selected.

    You can choose the type of traffic and key too.

    OCI Demo: Creating instance and login

    Select VCN under the network and click ‘Start VCN Wizard’

    I will choose ‘Create VCN with Internet connectivity’. In next screen I will provide CIDR for private and public subnet

    Click next and it will provide all information,

    Note: you can see there are ‘Gateways’, ‘Security Lists’ and ‘Route tables’.

    Let’s expand ‘Gateways’, ‘Security Lists’ and ‘Route tables’. You can see internet gateway usage, ingress and egress in ‘Security lists’ etc.

    Now hit create button and it will create a FULLY WORKING vcn and other things inside it.

    Now create a compute instance.

    Click ‘Instance’ under the ‘Compute’ option. and provide details like machine, image, os etc.

    Once ready…you can connect to Sanjay_Webserver1 from your windows machine,

    ssh -i Downloads\ssh-key-2024-08-03.key ubuntu@143.47.225.152

    Note: There is nothing installed in this new machine.

    How To Install VIM on Ubuntu Linux Operating System

    1. Command To Update the apt package manager In Ubuntu – $ sudo apt update.
    2. Command To Search VIM – $ sudo apt search vim.
    3. Command To Install VIM – $ sudo apt install vim.
    4. Command To check the version Of VIM – $ vim –version.

    Public ip won’t be able to access the server/instance. In order to do that.

    Add ingress CIDR and allow traffic on port 80

    Part-1 OCI Network Design, VCN, and Subnets

    OCI Networking Best Practices document, along with examples for better understanding:

    1. Scalability with Dynamic Routing Gateway (DRG)

    • Feature: The DRG allows you to connect up to 300 Virtual Cloud Networks (VCNs).
    • Example: If your organization starts with a single VCN for development, as it grows, you can easily add additional VCNs for production, testing, and staging environments without redesigning the entire network.
    • Security: You can place network security appliances, such as firewalls, in the hub VCN to inspect traffic between spoke VCNs.
    • Example: A firewall in the hub can monitor and control traffic between a production VCN and a development VCN, ensuring that sensitive production data is protected.

    2. VCN Segmentation

    • Recommendation: Segment different network environments into separate VCNs for better management and security.
    • Example: Create one VCN for production (e.g., vcn-prod-ashburn) and another for non-production (e.g., vcn-nonprod-ashburn). This separation helps prevent accidental access to production resources from non-production environments.
    • Common Use Cases:
      • Production vs. Non-Production: Isolating environments to reduce risk.
      • Customer Segmentation: Different VCNs for different clients to ensure data privacy and compliance.

    3. Hub-and-Spoke Design

    • Tip: Implement a hub-and-spoke architecture to centralize connectivity and management.
    • Example: The hub VCN can serve as a central point for shared services (like DNS or logging), while spoke VCNs can be dedicated to specific applications or departments, such as finance or HR.

    4. Subnet Planning

    • Recommendation: Determine the types of subnets needed before provisioning.
    • Example: If you need a public subnet for web servers and a private subnet for databases, plan your CIDR blocks accordingly (e.g., 10.0.1.0/24 for public and 10.0.2.0/24 for private).

    5. VCN Flow Logs

    • Feature: VCN flow logs capture detailed traffic information.
    • Recommendation: Enable flow logs for each subnet after creation.
    • Example: If you notice unusual traffic patterns, you can analyze the flow logs to identify the source of the traffic and take appropriate action.
    • Log Management: Create a separate log group for better organization.
    • Cost Awareness: Be aware that storing logs incurs costs, so enable them judiciously.

    6. Project Planning for OCI Network Design

    • Recommendation: Allocate time and resources for thorough network design.
    • Example: Before launching a new application, spend time mapping out the network layout, including VCNs, subnets, and external connectivity, to avoid issues later.
    • Collaboration: Work with Oracle specialists for guidance.
    • Design Elements: Include layout, topology, sizing, DNS, and external connectivity in your design.

    7. Reference Architectures and Templates

    • Tip: Use reference architectures for common deployments as a starting point.
    • Example: If deploying Oracle E-Business Suite, refer to Oracle’s provided architecture to ensure best practices are followed.
    • Diagram Templates: Utilize OCI diagram templates to visualize your network design effectively.

    8. Standard Naming Conventions

    • Recommendation: Establish a standard naming convention for network resources.
    • Example: Use descriptive names like vcn-prod-ashburn for production VCNs, drg-ashburn for DRGs, and web-sn-sl for security lists. This clarity helps team members understand the purpose of each resource at a glance.
    • Naming Considerations: Be cautious with names that cannot be changed later, such as DNS labels.

    9. DNS Design with OCI Private DNS

    • Feature: OCI Private DNS allows for custom DNS domains and records within your VCNs.
    • Recommendation: Integrate DNS resolution across VCNs and on-premise environments early in your design.
    • Example: If you have a custom domain like oci.customer.com, you can create DNS records that resolve to resources in different VCNs, facilitating seamless connectivity.

    By following these detailed points and examples, organizations can effectively design and manage their OCI networking infrastructure, ensuring scalability, security, and operational efficiency.

    Part Two – OCI Network Security

    Here’s a detailed summary of the key topics covered in the document “OCI Networking Best Practices – Part Three – OCI Network Connectivity”:

    1. Introduction

    • The blog series aims to provide best practices and recommendations for designing, building, securing, and managing OCI network infrastructure.
    • This third part focuses on OCI network connectivity, specifically discussing IPSec VPN and FastConnect.
    • As organizations grow their cloud deployments, ensuring that critical applications are available and connected in a redundant manner is essential to support both planned and unplanned outages.

    2. Ensure Your Network Connectivity is Fully Redundant

    • Redundancy is crucial for maintaining the availability of critical applications hosted in OCI.
    • Customers need to ensure that their connectivity methods, such as IPSec VPN and FastConnect, are designed to handle outages effectively.
    • The document emphasizes the importance of planning for redundancy to avoid single points of failure in the network.

    3. IPSec Single and Dual CPE

    • It is recommended to deploy two Customer Premise Equipment (CPE) devices with a second set of IPSec tunnels.
    • Ideally, these CPEs should be located in different datacenters or geographies to maximize diversity.
    • If both CPEs are in the same datacenter, they should be on separate power supplies, LAN switches, and connected to different Internet Service Providers (ISPs).
    • The secondary connection must be capable of handling the bandwidth in case the primary connection fails.

    4. FastConnect Redundancy Best Practices

    • Review the FastConnect Redundancy Best Practices to understand the number of FastConnect locations available in your OCI region.
    • Identify your FastConnect scenario and assess the level of diversity it provides.
    • Ensure there are no single points of failure along the connectivity path, including in third-party or Oracle partner networks and on-premises setups.

    5. Using Border Gateway Protocol (BGP)

    • Implement BGP for dynamically advertising routes, which helps in providing predictable automatic network failover.
    • Regularly perform failover tests to validate that the redundant connections are functioning correctly. This should be done:
      • When first provisioning the connections.
      • On a regular basis (e.g., every 6 months or annually) during scheduled outage windows.

    6. Failover Testing

    • Conduct failover tests to ensure that the system behaves as expected during an outage.
    • It is critical to validate that the failback to the primary connection also works correctly after a failover.

    7. Conclusion

    • The document underscores the importance of planning and testing for redundancy in OCI network connectivity.
    • By following these best practices, organizations can ensure that their critical applications remain available and resilient against outages.

    This summary encapsulates the essential points and recommendations provided in the document, emphasizing the importance of redundancy and proper planning in OCI network connectivity.

    OCI Load Balancer and traffic management

    Load Balancer

    • Application Loadbalancer / Network Loadbalancer
    • Network-based load balancer works on TCP/UDP/ICMP
    • App-Based load Balancer works on Application Layer [Http/Https]
    • Load Balancer Public [Comes with Public IP] and Private [With private Ip]
    • Task: service discovery, health check, Algorithm
    • Flexible Shape  or Dynamic Shape
    • Layer 4 or Layer 7 LB
    • You can attach NSG, by default not enabled
    • LB can be attached to only one subnet
    • You can enable WAF at LB
    • Listener  : [Same AWS target group]
      • Weighted round-robin [Round robin with weighted distribution]
      • Ip Hash  [Bound Ip to make a request to the same server]
      • Least request [Redirect Request to the server which has the least number of conenction]
    • Up to 16 Listener, 4-state health checks, updated every 3 minute
    • There can be downtime in change shape as the existing connection will be drained
    • Health Check status
      • OK
      • INVALID_STATUS_CODE
      • TIMEOUT 
      • REGEX_MISMATCH
      • IO_ERROR
      • OFFLINE
      • UNKNOW
    • Route based on Virtual Hostname or path-based routing

    OCI Traffic Management and Health Checks

    • A global Service, generally used in DR/HA to perform Request regional Request Routing

    Traffic Management

    • Policy
      • Load Balancer [weighted based load balancing]
      • Failover
      • Geolocation Steering
      • ASN Steering
      • IP Prefix Steering

    Health check

    • Health Check is available for any public ip available [LB, Compute etc]
    • Check the target from different Vantage points
    • HTTP based health check  or ping type monitors
    • Performance monitoring from response time
    • Failover detection
    • Hybrid Monitoring

    Sources Load balancer

    OCI Compute instance

    Compute

    • 1-to-1 mapping for ASG and Instnace Pool
    • Scaling is done on the basis of
      • Metric based
        • Cpu utilization
        • Memory utilization
      • Schedule based: cron expression
        • Scale pool size
        • Change in instance state[start or stop]
    • In Event of Scale-In, instances are terminated first based on how many instances from the instance pool are in that availability domain and fault domain. Within a placement, the oldest instances are terminated first.

    Instance types

    • BM [Bare metal / physical machine],
    • VM[Virtual Machine]
    • Template type
      • Fixed Shape [BM/VM] : Can not be resized
      • Flexible Shape [VM only] : Can be resized cpu and memory
    • Shape Types
      • Standard Shapes : Designed for general purpose workloads and suitable for a wide range of applications and use cases. Standard shapes provide a balance of cores, memory, and network resources. Standard shapes are available with Intel or AMD processors.
      • Dense I/O Shapes : Designed for large databases, big data workloads, and applications that require high-performance local storage. DenseIO shapes include locally-attached NVMe-based SSDs.
      • GPU Shapes : Designed for hardware-accelerated workloads. GPU shapes include Intel CPUs and NVIDIA graphics processors.
      • HPC Shapes : Designed for high-performance computing workloads that require high frequency processor cores and cluster networking for massively parallel HPC workloads.
      • Optimized shapes
    • Capacity Type
      • On-demand capacity
      • Preemptible capacity
      • Reserved capacity
      • Dedicated capacity
    • You can launch console connections that can be connected from your local machine or cloud itself.
    • Compute agent provides cpu/memory/io/read/write/network/load metric, which is genrally installed in available images
    • Default os can also show OS management and top process
    • Cloud-init script can be setup for executing at provison time
    • Stop and start does not change the IP [epeheraml ip], however, terminating instance will free that.
    • Custom Image from computing will  only include boot volume, region-specific. Maximum size is 300 GB. Instance will shut down for a few minutes while creating images.
    • Custom Images can be exported to OS and can be imported
    • You can move instances in different fault domains but SAME AD
    • Console connection
      • Not booting/need to reset ssh key for the OPC user [default user in oracle linux], edit system configuration
      • Serial console connection / vnc console connection
      • Need private/public key pair
      • Stop / start [can choose boot option and can edit boot file]/ reboot logs will display

    Auto Scaling (ASG)

    • 1-to-1 mapping for ASG and Instnace Pool
    • Scaling is done on the basis of
      • Metric based
        • Cpu utilization
        • Memory utilization
      • Schedule based: cron expression
        • Scale pool size
        • Change in instance state[start or stop]
    • In Event of Scale-In, instances are terminated first based on how many instances from the instance pool are in that availability domain and fault domain. Within a placement, the oldest instances are terminated first.

    OCI IAM

    OCI Identity and Access Management

    1. IAM – enables to control what type of access a group of users have and to which specific
      resources
    2. Each OCI resource has unique OCID
    3. IAM uses traditional identity concepts – Principals, Users, Group, AuthN, AuthZ; New
      capability – Compartments
    4. Principals – IAM entity interact with OCI resources; IAM users and Instance Principals; User
      has no permissions until placed in groups; Group having at least one policy with permission
      to tenancy or compartment
    5. Group – collection of users; same user can be a member of multiple groups; Instance
      Principals – let instances to make API calls against other OCI services
    6. Authentication – Username and Password; API siging key; Auth Tokens (Don’t expire)
    7. Authorization – define specific privileges in policies and associating them with principals;
      policies cannot be attached to user; policies written in human readable format; Default deny
      all;

    IAM Policies

    1. Policy Syntax: Allow to in where
    2. Verb: inspect(list), read(list+metadata), use(read+existing resource), manage(all permission)
    3. Resource Type: Aggregate Resource Type (all-resources, instance-family etc), Individual
      Resource Type(instances, databases etc)
    4. Verbs & Permissions – INSPECT & VOLUME INSPECT; USE & VOLUME_WRITE; MANAGE &
      VOLUME_CREATE -> API Operations
    5. Common Policies: Network Admins, InstanceLaunchers
    6. Advanced Policy Syntax: 2 types of variables added to conditions; request and target; Ex:
      request.operation, targets.group.name

    IAM Compartments

    1. Organize and control access to resources
    2. Compartment Quotas similar to Service Limits but set by Admins using policies; 3 types of
      quota policies (set, unset, zero);
    3. Ex: zero compute quotas /bm/ in tenancy (zeroed out BM instance)
    4. Main Menu -> Governance -> Compartment Explorer -> List all resources in compartment

    Policy Inheritance and Attachment

    1. Compartment inherit policies from parent compartments; policy created must be attached
      to a compartment/tenancy (B:C, A:B:C);
    2. Compartment move with all its contents; cannot have a same name; two compartment with
      same parent cannot have same name;
    3. Policy implications – compartment hierarchy down to the compartment being moved, to a
      shared ancestor of current and target parent; policy attached directly to a compartment
      moved is not automatically updated and is invalid;

    IAM-Tags

    1. Tagging – Free Form Tags (Basic implementation, key/value) Ex: Env:Production,
      Project:Alpha; Defined Tags – more features and control;
      contained in tag Namespaces; Defined Schema, secured with policy; Ex: Namespace =
      Operations, Human Resources etc
    2. Tag Namespace – container for a set of tag keys with tag definitions; key/value pair;
      Namespace.Key = Value; Tag Namespace cannot be deleted but retired; reactivate to use
      again; must be setup in tenancy to start using; variable can be used for volume
    3. Ex: ${iam.principal.name} at ${oci.datetime}; Defined tags work with policies; Ex; use tagnamespaces

    OCI Multifactor authentication.

    Required IAM Policy

    Only the user can enable multifactor authentication (MFA) for their own account. Users can also disable MFA for their own accounts. Members of the Administrators group can disable MFA for other users, but they cannot enable MFA for another user.

    In general, MFA may include any two of the following:

    • Something that you know, like a password.
    • Something that you have, like a device.
    • Something that you are, like your fingerprint.

    The IAM service supports two-factor authentication using a password (first factor) and a device that can generate a time-based one-time password (TOTP) (second factor).

    Data Guard Broker

     Data Guard properties more details:



    $ dgmgrl [-silent | -echo] [username/password[@connect_identifier] [dgmgrl_command]]
    $ dgmgrl  /
    $ dgmgrl sys/pwd
    $ dgmgrl sys/pwd@oltp
    $ dgmgrl sys/test@dgprimary "show database 'prod'"

    $ dgmgrl -logfile observer.log / "stop observer"
    $ dgmgrl -silent sys/test@dgprimary "show configuration verbose"
    $ dgmgrl  / "show configuration verbose"

    =============
    ADD - Adds a standby database to the broker configuration.
    DGMGRL> ADD DATABASE db_name [AS CONNECT IDENTIFIER IS conn_identifier] [MAINTAINED AS {PHYSICAL|LOGICAL}];
    DGMGRL> ADD DATABASE 'testdb' AS CONNECT IDENTIFIER IS testdb MAINTAINED AS PHYSICAL;
    DGMGRL> ADD DATABASE 'logdb' AS CONNECT IDENTIFIER IS logdb MAINTAINED AS LOGICAL;
    DGMGRL> ADD DATABASE 'devdb' AS CONNECT IDENTIFIER IS devdb.foo.com;

    =============
    CONNECT - Connects to an Oracle database instance.
    DGMGRL> CONNECT username/password[@connect_identifier]
    DGMGRL> CONNECT /
    DGMGRL> CONNECT sys;
    DGMGRL> CONNECT sys@test;
    DGMGRL> CONNECT sys/pwd;
    DGMGRL> CONNECT sys/pwd@dwh;
    DGMGRL> CONNECT /@dwh;
    $dgmgrl connect sys

    =============
    CONVERT - Converts a database from one type to another (from Oracle 11g).
    DGMGRL> CONVERT DATABASE database_name TO {SNAPSHOT STANDBY|PHYSICAL STANDBY};
    DGMGRL> CONVERT DATABASE 'devdb' to SNAPSHOT STANDBY;
    DGMGRL> CONVERT DATABASE 'devdb' to PHYSICAL STANDBY;

    =============
    CREATE - Creates a broker configuration.
    DGMGRL> CREATE CONFIGURATION config_name AS PRIMARY DATABASE IS db_name CONNECT IDENTIFIER IS conn_ident;
    DGMGRL> CREATE CONFIGURATION 'dg' AS PRIMARY DATABASE IS 'prod' CONNECT IDENTIFIER IS prod.foo.com;
    DGMGRL> CREATE CONFIGURATION 'dg_test' AS PRIMARY DATABASE IS 'test' CONNECT IDENTIFIER IS test;

    =============
    DISABLE - Disables a configuration, a database, or fast-start failover (FSFO).
    DGMGRL> DISABLE CONFIGURATION;
    DGMGRL> DISABLE CONFIGURATION;



    DGMGRL> DISABLE DATABASE database_name;
    DGMGRL> DISABLE DATABASE 'devdb';



    DGMGRL> DISABLE FAST_START FAILOVER [FORCE | CONDITION condition];
    DGMGRL> DISABLE FAST_START FAILOVER;
    DGMGRL> DISABLE FAST_START FAILOVER FORCE;
    DGMGRL> DISABLE FAST_START FAILOVER CONDITION '1578';

    =============
    EDIT - Edits a configuration, database, or instance.
    DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS {MaxProtection|MaxAvailability|MaxPerformance};
    DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXPROTECTION;
    DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;
    DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXPERFORMANCE;


    DGMGRL> EDIT CONFIGURATION SET PROPERTY property_name = value;
    DGMGRL> EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold = 45;
    DGMGRL> EDIT CONFIGURATION SET PROPERTY FastStartFailoverAutoReinstate = FALSE;
    DGMGRL> EDIT CONFIGURATION SET PROPERTY FastStartFailoverAutoReinstate = TRUE;
    DGMGRL> EDIT CONFIGURATION SET PROPERTY BYSTANDERSFOLLOWROLECHANGE= 'NONE';


    DGMGRL> EDIT DATABASE database_name SET PROPERTY property_name = value;
    DGMGRL> EDIT DATABASE devdb SET PROPERTY 'LogArchiveFormat'='log_%t_%s_%r_%d.arc';
    DGMGRL> EDIT DATABASE prodb SET PROPERTY LogXptMode=SYNC;
    DGMGRL> EDIT DATABASE prodb SET PROPERTY LogXptMode=ASYNC;
    DGMGRL> EDIT DATABASE prodb SET PROPERTY LogXptMode=ARCH;
    DGMGRL> EDIT DATABASE devdb SET PROPERTY LogShipping=OFF;
    DGMGRL> EDIT DATABASE devdb SET PROPERTY LogShipping=ON;
    DGMGRL> EDIT DATABASE prodb SET PROPERTY LogArchiveTrace=8;
    DGMGRL> EDIT DATABASE prodb SET PROPERTY NetTimeout=60;
    DGMGRL> EDIT DATABASE devdb SET PROPERTY 'ReopenSecs'=300;
    DGMGRL> EDIT DATABASE prodb SET PROPERTY ArchiveLagTarget=1200;
    DGMGRL> EDIT DATABASE prodb SET PROPERTY FastStartFailoverTarget='standby_name';
    DGMGRL> EDIT DATABASE devdb SET PROPERTY 'StandbyArchiveLocation'='/oradata/archive/';
    DGMGRL> EDIT DATABASE devdb SET PROPERTY 'DbFileNameConvert' = '/u01/od01/datafile/, /oradisk/od01/datafile/';
    DGMGRL> EDIT DATABASE testdb SET PROPERTY DelayMins='720';
    DGMGRL> EDIT DATABASE prodb SET PROPERTY RedoCompression ='ENABLE'
    DGMGRL> EDIT DATABASE prodb SET PROPERTY RedoCompression ='DISABLE'
    DGMGRL> EDIT DATABASE testdb SET PROPERTY LogArchiveMinSucceedDest =1


    DGMGRL> EDIT DATABASE database_name RENAME TO new database_name;
    DGMGRL> EDIT DATABASE 'devdbb' RENAME TO 'devdb';


    DGMGRL> EDIT DATABASE database_name SET STATE = state [WITH APPLY INSTANCE = instance_name];
    DGMGRL> EDIT DATABASE devdb SET STATE='READ-ONLY';
    DGMGRL> EDIT DATABASE devdb SET STATE='OFFLINE';
    DGMGRL> EDIT DATABASE devdb SET STATE='APPLY-OFF';
    DGMGRL> EDIT DATABASE devdb SET STATE='APPLY-ON';
    DGMGRL> EDIT DATABASE devdb SET STATE='TRANSPORT-OFF';
    DGMGRL> EDIT DATABASE devdb SET STATE='TRANSPORT-ON';
    DGMGRL> EDIT DATABASE prodb SET STATE='LOG-TRANSPORT-OFF';
    DGMGRL> EDIT DATABASE devdb SET STATE='ONLINE' WITH APPLY INSTANCE=devdb2;


    DGMGRL> EDIT INSTANCE instance_name [ON DATABASE database_name] SET AUTO PFILE [={init_file_path|OFF}];
    DGMGRL> EDIT INSTANCE 'devdb1' ON DATABASE 'devdb' SET AUTO PFILE='initdevdb1.ora';

    DGMGRL> EDIT INSTANCE instance_name [ON DATABASE database_name] SET PROPERTY property_name = value;
    DGMGRL> EDIT INSTANCE * ON DATABASE database_name SET PROPERTY property_name = value;
    DGMGRL> EDIT INSTANCE 'proddb' ON DATABASE 'proddb' SET PROPERTY 'StandbyArchiveLocation'='/oradata/arch/';

    =============
    ENABLE - Enables a configuration, a database, or fast-start failover (FSFO).
    DGMGRL> ENABLE CONFIGURATION;
    DGMGRL> ENABLE CONFIGURATION;



    DGMGRL> ENABLE DATABASE database_name;
    DGMGRL> ENABLE DATABASE 'devdb';



    DGMGRL> ENABLE FAST_START FAILOVER [CONDITION condition];
    DGMGRL> ENABLE FAST_START FAILOVER;
    DGMGRL> ENABLE FAST_START FAILOVER CONDITION '1578';
    DGMGRL> ENABLE FAST_START FAILOVER CONDITION "Stuck Archiver";
    DGMGRL> ENABLE FAST_START FAILOVER CONDITION 'Corrupted Controlfile';
    DGMGRL> ENABLE FAST_START FAILOVER CONDITION 'Corrupted Dictionary';
    DGMGRL> ENABLE FAST_START FAILOVER CONDITION 'Inaccessible Logfile';

    =============
    EXIT - Exits the program.
    DGMGRL> EXIT;

    =============
    FAILOVER - Changes a standby database to be the primary database.
    DGMGRL> FAILOVER TO standby_database_name [IMMEDIATE]
    DGMGRL> FAILOVER TO "testdb";
    DGMGRL> FAILOVER TO "snapdb" IMMEDIATE;

    =============
    HELP - Displays description and syntax for a command.
    DGMGRL> HELP [command];
    DGMGRL> HELP REINSTATE
    DGMGRL> HELP EDIT

    =============
    QUIT - Exits the program.
    DGMGRL> QUIT;

    =============
    REINSTATE - Changes a database marked for reinstatement into a viable standby.
    DGMGRL> REINSTATE DATABASE database_name;
    DGMGRL> REINSTATE DATABASE prim1;

    =============
    REM - Comment to be ignored by DGMGRL.
    DGMGRL> REM [comment];

    =============
    REMOVE - Removes a configuration, Oracle database, or instance.
    DGMGRL> REMOVE CONFIGURATION [PRESERVE DESTINATIONS];
    DGMGRL> REMOVE CONFIGURATION;
    DGMGRL> REMOVE CONFIGURATION PRESERVE DESTINATIONS;


    DGMGRL> REMOVE DATABASE database_name [PRESERVE DESTINATIONS];
    DGMGRL> REMOVE DATABASE devdb;
    DGMGRL> REMOVE DATABASE standby PRESERVE DESTINATIONS;



    DGMGRL> REMOVE INSTANCE instance_name [ON DATABASE database_name];
    DGMGRL> REMOVE INSTANCE inst1 ON DATABASE racdb;

    =============
    SHOW - Displays information about a configuration, database, instance or FSFO.
    DGMGRL> SHOW CONFIGURATION [VERBOSE];
    DGMGRL> SHOW CONFIGURATION;
    DGMGRL> SHOW CONFIGURATION VERBOSE;


    DGMGRL> SHOW DATABASE [VERBOSE] db_name [property_name];
    DGMGRL> SHOW DATABASE 'devdb';
    DGMGRL> SHOW DATABASE VERBOSE 'test';
    DGMGRL> SHOW DATABASE 'dwhdb' 'StatusReport';
    DGMGRL> SHOW DATABASE 'proddb' 'LogXptStatus';
    DGMGRL> SHOW DATABASE 'proddb' 'InconsistentProperties';
    DGMGRL> SHOW DATABASE 'proddb' 'InconsistentLogXptProps';
    DGMGRL> SHOW DATABASE 'testdb' 'ArchiveLagTarget';
    DGMGRL> SHOW DATABASE 'testdb' 'LogShipping';
    DGMGRL> SHOW DATABASE 'testdb' 'PreferredApplyInstance';
    DGMGRL> SHOW DATABASE 'proddb' 'StatusReport';
    DGMGRL> SHOW DATABASE 'testdb' 'RecvQEntries';
    DGMGRL> SHOW DATABASE 'proddb' 'SendQEntries';


    DGMGRL> SHOW INSTANCE [VERBOSE] instance_name [property_name] [ON DATABASE db_name];
    DGMGRL> SHOW INSTANCE inst1;
    DGMGRL> SHOW INSTANCE VERBOSE inst3;
    DGMGRL> SHOW INSTANCE testdb 'TopWaitEvents';


    DGMGRL> SHOW FAST_START FAILOVER;
    DGMGRL> SHOW FAST_START FAILOVER;

    From 18c Oracle Database, SHOW ALL command shows the values of DGMGRL command line utility properties.
    DGMGRL> SHOW ALL;
       debug ON
       echo OFF
       time OFF
       observerconfigfile = observer.ora

    =============
    SHUTDOWN - Shuts down a currently running Oracle instance.
    DGMGRL> SHUTDOWN [NORMAL
     | IMMEDIATE | ABORT];
    DGMGRL> SHUTDOWN;
    DGMGRL> SHUTDOWN NORMAL;
    DGMGRL> SHUT IMMEDIATE;
    DGMGRL> SHUT ABORT;

    =============
    SQL - Executes a SQL statement
    DGMGRL> SQL "sql_statement";


    =============
    START - Starts the fast-start failover(FSFO) observer.
    DGMGRL> START OBSERVER [FILE=observer_configuration_file];
    DGMGRL> START OBSERVER;

    =============
    STARTUP - Starts an Oracle database instance.
    DGMGRL> STARTUP [RESTRICT] [FORCE] [PFILE=filespec]
    [NOMOUNT  |  MOUNT | OPEN
     [READ ONLY|READ WRITE]];
    DGMGRL> STARTUP;
    DGMGRL> STARTUP NOMOUNT;
    DGMGRL> STARTUP MOUNT;
    DGMGRL> STARTUP OPEN;

    DGMGRL> STARTUP FORCE;
    DGMGRL> STARTUP FORCE RESTRICT NOMOUNT;
    DGMGRL> STARTUP PFILE=initdwh.ora NOMOUNT;

    =============
    STOP - Stops the fast-start failover(FSFO) observer.
    DGMGRL> STOP OBSERVER;

    =============
    SWITCHOVER - Switches roles between a primary and standby database.
    DGMGRL> SWITCHOVER TO standby_database_name;
    DGMGRL> SWITCHOVER TO "standby";

    =============
    VALIDATE - command to checks whether the database is ready for a role transition or not.

    DGMGRL> VALIDATE DATABASE 'DB_NAME';    -- From Oracle Database 12c


    From Oracle Database 18c,
    DGMGRL> VALIDATE DATABASE standby-database-name SPFILE;

    DGMGRL> VALIDATE NETWORK CONFIGURATION FOR { ALL | member name };
    DGMGRL> VALIDATE NETWORK CONFIGURATION FOR stdby;

    DGMGRL> VALIDATE STATIC CONNECT IDENTIFIER FOR { ALL | database name };
    DGMGRL> VALIDATE STATIC CONNECT IDENTIFIER FOR stdby;



    $BDUMP/drc*.log
    $ORACLE_HOME/rdbms/log/drc*.log

    alter system set dg_broker_start=false;
    alter system set dg_broker_start=false sid='*';
    alter system set dg_broker_start=FALSE SCOPE=spfile SID='*';
    alter system set dg_broker_start=true;
    alter system set dg_broker_start=true sid='*';
    alter system set dg_broker_start=TRUE SCOPE=spfile SID='*';

    alter system set dg_broker_config_file1='/u01/dg_broker_config_files/dr1TESTP.dat' sid='*';
    alter system set dg_broker_config_file2='/u01/dg_broker_config_files/dr2TESTP.dat' sid='*';

    dgmgrl at a glance

    $ dgmgrl  /
    $ dgmgrl sys/pwd
    $ dgmgrl sys/pwd@oltp
    $ dgmgrl sys/test@dgprimary “show database ‘prod'”
    $ dgmgrl -logfile observer.log / “stop observer”
    $ dgmgrl -silent sys/test@dgprimary “show configuration verbose”
    $ dgmgrl  / “show configuration verbose”

    ADD – Adds a standby database to the broker configuration.DGMGRL> ADD DATABASE db_name [AS CONNECT IDENTIFIER IS conn_identifier] [MAINTAINED AS {PHYSICAL|LOGICAL}];DGMGRL> ADD DATABASE ‘testdb’ AS CONNECT IDENTIFIER IS testdb MAINTAINED AS PHYSICAL;
    DGMGRL> ADD DATABASE ‘logdb’ AS CONNECT IDENTIFIER IS logdb MAINTAINED AS LOGICAL;DGMGRL> ADD DATABASE ‘devdb’ AS CONNECT IDENTIFIER IS devdb.foo.com;

    CONNECT – Connects to an Oracle database instance.DGMGRL> CONNECT username/password[@connect_identifier]DGMGRL> CONNECT /
    DGMGRL> CONNECT sys;DGMGRL> CONNECT sys@test;DGMGRL> CONNECT sys/pwd;DGMGRL> CONNECT sys/pwd@dwh;
    DGMGRL> CONNECT /@dwh;
    $dgmgrl connect sys

    CONVERT – Converts a database from one type to another (from Oracle 11g).DGMGRL> CONVERT DATABASE database_name TO {SNAPSHOT STANDBY|PHYSICAL STANDBY};DGMGRL> CONVERT DATABASE ‘devdb’ to SNAPSHOT STANDBY;DGMGRL> CONVERT DATABASE ‘devdb’ to PHYSICAL STANDBY;

    CREATE – Creates a broker configuration.
    DGMGRL> CREATE CONFIGURATION config_name AS PRIMARY DATABASE IS db_name CONNECT IDENTIFIER IS conn_ident;DGMGRL> CREATE CONFIGURATION ‘dg’ AS PRIMARY DATABASE IS ‘prod’ CONNECT IDENTIFIER IS prod.foo.com;DGMGRL> CREATE CONFIGURATION ‘dg_test’ AS PRIMARY DATABASE IS ‘test’ CONNECT IDENTIFIER IS test;

    DISABLE – Disables a configuration, a database, or fast-start failover (FSFO).DGMGRL> DISABLE CONFIGURATION;DGMGRL> DISABLE CONFIGURATION;

    DGMGRL> DISABLE DATABASE database_name;DGMGRL> DISABLE DATABASE ‘devdb’;

    DGMGRL> DISABLE FAST_START FAILOVER [FORCE | CONDITION condition];DGMGRL> DISABLE FAST_START FAILOVER;DGMGRL> DISABLE FAST_START FAILOVER FORCE;
    DGMGRL> DISABLE FAST_START FAILOVER CONDITION ‘1578’;

    EDIT – Edits a configuration, database, or instance.DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS {MaxProtection|MaxAvailability|MaxPerformance};DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXPROTECTION;DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXPERFORMANCE;

    DGMGRL> EDIT CONFIGURATION SET PROPERTY property_name = value;DGMGRL> EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold = 45;
    DGMGRL> EDIT CONFIGURATION SET PROPERTY FastStartFailoverAutoReinstate = FALSE;
    DGMGRL> EDIT CONFIGURATION SET PROPERTY FastStartFailoverAutoReinstate = TRUE;
    DGMGRL> EDIT CONFIGURATION SET PROPERTY BYSTANDERSFOLLOWROLECHANGE= ‘NONE’;
    DGMGRL> EDIT DATABASE database_name SET PROPERTY property_name = value;
    DGMGRL> EDIT DATABASE devdb SET PROPERTY ‘LogArchiveFormat’=’log_%t_%s_%r_%d.arc’;
    DGMGRL> EDIT DATABASE prodb SET PROPERTY LogXptMode=SYNC;DGMGRL> EDIT DATABASE prodb SET PROPERTY LogXptMode=ASYNC;
    DGMGRL> EDIT DATABASE prodb SET PROPERTY LogXptMode=ARCH;
    DGMGRL> EDIT DATABASE devdb SET PROPERTY LogShipping=OFF;
    DGMGRL> EDIT DATABASE devdb SET PROPERTY LogShipping=ON;
    DGMGRL> EDIT DATABASE prodb SET PROPERTY LogArchiveTrace=8;
    DGMGRL> EDIT DATABASE prodb SET PROPERTY NetTimeout=60;
    DGMGRL> EDIT DATABASE devdb SET PROPERTY ‘ReopenSecs’=300;
    DGMGRL> EDIT DATABASE prodb SET PROPERTY ArchiveLagTarget=1200;
    DGMGRL> EDIT DATABASE prodb SET PROPERTY FastStartFailoverTarget=’standby_name’;
    DGMGRL> EDIT DATABASE devdb SET PROPERTY ‘StandbyArchiveLocation’=’/oradata/archive/’;
    DGMGRL> EDIT DATABASE devdb SET PROPERTY ‘DbFileNameConvert’ = ‘/u01/od01/datafile/, /oradisk/od01/datafile/’;DGMGRL> EDIT DATABASE testdb SET PROPERTY DelayMins=’720′;
    DGMGRL> EDIT DATABASE prodb SET PROPERTY RedoCompression =’ENABLE’
    DGMGRL> EDIT DATABASE prodb SET PROPERTY RedoCompression =’DISABLE’
    DGMGRL> EDIT DATABASE testdb SET PROPERTY LogArchiveMinSucceedDest =1

    DGMGRL> EDIT DATABASE database_name RENAME TO new database_name;
    DGMGRL> EDIT DATABASE ‘devdbb’ RENAME TO ‘devdb’;

    DGMGRL> EDIT DATABASE database_name SET STATE = state [WITH APPLY INSTANCE = instance_name];DGMGRL> EDIT DATABASE devdb SET STATE=’READ-ONLY’;DGMGRL> EDIT DATABASE devdb SET STATE=’OFFLINE’;DGMGRL> EDIT DATABASE devdb SET STATE=’APPLY-OFF’;
    DGMGRL> EDIT DATABASE devdb SET STATE=’APPLY-ON’;DGMGRL> EDIT DATABASE devdb SET STATE=’TRANSPORT-OFF’;DGMGRL> EDIT DATABASE devdb SET STATE=’TRANSPORT-ON’;DGMGRL> EDIT DATABASE prodb SET STATE=’LOG-TRANSPORT-OFF’;
    DGMGRL> EDIT DATABASE devdb SET STATE=’ONLINE’ WITH APPLY INSTANCE=devdb2;

    DGMGRL> EDIT INSTANCE instance_name [ON DATABASE database_name] SET AUTO PFILE [={init_file_path|OFF}];DGMGRL> EDIT INSTANCE ‘devdb1’ ON DATABASE ‘devdb’ SET AUTO PFILE=’initdevdb1.ora’;

    DGMGRL> EDIT INSTANCE instance_name [ON DATABASE database_name] SET PROPERTY property_name = value;DGMGRL> EDIT INSTANCE * ON DATABASE database_name SET PROPERTY property_name = value;DGMGRL> EDIT INSTANCE ‘proddb’ ON DATABASE ‘proddb’ SET PROPERTY ‘StandbyArchiveLocation’=’/oradata/arch/’;

    ENABLE – Enables a configuration, a database, or fast-start failover (FSFO).
    DGMGRL> ENABLE CONFIGURATION;DGMGRL> ENABLE CONFIGURATION;

    DGMGRL> ENABLE DATABASE database_name;DGMGRL> ENABLE DATABASE ‘devdb’;

    DGMGRL> ENABLE FAST_START FAILOVER [CONDITION condition];DGMGRL> ENABLE FAST_START FAILOVER;DGMGRL> ENABLE FAST_START FAILOVER CONDITION ‘1578’;
    DGMGRL> ENABLE FAST_START FAILOVER CONDITION “Stuck Archiver”;
    DGMGRL> ENABLE FAST_START FAILOVER CONDITION ‘Corrupted Controlfile’;
    DGMGRL> ENABLE FAST_START FAILOVER CONDITION ‘Corrupted Dictionary’;
    DGMGRL> ENABLE FAST_START FAILOVER CONDITION ‘Inaccessible Logfile’;

    EXIT – Exits the program.DGMGRL> EXIT;

    FAILOVER – Changes a standby database to be the primary database.DGMGRL> FAILOVER TO standby_database_name [IMMEDIATE]DGMGRL> FAILOVER TO “testdb”;
    DGMGRL> FAILOVER TO “snapdb” IMMEDIATE;

    HELP – Displays description and syntax for a command.DGMGRL> HELP [command];DGMGRL> HELP REINSTATE
    DGMGRL> HELP EDIT

    QUIT – Exits the program.DGMGRL> QUIT;

    REINSTATE – Changes a database marked for reinstatement into a viable standby.DGMGRL> REINSTATE DATABASE database_name;DGMGRL> REINSTATE DATABASE prim1;

    REM – Comment to be ignored by DGMGRL.DGMGRL> REM [comment];

    REMOVE – Removes a configuration, Oracle database, or instance.DGMGRL> REMOVE CONFIGURATION [PRESERVE DESTINATIONS];DGMGRL> REMOVE CONFIGURATION;
    DGMGRL> REMOVE CONFIGURATION PRESERVE DESTINATIONS;

    DGMGRL> REMOVE DATABASE database_name [PRESERVE DESTINATIONS];DGMGRL> REMOVE DATABASE devdb;
    DGMGRL> REMOVE DATABASE standby PRESERVE DESTINATIONS;

    DGMGRL> REMOVE INSTANCE instance_name [ON DATABASE database_name];DGMGRL> REMOVE INSTANCE inst1 ON DATABASE racdb;

    SHOW – Displays information about a configuration, database, instance or FSFO.DGMGRL> SHOW CONFIGURATION [VERBOSE];
    DGMGRL> SHOW CONFIGURATION;DGMGRL> SHOW CONFIGURATION VERBOSE;

    DGMGRL> SHOW DATABASE [VERBOSE] db_name [property_name];
    DGMGRL> SHOW DATABASE ‘devdb’;DGMGRL> SHOW DATABASE VERBOSE ‘test’;
    DGMGRL> SHOW DATABASE ‘dwhdb’ ‘StatusReport’;DGMGRL> SHOW DATABASE ‘proddb’ ‘LogXptStatus’;DGMGRL> SHOW DATABASE ‘proddb’ ‘InconsistentProperties’;
    DGMGRL> SHOW DATABASE ‘proddb’ ‘InconsistentLogXptProps’;
    DGMGRL> SHOW DATABASE ‘testdb’ ‘ArchiveLagTarget’;
    DGMGRL> SHOW DATABASE ‘testdb’ ‘LogShipping’;
    DGMGRL> SHOW DATABASE ‘testdb’ ‘PreferredApplyInstance’;
    DGMGRL> SHOW DATABASE ‘proddb’ ‘StatusReport’;
    DGMGRL> SHOW DATABASE ‘testdb’ ‘RecvQEntries’;
    DGMGRL> SHOW DATABASE ‘proddb’ ‘SendQEntries’;

    DGMGRL> SHOW INSTANCE [VERBOSE] instance_name [property_name] [ON DATABASE db_name];
    DGMGRL> SHOW INSTANCE inst1;DGMGRL> SHOW INSTANCE VERBOSE inst3;
    DGMGRL> SHOW INSTANCE testdb ‘TopWaitEvents’;

    DGMGRL> SHOW FAST_START FAILOVER;
    DGMGRL> SHOW FAST_START FAILOVER;

    From 18c Oracle Database, SHOW ALL command shows the values of DGMGRL command line utility properties.
    DGMGRL> SHOW ALL;
       debug ON
       echo OFF
       time OFF
       observerconfigfile = observer.ora

    SHUTDOWN – Shuts down a currently running Oracle instance.DGMGRL> SHUTDOWN [NORMAL | IMMEDIATE | ABORT];DGMGRL> SHUTDOWN;
    DGMGRL> SHUTDOWN NORMAL;
    DGMGRL> SHUT IMMEDIATE;
    DGMGRL> SHUT ABORT;

    SQL – Executes a SQL statement
    DGMGRL> SQL “sql_statement”;

    START – Starts the fast-start failover(FSFO) observer.DGMGRL> START OBSERVER [FILE=observer_configuration_file];DGMGRL> START OBSERVER;

    STARTUP – Starts an Oracle database instance.DGMGRL> STARTUP [RESTRICT] [FORCE] [PFILE=filespec]
    [NOMOUNT  |  MOUNT | OPEN [READ ONLY|READ WRITE]];DGMGRL> STARTUP;
    DGMGRL> STARTUP NOMOUNT;
    DGMGRL> STARTUP MOUNT;
    DGMGRL> STARTUP OPEN;
    DGMGRL> STARTUP FORCE;
    DGMGRL> STARTUP FORCE RESTRICT NOMOUNT;
    DGMGRL> STARTUP PFILE=initdwh.ora NOMOUNT;

    STOP – Stops the fast-start failover(FSFO) observer.DGMGRL> STOP OBSERVER;

    SWITCHOVER – Switches roles between a primary and standby database.DGMGRL> SWITCHOVER TO standby_database_name;DGMGRL> SWITCHOVER TO “standby”;


    VALIDATE – command to checks whether the database is ready for a role transition or not.

    DGMGRL> VALIDATE DATABASE …;    — From Oracle Database 12c

    From Oracle Database 18c,
    DGMGRL> VALIDATE DATABASE standby-database-name SPFILE;

    DGMGRL> VALIDATE NETWORK CONFIGURATION FOR { ALL | member name };
    DGMGRL> VALIDATE NETWORK CONFIGURATION FOR stdby;

    DGMGRL> VALIDATE STATIC CONNECT IDENTIFIER FOR { ALL | database name };DGMGRL> VALIDATE STATIC CONNECT IDENTIFIER FOR stdby;

    $BDUMP/drc*.log
    $ORACLE_HOME/rdbms/log/drc*.log

    alter system set dg_broker_start=false;
    alter system set dg_broker_start=false sid=’*’;
    alter system set dg_broker_start=FALSE SCOPE=spfile SID=’*’;
    alter system set dg_broker_start=true;
    alter system set dg_broker_start=true sid=’*’;
    alter system set dg_broker_start=TRUE SCOPE=spfile SID=’*’;

    alter system set dg_broker_config_file1=’/u01/dg_broker_config_files/dr1TESTP.dat’ sid=’*’;
    alter system set dg_broker_config_file2=’/u01/dg_broker_config_files/dr2TESTP.dat’ sid=’*’;