Skip to main content

Welcome to DBA Master – Database Tips, Tricks, and Tutorials

Welcome to DBA Master ! This blog is dedicated to all things related to database administration , SQL optimization , and performance tuning . Whether you're a beginner or a seasoned DBA, you'll find practical guides, troubleshooting tips, and real-world tutorials to help you work smarter with data. What to Expect: SQL performance tuning tips Indexing strategies Backup and recovery best practices High availability and replication techniques Database creation, configuration, and setup Monitoring queries and scripts for proactive performance management Migration guides across different database platforms Security essentials and best practices Recommended tools for DBAs Real-world error fixes and how to solve them Stay tuned — exciting content is coming soon. Feel free to bookmark and share: www.dbamaster.com ! Thanks for visiting!

Oracle to PostgreSQL Migration Using ORA2PG

Ora2Pg is a free tool used to migrate an Oracle database to a PostgreSQL compatible schema. It connects to the Oracle database, scans it automatically, extracts its structure or data and then generates SQL scripts that you can load into your PostgreSQL database.
     The cost estimation in an Oracle to PostgreSQL migration is not easy. Ora2Pg inspects all database objects, all functions and stored procedures to detect if there’s still some objects and PL/SQL code that cannot be automatically converted by Ora2Pg.
This tool is very helpful for the following conversions:
 

  • Schema conversion
  • PLSQL to PLPGSQL conversion


TOOLS:
Software Tools

  1. DBA-ORACLE //Oracle machine
  2. DBD-PG                //PostgreSQL machine
  3. DBI-1                //PostgreSQL machine
  4. ORA2PG        //PostgreSQL machine


INSTALLATION STEPS:
STEPS 1: (oracle machine)
go to https://metacpan.org/pod/DBD::Oracle and download DBA-ORACLE
tar -xvzf DBD-Oracle-1.75_2.tar.gz //Extract to DBA-ORACLE
Open DBA-ORACLE directory
Export oracle base path,home path and  library path

[root@server1 DBD-Oracle-1.75_2]# ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
[root@server1 DBD-Oracle-1.75_2]# ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1; export ORACLE_HOME
[root@server1 DBD-Oracle-1.75_2]# LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
And next type the content on terminal
Oracle=#perl MakeFile.PL
Oracle=# make
Oracle=# make instal

STEPS 2: (postgresql machine)
goto https://metacpan.org/pod/DBD::Pg and download DBD-PG
tar -xvzf DBD-Pg-3.6.0.tar.gz //Extract to DBD-PG
Open dbd-pg directory
And type terminal:
Postgres=# perl MakeFile.PL
Postgres=# make
Postgres=#make install

STEPS 3: (postgresql machine)
goto https://metacpan.org/pod/DBI //download DBI-1
tar -xvf DBI-1.641.tar.gz //Extract to DBI-1
Open DBI-1 directory
And type terminal:
Postgres=# perl MakeFile.PL
Postgres=# make
Postgres=#make install

STEPS 4: (postgresql machine)
goto https://github.com/darold/ora2pg/releases and download or2pg latest version
tar -xvf ora2pg-19.1.tar.bz2 //Extract to ORA2PG
Open ora2pg directory
And type terminal:
Postgres=# perl MakeFile.PL
Postgres=# make
Postgres=#make instal

STEP 5: star Listener for oracle machine
su - oracle
Export ORACLE_SID=pearl
Sysdba / as sysdba
Startup
Conn muthu/siva
exit
===============================================
check oracle listener status
Lsnrctl status   ----(and) cannot work
Netmgr            (create listener and type db details)

lsnrctl not work create .ora files

home/network/admin
vi listener.ora

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = REGISTER))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.201)(PORT = 1521))
    )
  )

vi tnsnames.ora
pearl =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.201)(PORT = 1521)))
    (CONNECT_DATA =
      (SERVICE_NAME = pearl)
    )
  )

SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.201)(PORT=1521)))' scope = spfile;

System altered.

SQL> alter system register;

System altered.
========================================================================
[oracle@server1 ~]$ lsnrctl start

[oracle@server1 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-JUL-2020 08:47:55

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=REGISTER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                28-JUL-2020 08:46:09
Uptime                    0 days 0 hr. 1 min. 46 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0.4/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/server1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=REGISTER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.201)(PORT=1521)))
Services Summary...
Service "pearl" has 1 instance(s).
  Instance "pearl", status READY, has 1 handler(s) for this service...
Service "pearlXDB" has 1 instance(s).
  Instance "pearl", status READY, has 1 handler(s) for this service...
The command completed successfully
========================================================================
STEP 6: (postgresql machine)
Goto ora2pg configuration file (/etc/ora2pg)

vi ora2pg.conf
ORACLE_HOME     /u01/app/oracle/product/11.2.0.4/db_1
ORACLE_DSN      dbi:Oracle:host=192.168.1.201;sid=pearl;port=1521
ORACLE_USER     system
ORACLE_PWD      manager
SCHEMA  MMS
TYPE            TABLE PACKAGE INSERT COPY VIEW GRANT SEQUENCE TRIGGER FUNCTION PROCEDURE
OUTPUT          muthusiva_ora2pg_migrate.sql
OUTPUT_DIR      /home/oracle

--save and exit conf file--
•    Next open /usr/local/bin  and run ./ora2pg file next automatically created migration.sql
•    Next open postgresqlAnd import migration.sql
   Postgresql=#i /home/pearl/Documents/migrate.sql

Comments

Popular posts from this blog

Oracle Database 19C Performance Tunning - PART 1

Advantages: 1. Improved Query Performance •    Optimized SQL execution plans lead to faster query response times. •    Reduces unnecessary full table scans and improves indexing strategies. •    Parallel execution tuning speeds up large data processing tasks. 2. Better Resource Utilization •    Efficient use of CPU, memory, disk I/O, and network resources. •    Reduces contention on Redo Logs, Undo Tablespaces, and Buffer Cache. •    Helps in load balancing across multiple instances in RAC (Real Application Clusters). 3. Increased System Scalability •    Ensures that the database can handle a growing number of users and transactions. •    Proper tuning allows scaling without degrading performance. •    Optimized parallel processing ensures better performance on multi-core servers. 4. Lower Infrastructure Costs •    Reduces the need for add...

Oracle RMAN Backup And Restore

RMAN: (Oracle 8) RMAN (Recovery Manager) is a utility provided by Oracle Database to perform backup, restore, and recovery operations. It is a command line tool. Features of RMAN in Oracle 19c Comprehensive Backup Capabilities: Full and incremental backups. Block-level backups for efficient data storage. Archived redo log backups. Fast Recovery Area (FRA) integration for centralized backup storage. Efficient Recovery Options: Point-in-time recovery (PITR). Complete and incomplete recovery. Flashback database capabilities for quick undo of changes. Multitenant Database Support: RMAN fully supports container databases (CDBs) and pluggable databases (PDBs). Provides flexibility to back up and recover individual PDBs or entire CDBs. Automatic Space Management: Manages disk space in the FRA. Automatically deletes obsolete backups and archived logs. Data Deduplication and Compression: Backup optimization through block-level deduplication. Built-in compression algorithms to reduce storage req...

Oracle 19c Database Software Installation in OEL8

 Pre-requisites for OS level:            Set the static IP Address     Disable the Firewall (systemctl stop firewalld & systemctl disable firewalld)     set SELINUX=permissive on /etc/selinux/config  ##Need to restart the server use init 6 Oracle Installation Pre-requisites Methods     Automatic Setup     Manual Setup      Automatic requisites Setup: (avoid step 1 to step 5): dnf install -y oracle-database-preinstall-19c Install the dependencies: curl -o oracle-database-preinstall-19c-1.0-2.el8.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/oracle-database-preinstall-19c-1.0-2.el8.x86_64.rpm dnf -y localinstall oracle-database-preinstall-19c-1.0-2.el8.x86_64.rpm Manual Setup: step 1: Add the karenl parameters and values vi /etc/sysctl.conf     fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel....