Friday, January 24, 2014

DataGuard Ortamında Veritabanlarının Patchlenmesi

Oracle tarafından belli aralıklarla çıkarılan patchlerin veritabanlarına uygulanması, alınan hataların veya bugların çözümü için gereklidir. Oracle bu hatalara yönelik çözümlerini patchler çıkartarak yayınlar. Bu patchlerin bazıları bug çözmeye yönelik iken bazıları da bir yandan veritabanı sürümünü yükseltir. Bu yazıda DataGuard ortamında patch yapılmasını anlatacağım. Oracle Linux 6.3 64 bit de koşan 11.2.0.3 veritabanlarımızın Patch 17540582 - 11.2.0.3.9 Patch Set Update  ile patchlenmesini bulacaksınız.


Mevcut yapı:

[oracle@dgpri ~]$ opatch version

Invoking OPatch 11.2.0.1.7
OPatch Version: 11.2.0.1.7
OPatch succeeded.

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE  11.2.0.3.0  Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

SQL>select * from dba_registry_history

ACTION_TIME ACTION NAMESPACE  VERSION ID BUNDLE_SERIES  COMMENTS
-------------------------------------------------------------------------- 17-SEP-11 10.21.11.595816 AM APPLY SERVER 11.2.0.3 0 PSU Patchset 11.2.0.2.0
18-JAN-13 06.00.26.873446 PM APPLY SERVER 11.2.0.3 0 PSU Patchset 11.2.0.2.0

DGMGRL> show configuration

Configuration - DGTEST

  Protection Mode: MaxPerformance
  Databases:
    PRIMARY - Primary database
    STANDBY - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

Aşağıdaki işlemlerden önce mevcut $ORACLE_HOME dizininin yedeği ve databasein bir yedeğinin alınması gerekmektedir. Test sistemde çalıştığım ve snapshotları aldığım için bu kısımları göstermiyorum.


1.      OPatch utility hk.

Patch işlemleri Opatch binarysi ile yapılmaktadır.  İlk önce mevcut componentlerin durumunda, patch işlemlerine bakalım. Detay bilgi istenmiyorsa,

[oracle@dgpri ~]$ opatch lsinventory
Invoking OPatch 11.2.0.1.7

Oracle Interim Patch Installer version 11.2.0.1.7
Copyright (c) 2011, Oracle Corporation.  All rights reserved.


Oracle Home       : /home/oracle/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /home/oracle/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.2.0.1.7
OUI version       : 11.2.0.3.0
Log file location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-01-23_11-21-07AM.log

Lsinventory Output file location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2014-01-23_11-21-07AM.txt

---------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Database 11g                                          11.2.0.3.0
There are 1 products installed in this Oracle Home.


There are no Interim patches installed in this Oracle Home.

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

OPatch succeeded.

Şimdi Opatch sürümünü yükseltmeye çalışalım.

Mevcut OPatch sürümü:

[oracle@dgpri ~]$ opatch version
Invoking OPatch 11.2.0.1.7
OPatch Version: 11.2.0.1.7
OPatch succeeded.

OPatch utility nin son sürümünü support.oracle.com’dan indiriyoruz. 11g için son sürüm
p6880880_112000_Linux-x86-64.zip dosyasını indiriyoruz. OPatch upgrade işlemi için bu zip dosyasını $ORACLE_HOME/OPatch olacak şekilde açmamız yeterli olacaktır.


Mevcut OPatch klasörünü yedeklemiştik.

[oracle@dgpri patch]$ unzip p6880880_112000_Linux-x86-64.zip
[oracle@dgpri patch]$ mv OPatch/ /home/oracle/app/oracle/product/11.2.0/dbhome_1/

Şimdi sürüme bakarsak,

[oracle@dgpri OPatch]$ opatch version
OPatch Version: 11.2.0.3.6
OPatch succeeded.

Aynı işlemi standby makinede de yapıyoruz.

[oracle@dgsby ~]$ opatch version
OPatch Version: 11.2.0.3.6

OPatch succeeded.

2.      Patch 17540582 - 11.2.0.3.9 Patch Set Update ‘in İşlenmesi

Test ortamımızdaki databasein sürümü 11.2.0.3 ve Ocak 2014 PSU sunu uygulamak istiyoruz.

Bu adımda dataguard ortamında patch işlemi yaptığımız için standby makineyi ve aralarındaki etkileşimi göz önünde tutmak zorundayız. Bu noktada support.oracle.com’dan How do you apply a Patchset,PSU or CPU in a Data Guard Physical Standby configuration (Doc ID 278641.1) dökümanındaki adımları takip etmemiz gerekiyor.

Bu adımlar özetle aşağıdaki şekildedir.

a.       Standby makineye logların gönderilmesini ve log işletilmesini durdur
b.      Standby makinede patchi uygula
c.       Primary makinede patchi uygula ve gerekli scriptleri çalıştır.
d.      Standby makineye tekrar logların gönderilmesini ve işletilmesini başlat
e.      Değişiklikleri kontrol et 

2.1.    Standby Makineye Log Gönderiminin Durdurulması

SQLPlus üzerinden yapılacağı gibi, DGMGRL üzerinden dataguard konfigürasyonunu yönetebiliriz.
Primary makinenin mevcut durumu:

DGMGRL> show database verbose 'PRIMARY';

Database - PRIMARY

  Enterprise Manager Name: VT_dgpri
  Role:                    PRIMARY
  Intended State:          TRANSPORT-ON
  Instance(s):
    VT

  Properties:
    DGConnectIdentifier             = 'PRIMARY'
    ObserverConnectIdentifier       = ''
    LogXptMode                      = 'ASYNC'
    DelayMins                       = '0'
    Binding                         = 'optional'
    MaxFailure                      = '0'
    MaxConnections                  = '1'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'
….

Log gönderimini kapatıyoruz.

DGMGRL>  edit database 'PRIMARY' set state='LOG-TRANSPORT-OFF';
Succeeded.
DGMGRL> show database verbose 'PRIMARY';

Database - PRIMARY

  Enterprise Manager Name: VT_dgpri
  Role:                    PRIMARY
  Intended State:          TRANSPORT-OFF
  Instance(s):
    VT

  Properties:
    DGConnectIdentifier             = 'PRIMARY'
    ObserverConnectIdentifier       = ''
    LogXptMode                      = 'ASYNC'
    DelayMins                       = '0'
    Binding                         = 'optional'
    MaxFailure                      = '0'
    MaxConnections                  = '1'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'
….


Bu aşamadan sonra primary makinede log switch yaptığımızda, standby makineye logların gelmediğini görmekteyiz.


SQLPlus üzerinden log_archive_dest_state in durumunu sorgulayarak emin olabiliriz.

SQL> show parameter log_Archive_dest_state_2
NAME                         TYPE   VALUE
------------------------------------ ----------- --------------------------
log_archive_dest_state_2          string RESET

2.2.    Standby Makinede Patch Uygulanması

DataGuard ortamında iki instanceı da düşünmek zorunda olduğumuzu belirtmiştim. Patch işleminde de Oracle ilk önce standby makinenin patchlenmesini belirtmektedir. Bu adımda log gönderimini durduğumuz gibi, standby makinede mevcut  recover işlemi varsa durdurmalıyız. Daha sonra listenerı kapatıp erişimi durduruyoruz.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

Database altered.

[oracle@dgsby ~]$
[oracle@dgsby ~]$
[oracle@dgsby ~]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 23-JAN-2014 13:32:40

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dgsby)(PORT=1521)))
The command completed successfully

Veritabanını kapatıp patch uygulama işlemine geçiyoruz. Patch uygulamadan önce çakışma durumunu kontrol ediyoruz.

[oracle@dgsby ~]$ sqlplus sys as sysdba

SQL>
SQL> shutdown immediate
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL>

Çakışma durumunu kontrol ediyoruz. OPatch utility ile kontrol işlemi yapılır.

$ unzip p17540582_112030_Linux-x86-64.zip
$ cd 17540582/

[oracle@dgsby 17540582]$ ls
13343438  13923374  14727310  16619892  17540582     README.html
13696216  14275605  16056266  16902043  patchmd.xml  README.txt
[oracle@dgsby 17540582]$
[oracle@dgsby 17540582]$
[oracle@dgsby 17540582]$
  
$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./

Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /home/oracle/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /home/oracle/app/oraInventory
   from           : /home/oracle/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version    : 11.2.0.3.6
OUI version       : 11.2.0.3.0
Log file location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-01-23_13-42-47PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

Şimdi patch uygulanır.

11g ile beraber PSU lar kümülatif çıktığı için epey bir işlenecek sub patchsetler olacak. J

[oracle@dgsby 17540582]$ opatch apply

Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, Oracle Corporation.  All rights reserved.


Oracle Home       : /home/oracle/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /home/oracle/app/oraInventory
   from           : /home/oracle/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version    : 11.2.0.3.6
OUI version       : 11.2.0.3.0
Log file location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-01-23_13-44-54PM_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   13343438  13696216  13923374  14275605  14727310  16056266  16619892  16902043  17540582 

Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.

Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name:

You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  Y
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/home/oracle/app/oracle/product/11.2.0/dbhome_1')


Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying sub-patch '13343438' to OH '/home/oracle/app/oracle/product/11.2.0/dbhome_1'

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.3.0...

Patching component oracle.ordim.jai, 11.2.0.3.0...

Verifying the update...

OPatch found the word "warning" in the stderr of the make command.
Please look at this stderr. You can re-run this make command.
Stderr output:
ins_precomp.mk:19: warning: overriding commands for target `pcscfg.cfg'
/home/oracle/app/oracle/product/11.2.0/dbhome_1/precomp/lib/env_precomp.mk:2160: warning: ignoring old commands for target `pcscfg.cfg'
/home/oracle/app/oracle/product/11.2.0/dbhome_1/precomp/lib/ins_precomp.mk:19: warning: overriding commands for target `pcscfg.cfg'
/home/oracle/app/oracle/product/11.2.0/dbhome_1/precomp/lib/env_precomp.mk:2160: warning: ignoring old commands for target `pcscfg.cfg'

OPatch found the word "warning" in the stderr of the make command.
Please look at this stderr. You can re-run this make command.
Stderr output:
ins_emagent.mk:113: warning: overriding commands for target `nmosudo'
ins_emagent.mk:52: warning: ignoring old commands for target `nmosudo'
/home/oracle/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk:113: warning: overriding commands for target `nmosudo'
/home/oracle/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk:52: warning: ignoring old commands for target `nmosudo'


Composite patch 17540582 successfully applied.

OPatch Session completed with warnings.
Log file location: /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-01-23_13-44-54PM_1.log

OPatch completed with warnings.

Patch işleminde bazı warningler aldık ama işlem genel olarak başarılı gözükmektedir. Oracle ın
Opatch warning: overriding commands for target xxxx (Doc ID 1448337.1) dökümanına göre bu warningleri görmezden gelebiliriz.

Daha sonra standby veritabanında  catupgrade/catcpu/catbundle.sql sqllerini çalıştırmıyoruz. Bunları daha sonra primary de çalıştırıp, redo apply ile işleteceğiz.
Standby makinede listenerı ve veritabanını mount modda açıyoruz.

[oracle@dgsby 17540582]$  lsnrctl start

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 23-JAN-2014 14:29:45

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

Starting /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.3.0 - Production
………
Services Summary...
Service "VT" has 1 instance(s).
  Instance "VT", status UNKNOWN, has 1 handler(s) for this service...
Service "STANDBY" has 1 instance(s).
  Instance "VT", status UNKNOWN, has 1 handler(s) for this service...
Service "STANDBY_DGB" has 1 instance(s).
  Instance "VT", status UNKNOWN, has 1 handler(s) for this service...
Service "STANDBY_DGMGRL" has 1 instance(s).
  Instance "VT", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


[oracle@dgsby 17540582]$ sqlplus sys as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 23 14:30:23 2014

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

SQL> startup mount
ORACLE instance started.

Total System Global Area 1.4965E+10 bytes
Fixed Size            2242912 bytes
Variable Size           1.0805E+10 bytes
Database Buffers  4127195136 bytes
Redo Buffers               31297536 bytes
Database mounted.
SQL>

Daha sonra opatch üzerinde patching işlemini doğrulatabiliriz.

[oracle@dgsby archive]$ opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, Oracle Corporation.  All rights reserved.


Oracle Home       : /home/oracle/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /home/oracle/app/oraInventory
   from           : /home/oracle/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version    : 11.2.0.3.6
OUI version       : 11.2.0.3.0
Log file location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-01-23_14-30-49PM_1.log

Lsinventory Output file location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2014-01-23_14-30-49PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Database 11g                                                  11.2.0.3.0
There are 1 product(s) installed in this Oracle Home.


Interim patches (1) :

Patch  17540582     : applied on Thu Jan 23 13:54:03 EET 2014
Unique Patch ID:  16954971
Patch description:  "Database Patch Set Update : 11.2.0.3.9 (17540582)"
   Created on 7 Jan 2014, 02:20:21 hrs PST8PDT
Sub-patch  16902043; "Database Patch Set Update : 11.2.0.3.8 (16902043)"
Sub-patch  16619892; "Database Patch Set Update : 11.2.0.3.7 (16619892)"
….
     13502183, 13705338, 16794239, 15862024, 13554409, 13645917, 13103913, 12772404


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

OPatch succeeded.


2.3.    Primary Makinede Patch Uygulanması

Aynı şekilde listenerı ve veritabanını kapatıp, patch işlemlerini tekrarlıyoruz.

[oracle@dgpri ~]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 23-JAN-2014 14:35:57

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dgpri)(PORT=1521)))
The command completed successfully
[oracle@dgpri ~]$ sqlplus "sys as sysdba"

SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 23 14:36:01 2014

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

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL>

 Çakışma durumlarını kontrol ediyoruz.

[oracle@dgpri patch]$ cd 17540582/
[oracle@dgpri 17540582]$
[oracle@dgpri 17540582]$
[oracle@dgpri 17540582]$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /home/oracle/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /home/oracle/app/oraInventory
   from           : /home/oracle/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version    : 11.2.0.3.6
OUI version       : 11.2.0.3.0
Log file location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-01-23_14-37-38PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

 Patch işlemi başlatılır.

[oracle@dgpri 17540582]$ opatch apply
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, Oracle Corporation.  All rights reserved.


Oracle Home       : /home/oracle/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /home/oracle/app/oraInventory
   from           : /home/oracle/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version    : 11.2.0.3.6
OUI version       : 11.2.0.3.0
Log file location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-01-23_14-40-39PM_1.log

….
Composite patch 17540582 successfully applied.
OPatch Session completed with warnings.
Log file location: /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-01-23_14-40-39PM_1.log

OPatch completed with warnings.

  
Patch işlemi başarılı. Şimdi listenerı ve veritabanını başlatıyoruz. Veritabanını restricted modda başlatmamız gerekiyor.


[oracle@dgpri 17540582]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 23-JAN-2014 15:04:19

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

Starting /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

…..
Services Summary...
Service "VT" has 1 instance(s).
  Instance "VT", status UNKNOWN, has 1 handler(s) for this service...
Service "PRIMARY" has 1 instance(s).
  Instance "VT", status UNKNOWN, has 1 handler(s) for this service...
Service "PRIMARY_DGB" has 1 instance(s).
  Instance "VT", status UNKNOWN, has 1 handler(s) for this service...
Service "PRIMARY_DGMGRL" has 1 instance(s).
  Instance "VT", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@dgpri 17540582]$ sqlplus "sys as sysdba"

SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 23 15:05:16 2014

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


SQL> startup restrict
ORACLE instance started.

Total System Global Area 1.0689E+10 bytes
Fixed Size            2237776 bytes
Variable Size           8623491760 bytes
Database Buffers  2046820352 bytes
Redo Buffers               16924672 bytes
Database mounted.
Database opened.
SQL>

Şimdi catbundle.sql dosyasını çalıştırıyoruz.

[oracle@dgpri admin]$ pwd
/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin
[oracle@dgpri admin]$
[oracle@dgpri admin]$ sqlplus "sys as sysdba"

SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 23 15:10:05 2014

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

SQL> @catbundle psu apply 

SQL> COMMIT;

Commit complete.

SQL> SPOOL off
SQL> SET echo off
Check the following log file for errors:
/home/oracle/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_VT_APPLY_2014Jan23_15_11_04.log


Log dosyasında bir hata göremedim.  Bu aşamadan sonra patch dökümanında bir post-installation scripti bulunmamakta.

Şimdi veritabanını normal moda çekiyoruz ve listenerı restart ediyoruz.

SQL> alter system register;

System altered.

SQL> alter system disable restricted session;

System altered.

SQL>

[oracle@dgpri ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 23-JAN-2014 15:31:56

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

….
Services Summary...
Service "VT" has 1 instance(s).
  Instance "VT", status UNKNOWN, has 1 handler(s) for this service...
Service "PRIMARY" has 2 instance(s).
  Instance "VT", status UNKNOWN, has 1 handler(s) for this service...
  Instance "VT", status READY, has 1 handler(s) for this service...
Service "PRIMARY_DGB" has 2 instance(s).
  Instance "VT", status UNKNOWN, has 1 handler(s) for this service...
  Instance "VT", status READY, has 1 handler(s) for this service...
Service "PRIMARY_DGMGRL" has 1 instance(s).
  Instance "VT", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


2.4.    Standby Makineye Redo Gönderiminin Başlatılması

Şimdi redo gönderimini tekrar başlatıyoruz. DGMGRL üzerinden konfigürasyonu kontrol edelim.

DGMGRL> show configuration
Configuration - DGTEST
  Protection Mode: MaxPerformance
  Databases:
    PRIMARY - Primary database
    STANDBY - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL> show database verbose 'PRIMARY'

Database - PRIMARY

  Enterprise Manager Name: VT_dgpri
  Role:                    PRIMARY
  Intended State:          TRANSPORT-OFF
  Instance(s):
    VT

  Properties:
    DGConnectIdentifier             = 'PRIMARY'
    ObserverConnectIdentifier       = ''
    LogXptMode                      = 'ASYNC'
    DelayMins                       = '0'
    Binding                         = 'optional'
    MaxFailure                      = '0'
    MaxConnections                  = '1'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'


DGMGRL>  edit database 'PRIMARY' set state='ONLINE';                   
Succeeded.

DGMGRL> show database verbose 'PRIMARY';

Database - PRIMARY

  Enterprise Manager Name: VT_dgpri
  Role:                    PRIMARY
  Intended State:          TRANSPORT-ON
  Instance(s):
    VT

  Properties:
    DGConnectIdentifier             = 'PRIMARY'
    ObserverConnectIdentifier       = ''
    LogXptMode                      = 'ASYNC'
    DelayMins                       = '0'
    Binding                         = 'optional'
    MaxFailure                      = '0'
    MaxConnections                  = '1'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'

Şu an redo gönderimi başladı. Bunu log switch yaparak, standby makinede arşiv log oluştuğunu görerek kontrol edebiliriz.

Loglar gönderilmektedir. SQLPlus üzerinden logların tekrar gönderildiğini teyit edebiliriz.

SQL> show parameter log_archive_dest_state_2

NAME                         TYPE   VALUE
------------------------------------ ----------- --------------------------
log_archive_dest_state_2          string ENABLE

2.5.    Gerekli kontrollerin yapılması

Standby makineyi open duruma getirerek, logları işletebiliriz. Current_scn değerlerinin aynı olduğu ana kadar recover işlemi devam edecektir.  Recovery işlemini manuel olarak tetikliyoruz.

SQL> alter database open;

Database altered.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

Database altered.

Primary:

SQL>select open_mode,log_mode, database_role,current_scn from v$database

OPEN_MODE        LOG_MODE       DATABASE_ROLE    CURRENT_SCN
-------------------- ------------ ---------------- -----------
READ WRITE       ARCHIVELOG   PRIMARY        9369782860

Standby:

SQL> select open_mode,log_mode, database_role,current_scn from v$database

OPEN_MODE        LOG_MODE       DATABASE_ROLE    CURRENT_SCN
-------------------- ------------ ---------------- -----------
READ ONLY WITH APPLY ARCHIVELOG   PHYSICAL STANDBY  9369782849

Birbirleri ile senkron hale geldiler.  Bu aşamadan sonra patchin uygulandığını aşağıdaki gibi sorgulayabiliriz.

SQL> select * from registry$history

ACTION_TIME ACTION NAMESPACE VERSION ID COMMENTS BUNDLE_SERIES
--------------------------------------------------------------------------- ------------------------------ ------------------------------ -------------

17-SEP-11 10.21.11.595816 AM APPLY SERVER 11.2.0.3 0 Patchset 11.2.0.2.0     PSU
18-JAN-13 06.00.26.873446 PM APPLY SERVER 11.2.0.3 0 Patchset 11.2.0.2.0     PSU
23-JAN-14 03.12.57.553228 PM APPLY SERVER 11.2.0.3 9 PSU 11.2.0.3.9 PSU

Aynı şekilde opatch ile patchlerin kurulduğu tekrar kontrol edilebilir.

$ opatch lsinventory

Aynı şekilde V$ARCHIVED_LOG dan applied olan loglar görülebilir.

SQL>SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;




Kolaylıklar … J

No comments :

Post a Comment