Monday, 30 September 2024

How to Create Oracle 19C Dataguard Primary and Physical Standby Database step by step process part 3

 Dear All,

In this post i will show you how to Create Oracle 19C Dataguard Primary and Physical Standby Database configuration step by step Process.


Part 3 : Data guard configuration (Both primary and physical standby configuration) ( part 3 check next post )

Ø  Primary side configuration steps

Ø  Standby server side configuration steps

Ø  DG configuration.


check for Part 1 and 2 

ANJANI APPS DBA: How to Create Oracle 19C Dataguard Primary and Physical Standby Database step by step process part 1


Part 3 : Data guard configuration (Both primary and physical standby configuration)

Ø  Primary side configuration steps

Ø  Standby server side configuration steps

Ø  DG configuration.

 

Ø  Primary side configuration steps

p    Pre-requisites to enable the Dataguard is : 

        archive log mode should be enabled 

         enable flashback

         enable force logging mode .








SQL> alter database open;
alter database force logging;
alter database flashback on;

select name,open_mode,FORCE_LOGGING,log_mode,FLASHBACK_ON from v$database;

alter system set db_recovery_file_dest_size=15G scope=both;

alter system set db_recovery_file_dest='/u01/app/oracle/fast_recovery_area' scope=both;


   



Actual Data guard configuration steps : Redo transport configuration on Primary DB :






ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 21
'/u01/app/oracle/oradata/RPROD/redo21.log' SIZE 200M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 22 
'/u01/app/oracle/oradata/RPROD/redo22.log' SIZE 200M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 23
'/u01/app/oracle/oradata/RPROD/redo23.log' SIZE 200M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 23
 '/u01/app/oracle/oradata/RPROD/redo24.log' SIZE 200M;

SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;

GROUP#    THREAD#  SEQUENCE# ARC STATUS

---------- ---------- ---------- --- ----------

        21          1          0 YES UNASSIGNED

        22          1          0 YES UNASSIGNED

        23          1          0 YES UNASSIGNED

        24          1          0 YES UNASSIGNED




ALTER SYSTEM SET fal_server='stby' SCOPE=both;
                    ALTER SYSTEM SET fal_client='rprod' SCOPE=both;

             ALTER SYSTEM SET log_archive_dest_2='service=stby async valid_for=(online_logfiles,primary_role) db_unique_name=stby' SCOPE=both;
                  ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;
          ALTER SYSTEM SET log_archive_config='dg_config=(rprod,stby)' SCOPE=both;

    Network configuration on primary and standby servers
Tnsnames.ora and listerner.ora
 ========================================

primary side :



Standby side :





Test the connectivity on both primary and standby side 





remote_login_passwordfile            string      EXCLUSIVE

create pfile on primary side and copy to standby server




copy password and pfile to standby server


edit the standby parameter and rename the password file on standby side

create required  directories on standby 

[root@standby db_home]# mkdir -p /u01/app/oracle/admin/rprod/adump
[root@standby db_home]#




connect to rman to build standby .. i have connected from the primary server 

RMAN> DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE DORECOVER NOFILENAMECHECK;






Standby side :
enable the flashback , shutdown the database and startup in mount then start the MRP .





primary :


On Standby Server
=================

alter database flashback on;

shut immediate;
startup mount;
alter database recover managed standby database disconnect;

select process, status, sequence# from v$managed_standby;

select sequence#, applied, first_time, next_time, name filename from v$archived_log order by sequence#;



primary side :

SQL> select name,open_mode,database_role from v$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
RPROD     READ WRITE           PRIMARY

SQL> select process, status, sequence# from v$managed_standby;

PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
ARCH      CLOSING               7
DGRD      ALLOCATED             0
DGRD      ALLOCATED             0
ARCH      CONNECTED             0
ARCH      CLOSING               8
ARCH      CLOSING               9
LNS       OPENING               7
DGRD      ALLOCATED             0
LNS       WRITING              10

9 rows selected.

SQL> select sequence#, applied, first_time, next_time, name filename from v$archived_log order by sequence#;

 SEQUENCE# APPLIED   FIRST_TIM NEXT_TIME
---------- --------- --------- ---------
FILENAME
--------------------------------------------------------------------------------
         5 NO        30-SEP-24 30-SEP-24
/u01/Backup/RPROD/archivelog/2024_09_30/o1_mf_1_5_mhoyfhz4_.arc

         6 NO        30-SEP-24 30-SEP-24
/u01/Backup/RPROD/archivelog/2024_09_30/o1_mf_1_6_mhp0spjc_.arc

         7 NO        30-SEP-24 30-SEP-24
/u01/app/oracle/fast_recovery_area/RPROD/archivelog/2024_09_30/o1_mf_1_7_mhp4r56
n_.arc

 SEQUENCE# APPLIED   FIRST_TIM NEXT_TIME
---------- --------- --------- ---------
FILENAME
--------------------------------------------------------------------------------

         8 NO        30-SEP-24 30-SEP-24
/u01/app/oracle/fast_recovery_area/RPROD/archivelog/2024_09_30/o1_mf_1_8_mhp4s8w
1_.arc

         9 NO        30-SEP-24 30-SEP-24
/u01/app/oracle/fast_recovery_area/RPROD/archivelog/2024_09_30/o1_mf_1_9_mhp4s92
1_.arc


SQL> alter system switch log;
alter system switch log
                    *
ERROR at line 1:
ORA-01900: LOGFILE keyword expected


SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> select process, status, sequence# from v$managed_standby;

PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
ARCH      CLOSING               7
DGRD      ALLOCATED             0
DGRD      ALLOCATED             0
ARCH      CLOSING              10
ARCH      CLOSING              11
ARCH      CLOSING              12
LNS       WRITING              13
DGRD      ALLOCATED             0
DGRD      ALLOCATED             0

9 rows selected.

SQL>  alter system switch logfile;

System altered.


Standby Side : 
--------------------

SQL> alter database flashback on;

Database altered.

SQL> select name,open_mode,database_role from v$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
RPROD     MOUNTED              PHYSICAL STANDBY

SQL> shut immediate;
startup mount;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL>
ORACLE instance started.

Total System Global Area 1795159104 bytes
Fixed Size                  8897600 bytes
Variable Size             419430400 bytes
Database Buffers         1358954496 bytes
Redo Buffers                7876608 bytes
Database mounted.
SQL> SQL>
SQL>
SQL> select name,open_mode,database_role from v$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
RPROD     MOUNTED              PHYSICAL STANDBY

SQL> select process, status, sequence# from v$managed_standby;

PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
ARCH      CONNECTED             0
DGRD      ALLOCATED             0
DGRD      ALLOCATED             0
ARCH      CONNECTED             0
ARCH      CONNECTED             0
ARCH      CONNECTED             0
RFS       IDLE                  0
RFS       IDLE                 10

8 rows selected.

SQL> alter database recover managed standby database disconnect;

Database altered.

SQL> select process, status, sequence# from v$managed_standby;

PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
ARCH      CONNECTED             0
DGRD      ALLOCATED             0
DGRD      ALLOCATED             0
ARCH      CONNECTED             0
ARCH      CONNECTED             0
ARCH      CONNECTED             0
RFS       IDLE                  0
RFS       IDLE                 10
MRP0      APPLYING_LOG         10

9 rows selected.

SQL> select process, status, sequence# from v$managed_standby;

PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
ARCH      CLOSING              11
DGRD      ALLOCATED             0
DGRD      ALLOCATED             0
ARCH      CLOSING              12
ARCH      CLOSING              10
ARCH      CONNECTED             0
RFS       IDLE                  0
RFS       IDLE                 13
MRP0      APPLYING_LOG         13

9 rows selected.

SQL> /

PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
ARCH      CLOSING              13
DGRD      ALLOCATED             0
DGRD      ALLOCATED             0
ARCH      CLOSING              12
ARCH      CLOSING              10
ARCH      CONNECTED             0
RFS       IDLE                  0
RFS       IDLE                 14
MRP0      APPLYING_LOG         14

9 rows selected.




Thanks,

Srini












How to Create Oracle 19C Dataguard Primary and Physical Standby Database step by step process part 1

 Dear All,

In this post i will show you how to Create Oracle 19C Dataguard Primary and Physical Standby Database configuration step by step Process.

Part 1 :  Oracle 19C database install and configurate (primary node setup)

Part 2 : Oracle 19C database install (standby server setup)

Part 3 : Data guard configuration (Both primary and physical standby configuration) ( part 3 check next post )

Ø  Primary side configuration steps

Ø  Standby server side configuration steps

Ø  DG configuration.


Pre-requisites: configure the primary database with 19C db and install the standby database server with 19C software.

I am using below configuration and directories in this lab


Primary database server details :

------------------------------

Host Name: primary.localdomain

ORACLE_SID      : rprod  

DB_UNIQUE_NAME=rprod

DB Name : RPROD

ORACLE_HOME: /u01/app/oracle/product/19.0.0/db_home


Standby database server details :

-------------------------------

Host Name: standby.localdomain / 

ORACLE_SID      : stby

DB_UNIQUE_NAME=stby

DB Name : RPROD

ORACLE_HOME: /u01/app/oracle/product/19.0.0/db_home


 cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6


192.168.0.111   primary.localdomain     primary

192.168.0.122   standby.localdomain     standby


Part 1 :  Oracle 19C database install and configurate (primary node setup)

> create required directories .



download and unzip the oracle 19c software's as showed below .

cd /media/sf_VM_Softwares/19C_DB_Linux_7.8.9-SW/19C_Database/

unzip V982063-01.zip -d /u01/app/oracle/product/19.0.0/db_home



Install the pre-requisite RPM;s 

============================

yum list oracle*

yum install -y oracle* --skip-broken

yum install -y oracle-database-preinstall-19c  ( it will create oracle os  user with groups )



disable selinux permission 

=====================

/etc/selinux/config

SELINUX=permissive / disbaled 



stop and disable firewall:

=====================

systemctl stop firewalld

systemctl disable firewalld



Install the database software:  

 > connect to oracle os user and go to oracle home location then install the database software .


[root@primary 19C_Database]# id oracle

uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)

[root@primary 19C_Database]#

[oracle@primary ~]$ cd /u01/app/oracle/product/19.0.0/db_home/
[oracle@primary db_home]$ pwd
/u01/app/oracle/product/19.0.0/db_home
[oracle@primary db_home]$ ls
addnode     css     deinstall    env.ora        javavm  md       OPatch   oui      R            root.sh.old.1  sqlj      usm
apex        ctx     demo         has            jdbc    mgw      opmn     owm      racg         runInstaller   sqlpatch  utl
assistants  cv      diagnostics  hs             jdk     network  oracore  perl     rdbms        schagent.conf  sqlplus   wwg
bin         data    dmu          install        jlib    nls      ord      plsql    relnotes     sdk            srvm      xdk
clone       dbjava  drdaas       instantclient  ldap    odbc     ords     precomp  root.sh      slax           suptools
crs         dbs     dv           inventory      lib     olap     oss      QOpatch  root.sh.old  sqldeveloper   ucp
[oracle@primary db_home]$ ./runInstaller



select software only .. we can configure database later by using dbca..


click next 




select enterprise 





click next 



chose as per your requirement



next 


next




click on install 






run the script from root user .. click next 


click ok// that conclude database 19C software installation part .

 


Start oracle 19C database configuration with GUI mode using dbca tool/ utility 


[oracle@primary db_home]$ pwd

/u01/app/oracle/product/19.0.0/db_home

[oracle@primary db_home]$ ./runInstaller

Launching Oracle Database Setup Wizard...


The response file for this session can be found at:

 /u01/app/oracle/product/19.0.0/db_home/install/response/db_2024-09-30_02-07-57PM.rsp


You can find the log of this install session at:

 /u01/app/oraInventory/logs/InstallActions2024-09-30_02-07-57PM/installActions2024-09-30_02-07-57PM.log

[oracle@primary db_home]$

>> start database configuration using dbca

cd /u01/app/oracle/product/19.0.0/db_home/bin

./dbca



next .. select advance configuration option 

next 


next 



next 


next 


next 




next



next




next 


next


next

next 







>> primary database server configuration completed.

[oracle@primary bin]$ ps -ef |grep smon

oracle   22085     1  0 14:31 ?        00:00:00 ora_smon_rprod

oracle   22516 12615  0 14:34 pts/0    00:00:00 grep --color=auto smon

[oracle@primary bin]$ date

Mon Sep 30 14:34:36 EDT 2024

[oracle@primary bin]$


Part 2 : Configure oracle Dataguard standby server  (standby server setup)

> create directories same as primary server 


[root@standby ~]# mkdir -p /u01/app/oracle/product/19.0.0/db_home

[root@standby ~]# mkdir -p /u01/Backup

[root@standby ~]# mkdir -p /u01/app/oraInventory

[root@standby ~]#

[root@standby ~]# chmod -Rf 755 /u01

[root@standby ~]# chown -Rf oracle:oinstall /u01



Install the RPM's for 19C database , disable firewall and disbale the selinux configuration ... check above for these commands ..

root@standby ~]# yum list oracle*
Loaded plugins: langpacks, ulninfo
Installed Packages
oracle-database-preinstall-18c.x86_64                                    1.0-1.el7                                   @ol7_latest
oracle-database-preinstall-19c.x86_64                                    1.0-3.el7                                   @ol7_latest
oracle-database-preinstall-21c.x86_64                                    1.0-1.el7                                   @ol7_latest
oracle-database-server-12cR2-preinstall.x86_64                           1.0-5.el7                                   @ol7_latest

> systemctl stop / disable firewalld 
> cat /etc/selinux/config  ( disable )  SELINUX=disabled
 [root@standby ~]# systemctl disable firewalld.service
[root@standby ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@standby ~]#



cd /u01/app/oracle/product/19.0.0/db_home
./runInstaller


[root@standby db_home]# /u01/app/oracle/product/19.0.0/db_home/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/19.0.0/db_home

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Oracle Trace File Analyzer (TFA - Standalone Mode) is available at :
    /u01/app/oracle/product/19.0.0/db_home/bin/tfactl

Note :
1. tfactl will use TFA Service if that service is running and user has been granted access
2. tfactl will configure TFA Standalone Mode only if user has no access to TFA Service or TFA is not installed

[root@standby db_home]#



standby server installation completed . here ends the part 2 


Check the next post for part 3 ...  


Thanks,

Srini