Minimalistic Oracle

Minimalistic Oracle contains a collection of practical examples from my encounters with Oracle technologies. When relevant, I also write about other technologies, like Linux or PostgreSQL. Many of the posts starts with "how to" since they derive directly from my own personal experience. My goal is to provide simple examples, so that they can be easily adapted to other situations.

Monday, September 29, 2025

How to pass parameters to a psql script

›
To use variables in your sql script, use the -v option to set variables on the command line. Consider this example: export PGPASSWORD=mys...
Thursday, September 25, 2025

Find out if a constraint in PostgreSQL is defined as deferrable

›
Logged into the relevant database, find out which FK are deferrable: SELECT conname, condeferrable, condeferred FROM pg_constraint WHERE co...
Wednesday, September 24, 2025

Terminate PostgresSQL sessions

›
-- Terminate all connections from user "sales" SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE usename = 'sales...

Check active sessions in PostgreSQL

›
The closest equivalent to this oracle query: SELECT USERNAME, COUNT(*) FROM v$session WHERE type 'BACKGROUND' GROUP BY username...
Thursday, September 18, 2025

Convert all contents in a file to lower case using vim

›
Open your file in vi vi myfile Press the escape key to enter interactive mode, then type :%s/.*/\L&/ Press escape, then save + exit ...
1 comment:
Tuesday, September 9, 2025

How to set echo in a SQL script executed in psql

›
Use one of two options 1. in the sql file, add the following directive \set ECHO queries 2. execute the script using the -e flag psql -...
Monday, September 8, 2025

Syntax for drop/recreate of constraints in PostgreSQL

›
1. Find the constraints belonging to a specific table: SELECT conname FROM pg_constraint WHERE conrelid = 'mytable'::regclass; ...
‹
›
Home
View web version

About Me

My photo
Name: Vegard Kåsa
My career as an Oracle DBA startet in 2001, when I acceptet a request to take on the responsibility as my current employer's DBA. From that point and onwards, managing Oracle databases has kept me busy and engaged. I enjoy my work, and particulary appreciate the constant learning and devlopment that comes with the job. From 2014, I am self-employed through my company Oric Consulting AS (Norway), and from 2024 Oric Consulting AB (Sweden) I currently live in Göteborg, Sweden, with my family.
View my complete profile
Powered by Blogger.