Postgres For Oracle Dbas PDF
Postgres For Oracle Dbas PDF
Oracle database logo should be there... but as of this page it can't be:
...Remember that you are generally not able to use Oracle logos unless
you are specifically licensed or authorized to use them. ...
Agenda
The world's most advanced
open source database.
● Mind Migration
● Some terminology
● “Architecture”
● Security
● Backup and Recovery
● High Availability / Disaster recovery
● Other unordered stuff to consider
Mind Migration
The world's most advanced
open source database.
● Architecture/concepts ● Logical
– Cluster Yes, a cluster can simply mean a grouping of
related things, but context is everything.
– Role
Shaun M. Thomas
– Instance – User
– Database – Schema
– Tablespace – Tuple Wiki: A tuple is a finite ordered list of elements
PostgreSQL instance
Running postgres process Oracle instance Oracle instance
PGDATA ORACLE_SID ORACLE_SID
/var/lib/pgsql/9.4/data DWH INWEB
Database
MYDB
UNDO TS
●
Postgres similar to Oracle might create archive of online logs for PITR
and other purposes
– Instead of “Oracle Archiver” server processes, Postgres used to call any external
command responsible for copying inactive online log to some other destination
WAL files
The world's most advanced
open source database.
● Archive_mode
– off, on, always (archive again on streaming replica)
● wal_level
– minimal
● Used for crash recovery only ~ Oracle noarchivelog
– Archive
● Used for streaming replication ~ Oracle DataGuard
– hot_standby
● Used for streaming replication with read only access to
replica ~ Oracle Active DataGuard
Memory
The world's most advanced
open source database.
Instance
Oracle structure:
SGA
Shared pool
Parameters relation…. Data buffer Redo log Library Cache
cache buffer
Oracle Postgres Data Dictionary Cache
db_cache_size shared_buffers
SMON DBW0 PMON CKPT LGWR ostatní
sort_area_size work_mem,
(pga_aggregate_target) temp_buffers
log_buffer_size wal_buffers
maintetance_work_mem SHARED MEMORY
effective_cache_size ● shared buffers
Per process MEMORY ● wal buffers
Postgres structure: ● CLOG buffers
● Work mem ● Locks space
● Maintenanace work mem
Nice description can be ● Other buffers
● Temp buffer
found at link: ● Catalog cache
PostgreSQL 9.0 Architecture ● Optimizer/executor
Extent
Operating
Oracle block
system block
17.2.2016 PostgreSQL for Oracle DBAs 18
PostgreSQL
pg_default → pg_global →
Tablespaces PGDATA/base PGDATA/global
pg_tblspc/
Database
system block
PostgreSQL
Database II datafile
Tablespace_A
Database III
DB cluster
Architecture - connections
The world's most advanced
open source database.
● Oracle ● PostgreSQL
– Master process postgres listens for
– Process named listener is new connections
responsible to handle new ● pg_hba.conf (user/database/network
connections restrictions)
● listener.ora (network ● postgresql.conf (TCP port, kerberos,
restrictions, TCP port) RDBMS cofiguration...)
● sqlnet.ora (protocol
– Dedicated server only
configuration, kerberos...) ● Shared memory and semaphores are
used for inter process synchronization
– Dedicated server processes – Connection pooling by other
per client products
– Multi-threaded server ● PgBouncer
● pgpool-II
● Always used on Windows
Architecture notes
The world's most advanced
open source database.
● Oracle ● PostgreSQL
– Decided that RDBMS – Relies on (believes to)
is right and only place OS file cache
to manage database management
buffers – Do not re-implement
– Promotes its ASM to features already
implemented in OS,
have a direct control
thus it use file system to
on file management store its data files (no
(ASM is kind of LVM RAW device support)
dedicated to Oracle)
Security observations I
The world's most advanced
open source database.
●
Oracle has users and roles
– Users and Roles are defined on DB level (not applies for PDB)
– Users and Roles are different entities
●
Postgres has roles only
– Some roles might be granted “with login” permission
●
Oracle schema consist from a single user objects (schema =
user)
– Schema is not an object, so it can't be granted
●
Postgres schema is a grantable name-space object
– Ownership and usage on schema might be granted to roles
– Objects owned by different roles (users) might reside within a single
schema
– Public schema might (and should) be dropped
Security observations
The world's most advanced
open source database.
SW installation:
/oracle/product/12.1.0.2/db_1
OS access control to files
user1
RoleOne
X TableA
Does't work
TableB
Security observations II
The world's most advanced
open source database.
● Oracle distinguish
– System privileges (create table..., select any ... )
– Object privileges (grant select on … )
● Postgres does not have such strong difference
– Login permission is cluster wide kind of “system”
privilege
– Mostly all privileges are related to some objects
including database object itself
● Grant connect on database myDB
● Grant usage on ...
● Grant create on ...
17.2.2016 PostgreSQL for Oracle DBAs 26
PostgreSQL
Security observations IV
The world's most advanced
open source database.
Security observations V
The world's most advanced
open source database.
Security observations VI
The world's most advanced
open source database.
Security features...
The world's most advanced
open source database.
● pgBarman
– Some features similar to oracle RMAN
● Recovery window / # of copies
● Stores archived WALs together with Barman backups
● Backup reports
● Does not use “rman catalog”, backed up files with some barman
metadata files are enough
● Single backup might be aechived to tape (tape integration is not
part of pgBarman) – it disappears from backup reports, once
retrieved from tape, pgBarman can use the backup again
● pgBackRest
– More complicated configuration than Barman, incremental
backups seems to be implemented slightly better
17.2.2016 PostgreSQL for Oracle DBAs 33
PostgreSQL
HA & DR
The world's most advanced
open source database.
Oracle replication
The world's most advanced
open source database.
● Oracle DataGuard
– Log shipping (log_archive_dest_n) by archiver
● ARCHIVE_LAG_TARGET
– Redo transmit by LGWR
● ASYNC
● SYNC
● Delayed recovery - DELAY=minutes attribute of the
LOG_ARCHIVE_DEST_n
– Logical standby
– Active Data Guard
– Golden Gate
17.2.2016 PostgreSQL for Oracle DBAs 35
PostgreSQL
RDBMS replication
The world's most advanced
open source database.
● Postgres
– Log-Shipping Standby Servers
● archive_timeout
– Streaming Replication
● ASYNC (default)
● SYNC - Synchronous Replication
● Standby Server Settings recovery_min_apply_delay available from
9.4
– Logical Standby
● Slony, Bucardo, logical decoding framework
– Hot Standby ( read only accessible standby )
– BDR provides asynchronous multi-master logical replication.
17.2.2016 PostgreSQL for Oracle DBAs 36
PostgreSQL
Others… I
The world's most advanced
open source database.
Others… II
The world's most advanced
open source database.
Others… III
The world's most advanced
open source database.
Others… partitioning
The world's most advanced
open source database.
● Bonus link:
How to find out which PostgreSQL table a file on
disk corresponds to