Tuesday, January 31, 2023

Oracle auto upgrade 12c to 19c


 Oracle auto upgrade 12c to 19c

 

Step 1.  Install 12 c software and create a new database.

 

 

 






Step 2. Download the 19c database software and execute run installer and install software only.

 

Step 3. Create a env for both 12c and 19c homes.

 


  





Step 4. Soure 12 c env and enable archive log mode and flashback

 

To check archive log mode

SQL> archive log list

 


 

 


 

 SQL> archive log list

Database log mode              No Archive Mode

Automatic archival             Disabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     1

Current log sequence           1

 

Enable archive log mode

 

SQL> shut immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount

ORACLE instance started.

 

Total System Global Area 1543503872 bytes

Fixed Size                  8621040 bytes

Variable Size             989856784 bytes

Database Buffers          536870912 bytes

Redo Buffers                8155136 bytes

Database mounted.

SQL>  alter database archivelog;

 

Database altered.

 

Enable flashback

 

SQL> alter database flashback on;

 

Database altered.

 

SQL> alter database open;

 

Database altered.

 

SQL> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     1

Next log sequence to archive   1

Current log sequence           1

SQL>

 

Step 5; To set db_recovery_dest size as 50G

SQL> alter system set db_recovery_file_dest_size=50g scope=both;

 

System altered.

 

SQL> show parameter db_recovery_file_dest_size

 

NAME                                 TYPE        VALUE

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

db_recovery_file_dest_size           big integer 50G

 

Purge recycle bin

 

SQL> purge recyclebin ;

 

Recyclebin purged.

 

Execute gather stats;

 

SQL>  EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;

 

PL/SQL procedure successfully completed.

 

 

SQL> select name from v$database;

 

NAME

---------

VBTTEST

 

SQL>

Step 6. Create a autoupgrade directory and file

 

[oracle@vignesh ~]$ cd /u01/

[oracle@vignesh u01]$

[oracle@vignesh u01]$

[oracle@vignesh u01]$ mkdir autoupgrade

[oracle@vignesh u01]$

[oracle@vignesh u01]$ cd autoupgrade/

[oracle@vignesh autoupgrade]$

[oracle@vignesh autoupgrade]$

 

 

Create a upgrade file and give correct db name and db homes

[oracle@vignesh autoupgrade]$ vi DB121C.cfg

[oracle@vignesh autoupgrade]$

 

 

[oracle@vignesh autoupgrade]$ cat DB121C.cfg

global.autoupg_log_dir=/u01/autoupgrade

upg1.dbname=vbttest

upg1.start_time=NOW

upg1.source_home=/u01/app/oracle/product/12.2.0/dbhome_1/

upg1.target_home=/u01/app/oracle/product/19.0.0/dbhome_1/

upg1.sid=vbttest

upg1.log_dir=/u01/autoupgrade

upg1.upgrade_node=localhost

upg1.target_version=19.3

upg1.run_utlrp=yes

upg1.timezone_upg=yes

[oracle@vignesh autoupgrade]$

Step 7: soure 19c env and execute prerequest checks

[oracle@vignesh ~]$ . vbttest19c.env

[oracle@vignesh ~]$

[oracle@vignesh ~]$

[oracle@vignesh ~]$ cd /u01/autoupgrade/

[oracle@vignesh autoupgrade]$

[oracle@vignesh autoupgrade]$

[oracle@vignesh autoupgrade]$ ls

DB121C.cfg

  

[oracle@vignesh autoupgrade]$ java -jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar -config DB121C.cfg -mode analyze -noconsole

Autoupgrade tool launched with default options

+--------------------------------+

| Starting AutoUpgrade execution |

+--------------------------------+

1 databases will be analyzed

 

Job 100 for VBTTEST FINISHED

[oracle@vignesh autoupgrade]$

 


 

 


Step 8: check the preupgrade log is there any error found fix it then will do upgrade

 [oracle@vignesh autoupgrade]$ cd 100/

[oracle@vignesh 100]$

[oracle@vignesh 100]$ ls -lrth

total 76K

-rw-rw-r--. 1 oracle oracle    0 Jan 20 11:05 autoupgrade_err.log

-rw-rw-r--. 1 oracle oracle   84 Jan 20 11:05 dbupgrade_20230120_user.log

drwxrwxr-x. 2 oracle oracle 4.0K Jan 20 11:05 prechecks

-rw-rw-r--. 1 oracle oracle  68K Jan 20 11:05 dbupgrade_20230120.log

[oracle@vignesh 100]$ cd prechecks

[oracle@vignesh prechecks]$ ls

prechecks_vbttest.log  vbttest_checklist.cfg  vbttest_checklist.json  vbttest_checklist.xml  vbttest_preupgrade.html  vbttest_preupgrade.log

 

[oracle@vignesh prechecks]$ cat vbttest_preupgrade.log

[dbname]          [VBTTEST]

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

[container]          [VBTTEST]

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

[checkname]          DICTIONARY_STATS

[stage]              PRECHECKS

[fixup_available]    YES

[runfix]             YES

[severity]           RECOMMEND

[rule]               Dictionary statistics help the Oracle optimizer find efficient SQL execution plans and are essential for proper upgrade timing. Oracle recommends gathering dictionary statistics in the last 24 hours before database upgrade.<br><br>For information on managing optimizer statistics, refer to the 12.2.0.1 Oracle Database SQL Tuning Guide.

[broken rule]        Dictionary statistics do not exist or are stale (not up-to-date).

[action]             Gather stale data dictionary statistics prior to database upgrade in off-peak time using:<br><br>  EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;

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

 

Step 9: execute auto-upgrade file to upgrade database 12 c to 19 c

 [oracle@vignesh autoupgrade]$ java -jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar -config DB121C.cfg -mode deploy

Autoupgrade tool launched with default options

+--------------------------------+

| Starting AutoUpgrade execution |

+--------------------------------+

1 databases will be processed

Enter some command, type 'help' or 'exit' to quit

upg>

upg> lsj

 

+----+-------+---------+---------+-------+--------------+--------+--------+---------------+

|JOB#|DB NAME|    STAGE|OPERATION| STATUS|    START TIME|END TIME| UPDATED|        MESSAGE|

+----+-------+---------+---------+-------+--------------+--------+--------+---------------+

| 101|VBTTEST|PRECHECKS|PREPARING|RUNNING|23/01/20 11:11|     N/A|11:12:22|Remaining 67/72|

+----+-------+---------+---------+-------+--------------+--------+--------+---------------+

Total jobs 1

upg>

To restart job;

upg> /

+----+-------+---------+---------+------+--------------+--------+--------+--------+

|JOB#|DB NAME|    STAGE|OPERATION|STATUS|    START TIME|END TIME| UPDATED| MESSAGE|

+----+-------+---------+---------+------+--------------+--------+--------+--------+

| 101|VBTTEST|PREFIXUPS|  STOPPED| ERROR|23/01/20 11:11|     N/A|11:16:59|UPG-1316|

+----+-------+---------+---------+------+--------------+--------+--------+--------+

Total jobs 1

 

 

 

upg> resume -job 101

Resuming job: [101][VBTTEST]

upg>

upg>

upg>

upg> lsj

+----+-------+---------+---------+-------+--------------+--------+--------+-------+

|JOB#|DB NAME|    STAGE|OPERATION| STATUS|    START TIME|END TIME| UPDATED|MESSAGE|

+----+-------+---------+---------+-------+--------------+--------+--------+-------+

| 101|VBTTEST|PREFIXUPS|EXECUTING|RUNNING|23/01/20 11:11|     N/A|11:23:34|       |

+----+-------+---------+---------+-------+--------------+--------+--------+-------+

Total jobs 1

 

Upgrade started

 


 

 


 

 


 

 

 


 

 


Step 10: validate database home and compatible

 

SQL> select version from v$instance;

 

VERSION

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

19.0.0.0.0

 

Drop restore point

 


 


 

 

 

 Change 19c compatible:

 


 

 

 

Wednesday, November 17, 2021

ORACLE DATA GUARD

  

ORACLE DATA GUARD 19C STANDBY CONFIGURATION 

DATA GUARD

Oracle Data Guard ensures high availability, data protection, and disaster recovery for enterprise data. Data Guard provides a comprehensive set of services that create, maintain, manage, and monitor one or more standby databases to enable production Oracle databases to survive disasters and data corruptions. Data Guard maintains these standby databases as transactional consistent copies of the production database. Then, if the production database becomes unavailable because of a planned or an unplanned outage, Data Guard can switch any standby database to the production role, minimizing the downtime associated with the outage. Data Guard can be used with traditional backup, restoration, and cluster techniques to provide a high level of data protection and data availability.


ENVIRONMENT DETAILS:

                      

Environment  

Primary

Standby

dbname

vignesh           

data

serverip

192.168.229.132

192.168.229.133

Primary server configuration:

Step 1: Check  Archive log mode enable and force logging method

 

            In primary database check weather the archive log mode is enable or not also check force logging option enable if is not enable please enable it:

 

[oracle@vignesh ~]$ export ORACLE_SID=vignesh

[oracle@vignesh ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Nov 18 07:06:06 2021

Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

 

Connect database as mount stage

 

SQL> alter database archivelog;

Database altered.

SQL> alter database force logging;

Database altered.

SQL> alter database open;

Database altered.

SQL> select FORCE_LOGGING,log_mode from v$database;

FORCE_LOGGING                                      LOG_MODE

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

YES                                                              ARCHIVELOG

 

Step 2: Add logfile group

 

            Add log file group in primary database mentioned as that file creation as standby log group

 

SQL> alter database add standby logfile group 4 '/u01/app/oracle/oradata/VIGNESH/redo04.log' size 50m;

Database altered.

 

SQL> alter database add standby logfile group 5 '/u01/app/oracle/oradata/VIGNESH/redo05.log' size 50m;     

Database altered.

 

SQL> alter database add standby logfile group 6 '/u01/app/oracle/oradata/VIGNESH/redo06.log' size 50m;

Database altered.

 

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

 

    GROUP#    THREAD#  SEQUENCE# ARC STATUS

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

             4             0             0 YES UNASSIGNED

             5             0             0 YES UNASSIGNED

             6             0             0 YES UNASSIGNED

SQL>

 

Step 3- check listener and TNS entry both primary and standby severs

 

Primary side entries

 

listener =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS_LIST =

        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.229.132)(PORT = 1521))

      )

      (ADDRESS_LIST =

        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))

      )

    )

  )

 

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (SID_NAME = PLSExtProc)

      (ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)

      (PROGRAM = extproc)

    )

    (SID_DESC =

      (GLOBAL_DBNAME = vignesh)

      (ORACLE_HOME =/u01/app/oracle/product/19.0.0/dbhome_1)

      (SID_NAME = vignesh)

    )

  )

 

[oracle@vignesh admin]$

[oracle@vignesh admin]$ cat tnsnames.ora

vignesh=

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.229.132)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = vignesh)

    )

  )

data=

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.229.133)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = data)

        (UR=A)

    )

  )

 

 

 

 

Standby side entries

 

[oracle@data admin]$ cat listener.ora

listener =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS_LIST =

        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.229.133)(PORT = 1521))

      )

      (ADDRESS_LIST =

        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))

      )

    )

  )

 

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (SID_NAME = PLSExtProc)

      (ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)

      (PROGRAM = extproc)

    )

    (SID_DESC =

      (GLOBAL_DBNAME = data)

      (ORACLE_HOME =/u01/app/oracle/product/19.0.0/dbhome_1)

      (SID_NAME = data)

    )

  )

 

[oracle@data admin]$

data=

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.229.133)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = data)

    )

  )

vignesh=

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.229.132)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = vignesh)

        (UR=A)

    )

  )

Output of tns ping statements connect both of sides primary to standby and standby to primary

[oracle@vignesh admin]$ tnsping data

 

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 18-NOV-2021 07:19:44

 

Copyright (c) 1997, 2019, Oracle.  All rights reserved.

 

Used parameter files:

 

 

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.229.133)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = data) (UR=A)))

OK (20 msec)

 

[oracle@vignesh admin]$ tnsping vignesh

 

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 18-NOV-2021 07:19:55

 

Copyright (c) 1997, 2019, Oracle.  All rights reserved.

 

Used parameter files:

 

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.229.132)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = vignesh)))

OK (0 msec)

[oracle@vignesh admin]$

 

                                                           

Step 4:Changing some of the parameters in primary database it’s the basic configuration parameters in dataguard

1. dg_config – Specify the DG_CONFIG attribute to identify the DB_UNIQUE_NAME for the primary database and each standby database in the Data Guard configuration.

 

SQL> ALTER SYSTEM SET log_archive_config='dg_config=(vignesh,data)' SCOPE=both;

System altered.

 

2. log_archive_dest_1  - The LOG_ARCHIVE_DEST parameter is used to specify the directory to which Oracle archive logs are written.

 

SQL> ALTER SYSTEM SET log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=vignesh' SCOPE=both;

 

System altered.

 

3. log_archive_dest_2 - handle the transmission of the standby site’s archived redo logs back to the original primary database

 

SQL> ALTER SYSTEM SET log_archive_dest_2='service=data async valid_for=(online_logfiles,primary_role) db_unique_name=data' SCOPE=both;

 

System altered.

 

4. FAL_SERVER Parameter
            FAL means fetch archive log. Its clearly indicate with name that fetch the archive log.
FAL_SERVER used to fetch archive log server for a standby database.
Value in FAL_SERVER parameter act as Oracle Net Service name which point to standby database.

 

SQL> ALTER SYSTEM SET fal_server='data' SCOPE=both;

 

System altered.

 5. FAL_CLIENTParameter
FAL_CLIENT specifies the FAL(fetch archive log) client name that is used by the FAL service.
It configured for point the FAL Client.
Value in FAL_CLIENT is also an Oracle Net Service Name.

 

SQL> ALTER SYSTEM SET fal_client='vignesh' SCOPE=both;

 

System altered.

 

6. standby_file_management -

Check the redo changes done in Primary and sync that changes in Standby by Stopping the recovery and make STANDBY_FILE_MANAGEMENT = MANUAL value. Then sync the primary changes with standby changes and again change parameter to AUTO and start the recovery on Standby database.

SQL> ALTER SYSTEM SET standby_file_management='AUTO' SCOPE=both;

 

System altered.

 

SQL>  show parameter log_archive_config;

 

NAME                                                     TYPE         VALUE

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

log_archive_config                      string          dg_config=(vignesh,data)

SQL>

 

Step 5: - copy password files (primary)

 

scp orapwvignesh oracle@192.168.229.133:$ORACLE_HOME/dbs

 

[oracle@vignesh dbs]$ scp orapwvignesh oracle@192.168.229.133:$ORACLE_HOME/dbs

oracle@192.168.229.133's password:

orapwvignesh                 100% 2048     2.1MB/s   00:00   

[oracle@vignesh dbs]$

 

            Move the file in new name (standby)

 

oracle@data ~]$ cd $ORACLE_HOME/dbs

[oracle@data dbs]$ ls

hc_data.dat  init.ora  lkDATA  orapwdata  orapwvignesh  spfiledata.ora

[oracle@data dbs]$ mv orapwvignesh orapwdata

 

Step 6 :- Changing parameters in standby database

 

In the $ORACLE_HOME/dbs directory of the standby system, create an initialization parameter file named initdata.ora
Containing a single parameter: DB_NAME=vignesh

[oracle@data dbs]$ cat initdata.ora
db_name=vignesh
[oracle@data dbs]$ pwd
/u01/app/oracle/product/19.0.0/dbhome_1/dbs

 

Step 7 :- Create directory Structure in Standby database

 

[oracle@data dbs]$ cd $ORACLE_BASE/admin/

[oracle@data dbs]$ mkdir data

[oracle@data dbs]$ cd data

[oracle@data dbs]$ mkdir adump

[oracle@data dbs]$ mkdir -p /u01/app/oracle/oradata/DATA

 

 

Step 8:- connect RMAN and in standby database and run the script

 

            Target database as primary – Vignesh

            Auxiliary database as standby - Data

[oracle@data admin]$ export ORACLE_SID=vignesh

[oracle@data admin]$ rman target sys/oracle@vignesh auxiliary sys/oracle@data

Recovery Manager: Release 19.0.0.0.0 - Production on Thu Nov 18 08:00:22 2021

Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database: VIGNESH (DBID=396457310)

connected to auxiliary database: VIGNESH (not mounted)

 

RMAN> run

{

allocate channel p1 type disk;

allocate channel p2 type disk;

allocate channel p3 type disk;

allocate channel p4 type disk;

allocate auxiliary channel s1 type disk;

duplicate target database for standby from active database

spfile

parameter_value_convert 'vignesh','data'

set db_name='vignesh'

set db_unique_name='data'

set db_file_name_convert='/u01/app/oracle/oradata/VIGNESH/','/u01/app/oracle/oradata/DATA/'

set log_file_name_convert='/u01/app/oracle/oradata/VIGNESH/','/u01/app/oracle/oradata/DATA/'

set control_files='/u01/app/oracle/oradata/DATA/standby1.ctl'

set log_archive_max_processes='5'

set fal_client='data'

set fal_server='vignesh'

set standby_file_management='AUTO'

set log_archive_config='dg_config=(vignesh,data)'

set compatible='19.3.0.0'

set memory_target='1200m'

nofilenamecheck;

}

 

using target database control file instead of recovery catalog

allocated channel: p1

channel p1: SID=82 device type=DISK

 

allocated channel: p2

channel p2: SID=81 device type=DISK

 

allocated channel: p3

channel p3: SID=85 device type=DISK

 

allocated channel: p4

channel p4: SID=86 device type=DISK

 

allocated channel: s1

channel s1: SID=35 device type=DISK

 

Starting Duplicate Db at 18-NOV-21

 

contents of Memory Script:

{

   backup as copy reuse

   passwordfile auxiliary format  '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/orapwdata'   targetfile

 '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfilevignesh.ora' auxiliary format

 '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfiledata.ora'   ;

   sql clone "alter system set spfile= ''/u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfiledata.ora''";

}

executing Memory Script

 

Starting backup at 18-NOV-21

Finished backup at 18-NOV-21

 

sql statement: alter system set spfile= ''/u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfiledata.ora''

 

contents of Memory Script:

{

   sql clone "alter system set  audit_file_dest =

 ''/u01/app/oracle/admin/data/adump'' comment=

 '''' scope=spfile";

   sql clone "alter system set  dispatchers =

 ''(PROTOCOL=TCP) (SERVICE=dataXDB)'' comment=

 '''' scope=spfile";

   sql clone "alter system set  db_name =

 ''vignesh'' comment=

 '''' scope=spfile";

   sql clone "alter system set  db_unique_name =

 ''data'' comment=

 '''' scope=spfile";

   sql clone "alter system set  db_file_name_convert =

 ''/u01/app/oracle/oradata/VIGNESH/'', ''/u01/app/oracle/oradata/DATA/'' comment=

 '''' scope=spfile";

   sql clone "alter system set  log_file_name_convert =

 ''/u01/app/oracle/oradata/VIGNESH/'', ''/u01/app/oracle/oradata/DATA/'' comment=

 '''' scope=spfile";

   sql clone "alter system set  control_files =

 ''/u01/app/oracle/oradata/DATA/standby1.ctl'' comment=

 '''' scope=spfile";

   sql clone "alter system set  log_archive_max_processes =

 5 comment=

 '''' scope=spfile";

   sql clone "alter system set  fal_client =

 ''data'' comment=

 '''' scope=spfile";

   sql clone "alter system set  fal_server =

 ''vignesh'' comment=

 '''' scope=spfile";

   sql clone "alter system set  standby_file_management =

 ''AUTO'' comment=

 '''' scope=spfile";

   sql clone "alter system set  log_archive_config =

 ''dg_config=(vignesh,data)'' comment=

 '''' scope=spfile";

   sql clone "alter system set  compatible =

 ''19.3.0.0'' comment=

 '''' scope=spfile";

   sql clone "alter system set  memory_target =

 1200m comment=

 '''' scope=spfile";

   shutdown clone immediate;

   startup clone nomount;

}

executing Memory Script

 

sql statement: alter system set  audit_file_dest =  ''/u01/app/oracle/admin/data/adump'' comment= '''' scope=spfile

 

sql statement: alter system set  dispatchers =  ''(PROTOCOL=TCP) (SERVICE=dataXDB)'' comment= '''' scope=spfile

 

sql statement: alter system set  db_name =  ''vignesh'' comment= '''' scope=spfile

 

sql statement: alter system set  db_unique_name =  ''data'' comment= '''' scope=spfile

 

sql statement: alter system set  db_file_name_convert =  ''/u01/app/oracle/oradata/VIGNESH/'', ''/u01/app/oracle/oradata/DATA/'' comment= '''' scope=spfile

 

sql statement: alter system set  log_file_name_convert =  ''/u01/app/oracle/oradata/VIGNESH/'', ''/u01/app/oracle/oradata/DATA/'' comment= '''' scope=spfile

 

sql statement: alter system set  control_files =  ''/u01/app/oracle/oradata/DATA/standby1.ctl'' comment= '''' scope=spfile

 

sql statement: alter system set  log_archive_max_processes =  5 comment= '''' scope=spfile

 

sql statement: alter system set  fal_client =  ''data'' comment= '''' scope=spfile

 

sql statement: alter system set  fal_server =  ''vignesh'' comment= '''' scope=spfile

 

sql statement: alter system set  standby_file_management =  ''AUTO'' comment= '''' scope=spfile

 

sql statement: alter system set  log_archive_config =  ''dg_config=(vignesh,data)'' comment= '''' scope=spfile

 

sql statement: alter system set  compatible =  ''19.3.0.0'' comment= '''' scope=spfile

 

sql statement: alter system set  memory_target =  1200m comment= '''' scope=spfile

 

Oracle instance shut down

 

connected to auxiliary database (not started)

Oracle instance started

 

Total System Global Area    1258290752 bytes

 

Fixed Size                     8896064 bytes

Variable Size                738197504 bytes

Database Buffers             503316480 bytes

Redo Buffers                   7880704 bytes

allocated channel: s1

channel s1: SID=35 device type=DISK

 

contents of Memory Script:

{

   backup as copy current controlfile for standby auxiliary format  '/u01/app/oracle/oradata/DATA/standby1.ctl';

}

executing Memory Script

 

Starting backup at 18-NOV-21

channel p1: starting datafile copy

copying standby control file

output file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/snapcf_vignesh.f tag=TAG20211118T080552

channel p1: datafile copy complete, elapsed time: 00:00:01

Finished backup at 18-NOV-21

 

contents of Memory Script:

{

   sql clone 'alter database mount standby database';

}

executing Memory Script

 

sql statement: alter database mount standby database

 

contents of Memory Script:

{

   set newname for tempfile  1 to

 "/u01/app/oracle/oradata/DATA/datafile/o1_mf_temp_jsc8y37j_.tmp";

   switch clone tempfile all;

   set newname for datafile  1 to

 "/u01/app/oracle/oradata/DATA/datafile/o1_mf_system_jsc8qv1o_.dbf";

   set newname for datafile  3 to

 "/u01/app/oracle/oradata/DATA/datafile/o1_mf_sysaux_jsc8smrq_.dbf";

   set newname for datafile  4 to

 "/u01/app/oracle/oradata/DATA/datafile/o1_mf_undotbs1_jsc8tq0b_.dbf";

   set newname for datafile  7 to

 "/u01/app/oracle/oradata/DATA/datafile/o1_mf_users_jsc8tr78_.dbf";

   backup as copy reuse

   datafile  1 auxiliary format

 "/u01/app/oracle/oradata/DATA/datafile/o1_mf_system_jsc8qv1o_.dbf"   datafile

 3 auxiliary format

 "/u01/app/oracle/oradata/DATA/datafile/o1_mf_sysaux_jsc8smrq_.dbf"   datafile

 4 auxiliary format

 "/u01/app/oracle/oradata/DATA/datafile/o1_mf_undotbs1_jsc8tq0b_.dbf"   datafile

 7 auxiliary format

 "/u01/app/oracle/oradata/DATA/datafile/o1_mf_users_jsc8tr78_.dbf"   ;

   sql 'alter system archive log current';

}

executing Memory Script

 

executing command: SET NEWNAME

 

renamed tempfile 1 to /u01/app/oracle/oradata/DATA/datafile/o1_mf_temp_jsc8y37j_.tmp in control file

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

Starting backup at 18-NOV-21

channel p1: starting datafile copy

input datafile file number=00001 name=/u01/app/oracle/oradata/VIGNESH/datafile/o1_mf_system_jsc8qv1o_.dbf

channel p2: starting datafile copy

input datafile file number=00003 name=/u01/app/oracle/oradata/VIGNESH/datafile/o1_mf_sysaux_jsc8smrq_.dbf

channel p3: starting datafile copy

input datafile file number=00004 name=/u01/app/oracle/oradata/VIGNESH/datafile/o1_mf_undotbs1_jsc8tq0b_.dbf

channel p4: starting datafile copy

input datafile file number=00007 name=/u01/app/oracle/oradata/VIGNESH/datafile/o1_mf_users_jsc8tr78_.dbf

output file name=/u01/app/oracle/oradata/DATA/datafile/o1_mf_users_jsc8tr78_.dbf tag=TAG20211118T080558

channel p4: datafile copy complete, elapsed time: 00:00:08

output file name=/u01/app/oracle/oradata/DATA/datafile/o1_mf_sysaux_jsc8smrq_.dbf tag=TAG20211118T080558

channel p2: datafile copy complete, elapsed time: 00:01:00

output file name=/u01/app/oracle/oradata/DATA/datafile/o1_mf_undotbs1_jsc8tq0b_.dbf tag=TAG20211118T080558

channel p3: datafile copy complete, elapsed time: 00:00:59

output file name=/u01/app/oracle/oradata/DATA/datafile/o1_mf_system_jsc8qv1o_.dbf tag=TAG20211118T080558

channel p1: datafile copy complete, elapsed time: 00:01:22

Finished backup at 18-NOV-21

 

sql statement: alter system archive log current

 

contents of Memory Script:

{

   switch clone datafile all;

}

executing Memory Script

 

datafile 1 switched to datafile copy

input datafile copy RECID=1 STAMP=1088928441 file name=/u01/app/oracle/oradata/DATA/datafile/o1_mf_system_jsc8qv1o_.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=2 STAMP=1088928441 file name=/u01/app/oracle/oradata/DATA/datafile/o1_mf_sysaux_jsc8smrq_.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=3 STAMP=1088928441 file name=/u01/app/oracle/oradata/DATA/datafile/o1_mf_undotbs1_jsc8tq0b_.dbf

datafile 7 switched to datafile copy

input datafile copy RECID=4 STAMP=1088928441 file name=/u01/app/oracle/oradata/DATA/datafile/o1_mf_users_jsc8tr78_.dbf

Finished Duplicate Db at 18-NOV-21

released channel: p1

released channel: p2

released channel: p3

released channel: p4

released channel: s1

 

RMAN> exit

 

Step 9: Check database can be configured or not:

 

SQL> select open_mode,name from v$database;

 

OPEN_MODE                NAME

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

MOUNTED         VIGNESH

 

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

 

OPEN_MODE                NAME      DATABASE_ROLE

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

MOUNTED         VIGNESH   PHYSICAL STANDBY

 

Step 10:- connect standby database execute the command

 

SQL> alter database recover managed standby database disconnect nodelay;

 

Database altered.

 

Step 11:- in primary database switch log files:

 

SQL> archive log list;

Database log mode            Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     7

Next log sequence to archive   9

Current log sequence         9

 

Set log_archive_dest_state_2 as defer

SQL> alter system set log_archive_dest_state_2=defer;

 

System altered.

 

Enable log_archive_dest_state_2 location

SQL> alter system set log_archive_dest_state_2=enable;

 

System altered.

 

SQL> alter system switch logfile;

 

System altered.

 

SQL> /

 

System altered.

 

Step 12 : – check standby database log files can be swithed

 

SQL> select error, status from v$archive_dest;

 

SQL> SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference"

FROM

(SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,

(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL

WHERE

ARCH.THREAD# = APPL.THREAD#

ORDER BY 1;

  2    3    4    5    6    7 

    Thread Last Sequence Received Last Sequence Applied Difference

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

             1                            11                  11    0

Check MRP0 process status

SQL> SELECT STATUS FROM V$MANAGED_STANDBY WHERE PROCESS='MRP0';

 

STATUS

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

WAIT_FOR_LOG

 

Archived log applied time and status

 

SQL> SELECT sequence#, first_time, next_time, applied FROM v$archived_log ORDER BY sequence#;

 

 SEQUENCE# FIRST_TIM NEXT_TIME APPLIED

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

             6 18-NOV-21 18-NOV-21 YES

             7 18-NOV-21 18-NOV-21 YES

             8 18-NOV-21 18-NOV-21 YES

             9 18-NOV-21 18-NOV-21 YES

            10 18-NOV-21 18-NOV-21 YES

            11 18-NOV-21 18-NOV-21 YES

            12 18-NOV-21 18-NOV-21 YES

            13 18-NOV-21 18-NOV-21 YES

 

8 rows selected.

 

SQL> select name,open_mode from v$database;

 

NAME              OPEN_MODE

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

VIGNESH   MOUNTED

 

Step 13:- monitor the process in alert log

 

            The best method to monitor data guard process in alert log it shows as exact data transfer reports and errors we can using the logs easily find out the mistakes

 

oracle@data trace]$ pwd

/u01/app/oracle/diag/rdbms/data/data/trace

[oracle@data trace]$ tail -100f alert_data.log

MRP0 (PID:26173): Media Recovery Log /u01/app/oracle/fast_recovery_area/DATA/archivelog/2021_11_18/o1_mf_1_11_jsclfmk7_.arc

MRP0 (PID:26173): Media Recovery Waiting for T-1.S-12 (in transit)

2021-11-18T09:05:44.267442+05:30

 rfs (PID:29555): Archived Log entry 7 added for B-1088922080.T-1.S-12 ID 0x17a1415e LAD:2

 rfs (PID:29555): No SRLs created for T-1

2021-11-18T09:05:44.297904+05:30

 rfs (PID:29555): Opened log for T-1.S-13 dbid 396457310 branch 1088922080

2021-11-18T09:05:44.346775+05:30

MRP0 (PID:26173): Media Recovery Log /u01/app/oracle/fast_recovery_area/DATA/archivelog/2021_11_18/o1_mf_1_12_jsclfnxx_.arc

MRP0 (PID:26173): Media Recovery Waiting for T-1.S-13 (in transit)

2021-11-18T09:05:45.670215+05:30

 rfs (PID:29555): Archived Log entry 8 added for B-1088922080.T-1.S-13 ID 0x17a1415e LAD:2

 rfs (PID:29555): No SRLs created for T-1

2021-11-18T09:05:45.699219+05:30

 rfs (PID:29555): Opened log for T-1.S-14 dbid 396457310 branch 1088922080

2021-11-18T09:05:46.482970+05:30

MRP0 (PID:26173): Media Recovery Log /u01/app/oracle/fast_recovery_area/DATA/archivelog/2021_11_18/o1_mf_1_13_jscljj95_.arc

MRP0 (PID:26173): Media Recovery Waiting for T-1.S-14 (in transit)

2021-11-18T09:16:20.023804+05:30

 

 

Beyond No-Code: How Oracle AI Agent Studio Uses MCP, Governance, and AI-Unit Monitoring to Build Production-Ready Industry Agents

  Beyond No-Code: How Oracle AI Agent Studio Uses MCP, Governance, and AI-Unit Monitoring to Build Production-Ready Industry Agents Recentl...