Monthly Archives: February 2025

Preventing Duplicate Tabs in Oracle APEX Using JavaScript

Introduction: – In modern web applications, users often open multiple tabs of the same page, which can lead to session conflicts, unexpected behavior, or data inconsistencies. To ensure a smooth…

Read More

Streams in Snowflake

In snowflake, Streams are a powerful feature designed for tracking changes (like inserts, updates, and deletes) to a table. They allow you to capture data changes in realtime and use this data for various purposes, such as incremental loading, change data capture (CDC), or auditing. Here’s an overview of Streams in Snowflake and how to use them: What is a Stream in Snowflake? A Stream in Snowflake is an object that tracks changes (DML operations like INSERT, UPDATE, and DELETE) made to a table. It captures these changes in a special table that is internally managed by Snowflake, and these changes can then be queried. A Stream has two important components: Change tracking:It captures DML changes, including the type of change (insert, update, delete). Metadata:Information such as the row’s previous state for updates, and how many rows have changed since the last time the stream was queried. How to Create a Stream You can create a stream on a table using the CREATE STREAM command. Basic Syntax: CREATE OR REPLACE STREAM <stream_name> ON TABLE <table_name> [ SHOW_INITIAL_ROWS = TRUE | FALSE ]; SHOW_INITIAL_ROWS: If set to TRUE, it will include existing rows in the stream at…

Read More

Step-by-Step Guide for SQL Server Always on Failover

Step-by-Step Guide for SQL Server Always on Failover Introduction SQL Server Always On Availability Groups provide high availability and disaster recovery capabilities for SQL Server databases. Synchronous commit mode ensures that data is committed to both the primary and secondary replicas, guaranteeing data integrity during failover. This guide provides detailed steps for performing both manual and automatic failovers in an Always On Availability Group. Part 1: Preliminary Checks and Preparations Before initiating any failover, whether manual or automatic, ensure the environment is healthy and ready for the transition. Step 1: Prerequisites Check – Synchronization State: Confirm that all secondary replicas are in the SYNCHRONIZED state. – Query to Check Synchronization State: SELECT ag.name AS [AvailabilityGroupName], ar.replica_server_name AS [ReplicaServerName], drs.synchronization_state_desc AS [SynchronizationState] FROM sys.dm_hadr_availability_replica_states AS drs JOIN sys.availability_replicas AS ar ON drs.replica_id = ar.replica_id JOIN sys.availability_groups AS ag ON ar.group_id = ag.group_id WHERE drs.synchronization_state_desc = ‘SYNCHRONIZED’;   – Action: Ensure that all replicas are in the SYNCHRONIZED state to avoid any data loss during failover. – Verify Health of Availability Group: – Query to Check Availability Group Health: SELECT ag.name AS [AvailabilityGroupName], ags.primary_replica AS [PrimaryReplica], ags.operational_state_desc AS [OperationalState] FROM sys.dm_hadr_availability_group_states AS ags JOIN sys.availability_groups AS ag ON ags.group_id = ag.group_id;   – Action: Ensure that the OperationalState indicates a healthy state for a successful failover. Step 2: Validate Readiness for Failover…

Read More

Essential Guide for Regular MS SQL Server Patching

Essential Guide for Regular MS SQL Server Patching Introduction: In SQL Server management, keeping up with service packs and cumulative updates is not just a recommendation, it’s a necessity. Understanding these updates and their importance can make a significant difference in the performance, security, and reliability of your SQL Server environment. Table of Contents Pre-Check and Prerequisites before Patching. SQL Server 2022 Most recentPatch. Steps to Install the patch update. Post-Installation verification. Successfully upgraded Patching. Server restart Hack. Conclusion. Pre-Check and Prerequisites Before Patching: Before diving into the patching process, it’s essential to prepare thoroughly to avoid any disruption. ü Take necessary backups of application databases. ü Check Disk Space and System Requirements. ü Inform Stakeholders About Downtime ü Disable Scheduled Jobs: Temporarily disable any scheduled jobs that could interfere with the patching process. ü Apply the Patch in a Test Environment, before updating your live server, SQL Server 2022 Most recent Patch : The latest cumulative update for SQL Server 2022 is CU14 (KB5038325), released in July 2024. This update includes all fixes and improvements from previous updates and is essential for maintaining the security and performance of your SQL Server installations. Some notable features and improvements in CU14 include: ü General bug fixes and performance enhancements. ü Security updates ensure the system remains secure and reliable. ü Improvements in manageability and reliability to enhance overall system performance. Steps to Install the patch update: ü Run the Installer: Double-click the setup file to start the installer then patch installer will pop up. ü Accept License Terms: Review and accept the license terms to proceed with the installation. ü Select Features to Update:…

Read More

Snowpipe (a continuous data ingestion pipeline) in Snowflake

To create a new Snowpipe (a continuous data ingestion pipeline) in Snowflake, follow these steps: Prerequisites Storage Integration: Set up a cloud storage integration (AWS S3, Azure Blob, GCP) to securely connect Snowflake to your cloud storage. Stage: Create an external stage pointing to your cloud storage (if not already created). Target Table: Ensure the destination table exists in Snowflake. Create a Stage (if needed) Define a stage pointing to your cloud storage location. Example for AWS S3: CREATE OR REPLACE STAGE my_s3_stage URL = ‘s3://your-bucket/path/’ STORAGE_INTEGRATION = my_storage_integration FILE_FORMAT = my_file_format; — (e.g., CSV, JSON) Create a Pipe A pipe uses the…

Read More

Delete the concurrent programs

Delete the concurrent programs    Prerequisites: If the concurrent program is not in use, the program details need to be entered in the lookup and then this concurrent program needs…

Read More

Tomcat upgradation 8.x to 9.x

Introduction:  Apache Tomcat Upgrading from Tomcat 8 to Tomcat 9 is a critical step for taking advantage of the latest features, improved performance, and enhanced security. This blog provides a structured approach for a successful upgrade. Why we need to do:  Tomcat 9 introduces support for Servlet 4.0, HTTP/2, and other modern web technologies. Many applications require these features to maintain compatibility and performance. Moreover, Tomcat 8 has reached its end-of-life phase, leaving systems exposed to unpatched vulnerabilities. Challenges and Issues Faced During Upgradation: Configuration Incompatibilities: Configuration files such as server.xml, web.xml, and context.xml may require adjustments to align with Tomcat 9 standards. Application Dependencies: Applications running on Tomcat 8 may rely on deprecated libraries or APIs that are removed in Tomcat 9. Custom Scripts and Integrations: Custom startup scripts, monitoring tools, or integrations might need modifications for compatibility. Steps to Upgrade Tomcat from Version 8 to Version 9: Backup Your Current Setup: l Backup all configuration files: server.xml, web.xml, context.xml. l Backup application WAR files and logs. l Snapshot the current environment to ensure rollback options. Download and Install Tomcat 9: l Download the Tomcat 9 binary from the official Apache Tomcat website. l Extract the archive to a new directory (do not overwrite the existing Tomcat 8 directory). Migrate Configuration Files: l Compare the server.xml, web.xml, and context.xml from Tomcat 8 with the default Tomcat 9 configurations. l Update configurations to align with Tomcat 9 schema. Remove any deprecated elements. Migrate Applications: l Deploy your application WAR files to the webapps directory in the Tomcat 9 installation. l Test applications for compatibility, focusing on deprecated APIs and libraries. Update Custom Scripts: l Modify any startup scripts or custom integrations to reference the new Tomcat 9 directories and binaries. Test the Upgrade: l Start Tomcat 9 using the startup.sh or startup.bat script. l Monitor logs in the logs directory for errors. l Test all deployed applications to ensure they function as expected. Rollback Plan: l If issues are encountered, stop Tomcat 9 and revert to the backup of Tomcat 8.…

Read More

Weblogic .out files are not rotating issue.

Issue:  In WebLogic Server, the .out log files (such as nohup.out or server.out) are not rotating properly, causing them to grow significantly in size—sometimes reaching several GBs. This can lead to disk space exhaustion and make log analysis difficult. Cause of the issue: The primary reasons for .out files not rotating are: WebLogic Logging Configuration – The .out file is typically not managed by WebLogic’s built-in log rotation settings. nohup or Redirected Output – If the server is started using nohup ./startWebLogic.sh &, the output is redirected to nohup.out, which does not rotate automatically. Log Rotation Not Configured – The absence of an external log rotation mechanism (logrotate) can cause .out files to grow indefinitely. Long Running Process – WebLogic keeps writing to the same .out file as long as the process is running. How do we solve:  Solution 1: Enable WebLogic’s Built-in Log Rotation If .out logs are managed via WebLogic settings, follow these steps: Login to WebLogic Admin Console Navigate to Servers → Select the target Managed Server. Go to Logging Settings Click on the Logging tab → Click on the General sub-tab. Configure Rotation Settings Rotate Log Files → Enabled Rotation Type → Set to either: By Size (100MB or as needed). By Time (24 Hours). Maximum Number of Retained Files → Set a limit (e.g., 10). Save and Restart WebLogic Server Apply changes and restart the WebLogic server for them to take effect. Solution 2: Redirect Standard Output to a Rotating Log Modify the WebLogic startup script to redirect logs using cronolog: Edit startWebLogic.sh and Modify the nohup Command: ### nohup ./startWebLogic.sh > /path/to/logs/weblogic_$(date +%Y-%m-%d).log 2>&1 &…

Read More

Deterministic Functions in Oracle 

Deterministic Functions in Oracle    Overview A deterministic function in Oracle is a function that always returns the same result for the same input values and has no side effects.…

Read More

Read permission on secondary replica in always-on AG

How to give read permission on secondary replica in always-on AG    Purpose of Log shipping:     Always On availability groups feature is a high-availability and disaster-recovery solution that provides an…

Read More