Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Sending SQLPLUS output in HTML format Oracle
  • Unix split command to split files Linux/Unix
  • How does one overcome the Unix 2 Gig file limit? Linux/Unix
  • OEM-Commnds Oracle
  • ORA-4031 issue and solution on 09-MAY-2008 Oracle
  • Identical Dblink Issue… Oracle
  • Renaming Global Name GLOBAL_NAME Oracle
  • Vivek’s egrep commands to trace problem. (on linux x86-64) Linux/Unix
  • Histogram information Oracle
  • Library cahe Latches and internal explaination Oracle
  • SQL_PLAN.sql for checking real execution plan Oracle
  • Check Oracle installed products using one command Oracle
  • Pending Transaction Neighbors Script Oracle
  • Committing distributed transaction using commit force Oracle
  • AWR settings- MMON is not taking snapshot. Oracle

Reading config file from other folder inside class

Posted on 24-Sep-2024 By Admin No Comments on Reading config file from other folder inside class

Directory Structure: root-folder/ config-folder/ json-file.config class-folder/ classfile.py tests/ pytest-file1.py json-file.config: { “setting1”: “value1”, “setting2”: “value2” } Now, Here I need to access json-file.config in my class file. I do not want to use dbutil, how can i access it and read it from json-file.config in my class file?? classfile.py import os import json class myclass:…

Read More “Reading config file from other folder inside class” »

Python/PySpark

Python class import from different folders

Posted on 22-Sep-202422-Sep-2024 By Admin No Comments on Python class import from different folders

I have following directory structure.  root-folder – config-folder  json-file.config – class-folder  classfile.py – tests pytest-file1.py Now, I need to use a class named myclass from classfile.py in my test/pytestfile1.py. How can I import that class in my pytest file?? To import the myclass from classfile.py into your pytest-file1.py, you can use a relative import assuming…

Read More “Python class import from different folders” »

Python/PySpark

Transfer SQL Profiles from One database to other database.

Posted on 05-Sep-2024 By Admin No Comments on Transfer SQL Profiles from One database to other database.

In this guide, I’ll walk you through moving SQL profiles using a staging table. SQL profiles help databases optimize query execution plans. Step#1 Create the Staging Table First, create a staging table to hold SQL profiles that need to be transferred. SQL> exec DBMS_SQLTUNE.CREATE_STGTAB_SQLPROF(table_name => ‘SQL_STG_TAB’, schema_name => ‘SYS’); This will create a table SQL_STG_TAB…

Read More “Transfer SQL Profiles from One database to other database.” »

Oracle, shell, SQL scripts

Load testing on Oracle 19C RAC with HammerDB

Posted on 18-Jan-202418-Jan-2024 By Admin No Comments on Load testing on Oracle 19C RAC with HammerDB

When dealing with Oracle 19c Real Application Clusters (RAC), the process of capturing a workload from a source Oracle 19c RAC database and replaying it on a target Oracle 19c RAC database using HammerDB involves some additional considerations. Below are the revised steps: Capture and Replay Workload from Source to Target Oracle 19c RAC Download…

Read More “Load testing on Oracle 19C RAC with HammerDB” »

Oracle

Add new columns in dataframe

Posted on 30-Sep-202301-Oct-2023 By Admin No Comments on Add new columns in dataframe

from pyspark.sql.functions import col, lit# File location and typefile_location = “/FileStore/tables/sales_data_part1.csv”file_type = “csv”# CSV optionsinfer_schema = “false”first_row_is_header = “true”delimiter = “,”# The applied options are for CSV files. For other file types, these will # be ignored.df = spark.read.format(file_type) .option(“inferSchema”, infer_schema) .option(“header”, first_row_is_header) .option(“sep”, delimiter) .load(file_location)display(df)# Adding new column with and with default values. #…

Read More “Add new columns in dataframe” »

Python/PySpark

Getting started with notebook

Posted on 30-Sep-202330-Sep-2023 By Admin No Comments on Getting started with notebook

# Databricks notebook source   %sqlcreate database if not exists abcdb   %sqluse abcdb   %sqlcreate table student (id int , name string)   %sqlinsert into studentselect 1 as id, ‘user1’ as name   %sqlselect * from student   spark.sql(“create database if not exists xyzdb”)spark.sql(“use xyzdb”)   # Use three double quotes (“””) if SQL…

Read More “Getting started with notebook” »

Python/PySpark

Read CSV file using PySpark

Posted on 30-Sep-202330-Sep-2023 By Admin No Comments on Read CSV file using PySpark

from pyspark.sql.functions import col   # File location and type file_location = “/FileStore/tables/sales_data_part1.csv” file_type = “csv” # CSV options infer_schema = “false” first_row_is_header = “true” delimiter = “,” # The applied options are for CSV files. For other file types, these will be ignored. df = spark.read.format(file_type)   .option(“inferSchema”, infer_schema)   .option(“header”, first_row_is_header)   .option(“sep”,…

Read More “Read CSV file using PySpark” »

Python/PySpark

Read CSV File using Python

Posted on 30-Sep-202330-Sep-2023 By Admin No Comments on Read CSV File using Python

# Databricks notebook source import pandas as pd # preapre dataframe df_h=pd.read_csv(“https://people.sc.fsu.edu/~jburkardt/data/csv/zillow.csv”) #Print dataframe df_h #define custom columns columns = [“Srno”, “SQFT”, “BR”, “Baths”, “Zipcode”, “YearBuilt”, “ListPrice”] df_h=pd.read_csv(“https://people.sc.fsu.edu/~jburkardt/data/csv/zillow.csv”, header=None, names=columns) #Print dataframe df_h # show top 10 rows df_h.head(10) # show last 10 rows df_h.tail(10) #Print dataframe df_h #Drop non-needed columns, column names are case…

Read More “Read CSV File using Python” »

Python/PySpark

Creating never expiring DB user accounts in Oracle

Posted on 14-Sep-202314-Sep-2023 By Admin No Comments on Creating never expiring DB user accounts in Oracle

DB Users are required to reset the password periodically for better security. For some service accounts,  we need to make sure the password does not expire and does not impact the application. For this purpose, we need to update that user’s Profile. Each Profile has multiple security settings that controls Password_life_time, password_reuse_time, password_reuse_max  settings. These…

Read More “Creating never expiring DB user accounts in Oracle” »

Oracle, SQL scripts

Convert multiple rows to single column

Posted on 13-Sep-202313-Sep-2023 By Admin No Comments on Convert multiple rows to single column

Converting rows to single column: create table emp ( empno number, empname varchar2(100), deptno number); insert into emp values( 1, ’emp1′, 10); insert into emp values( 2, ’emp2′, 20); insert into emp values( 3, ’emp3′, 30); insert into emp values( 4, ’emp4′, 10); insert into emp values( 5, ‘paresh’, 30); insert into emp values( 6,…

Read More “Convert multiple rows to single column” »

Oracle, SQL scripts

Posts pagination

Previous 1 2 3 … 56 Next

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (392)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • load SPM baseline from cursor cache05-Jun-2025
  • Drop all SPM baselines for SQL handle05-Jun-2025
  • Load SPM baseline from AWR05-Jun-2025
  • Drop specific SQL plan baseline – spm05-Jun-2025
  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • reset Sequence Oracle
  • restarting network in linux Linux/Unix
  • Python class import from different folders Python/PySpark
  • To check whether standby is recovering properly or not?? Oracle
  • sql_plan9i.sql Oracle
  • alter database backup controlfile to trace Oracle
  • Jai Shree Ram PHP/MYSQL/Wordpress
  • ORA-01220 Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme