Monday, October 1, 2018

Data Guard Broker to unplug, migrate a single PDB into a new container - Using DGMGRL migrate


Migration of a single PDB or executing of a single PDB into another container database with minimal downtime. This method has zero impact to any remaining primary PDBs.  To use this method  the process takes advantage of a new functionality added to the Data Guard broker command line interface DGMGRL.

Important: The process are steps involve changes being made to 2 independent CDBs and is supported in Oracle RDBMS versions older than 12.1.0.2

The migration process overview
The destination CDBs are already in place and patched correctly, the entire process of moving the PDB can be completed in less than 15 minutes.



The New Data Guard broker command line interface DGMGRL that is used for this is :


Oracle Data Guard Platform 
The following is setup on one database server.


cat /etc/oratab
cdb1:/u01/app/oracle/product/12.2.0/dbhome_1:N
cdb2:/u01/app/oracle/product/12.2.0/dbhome_1:N
cdb3:/u01/app/oracle/product/12.2.0/dbhome_1:N
cdb4:/u01/app/oracle/product/12.2.0/dbhome_1:N

Data Guard environment orcl01

DGMGRL> show configuration verbose

Configuration - orcl01

  Protection Mode: MaxAvailability
  Members:
  orcl01 - Primary database
    orcl03 - Physical standby database 

  Properties:
    FastStartFailoverThreshold      = '30'
    OperationTimeout                = '30'
    TraceLevel                      = 'USER'
    FastStartFailoverLagLimit       = '30'
    CommunicationTimeout            = '180'
    ObserverReconnect               = '0'
    FastStartFailoverAutoReinstate  = 'TRUE'
    FastStartFailoverPmyShutdown    = 'TRUE'
    BystandersFollowRoleChange      = 'ALL'
    ObserverOverride                = 'FALSE'
    ExternalDestination1            = ''
    ExternalDestination2            = ''
    PrimaryLostWriteAction          = 'CONTINUE'
    ConfigurationWideServiceName    = 'orcl01_CFG'

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

Data Guard environment orcl02

DGMGRL> show configuration verbose


Configuration - orcl02

  Protection Mode: MaxAvailability
  Members:
  orcl04 - Primary database
    orcl02 - Physical standby database 

  Properties:
    FastStartFailoverThreshold      = '30'
    OperationTimeout                = '30'
    TraceLevel                      = 'USER'
    FastStartFailoverLagLimit       = '30'
    CommunicationTimeout            = '180'
    ObserverReconnect               = '0'
    FastStartFailoverAutoReinstate  = 'TRUE'
    FastStartFailoverPmyShutdown    = 'TRUE'
    BystandersFollowRoleChange      = 'ALL'
    ObserverOverride                = 'FALSE'
    ExternalDestination1            = ''
    ExternalDestination2            = ''
    PrimaryLostWriteAction          = 'CONTINUE'
    ConfigurationWideServiceName    = 'orcl02_CFG'

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS


Step to perform the movement of the PDB from one CDB container to an other CDB container.
  1. Stop all services on both the source primary database and any standby database(s)
  2. If using Active Data Guard mode, Validate if patch 25616359 is applied, and if not then close the PDB on all instances of those standbys
  3. Start dgmgrl, important connect as SYSDBA to the environment, not SYSDG
    dgmgrl "sys/oracle@//oel7/orcl01_cfg/cdb1" as sysdba
    DGMGRL for Linux: Release 12.2.0.1.0 - Production on Mon Oct 1 02:42:14 2018
    
    Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.
    
    Welcome to DGMGRL, type "help" for information.
    Connected to "orcl01"
    Connected as SYSDBA.
    DGMGRL> show configuration
    
    Configuration - orcl01
    
      Protection Mode: MaxAvailability
      Members:
      orcl01 - Primary database
        orcl03 - Physical standby database 
    
    Fast-Start Failover: DISABLED
    
    Configuration Status:
    SUCCESS   (status updated 55 seconds ago)
    
  4. Use the MIGRATE command withing the dgmgrl
    DGMGRL > migrate pluggable database joord01 to container orcl04 using '/home/oracle/app/pdb/joord01/pdb.xml' connect as sys@"oel7/orcl02_cfg/orcl04"
    
  5. DGMGRL Command output
    DGMGRL> migrate pluggable database joord01 to container orcl04 using '/home/oracle/app/pdb/joord01/pdb.xml' connect as sys@"oel7/orcl02_cfg/orcl04"
    Password:
    Connected to "orcl04"
    Connected as SYSDBA.
    
    Beginning migration of pluggable database JOORD01.
    Source multitenant container database is orcl01.
    Destination multitenant container database is orcl04.
    
    Closing pluggable database JOORD01 on all instances of multitenant container database orcl01.
    Unplugging pluggable database JOORD01 from multitenant container database orcl01.
    Pluggable database description will be written to /home/oracle/app/pdb/joord01/pdb.xml.
    Dropping pluggable database JOORD01 from multitenant container database orcl01.
    Creating pluggable database JOORD01 on multitenant container database orcl04.
    Opening pluggable database JOORD01 on all instances of multitenant container database orcl04.
    Succeeded.
    
  6. Once the command completes perform the following tasks
    - Add service for the PDB desired and start the services
    - Backup the PDB
Done not use the pdb archive file in the command. For this the the file name extension is changed from xml. to pdb.

/home/oracle/app/pdb/joord01/pdb.xml to /home/oracle/app/pdb/joord01/pdb.pdb

pdb_unplug_clause
  • If you specify a file name that ends with the extension .pdb, then Oracle creates a .pdb archive file. This is a compressed file that includes an XML file containing metadata about the PDB, as well as the PDB's data files. You can then copy this single archive file to a new location and specify the archive file name when plugging the PDB into a CDB. This eliminates having to copy the PDB's data files separately. When you use a .pdb archive file when plugging in a PDB, this file is extracted when you plug in the PDB, and the PDB’s files are placed in the same directory as the .pdb archive file.
This will give an Oracle Dataguard error. 

Dropping pluggable database JOORD01 from multitenant container database orcl04.
Creating pluggable database JOORD01 on multitenant container database orcl01.ORA-65314: cannot use NOCOPY when plugging in a PDB using an archive file

Information:

1 comment: