0% found this document useful (0 votes)
1 views

Data Guard Workshop Lab Exercise Twelve

The document outlines the steps to configure Data Guard in Oracle Container and Pluggable databases, including creating a container database, configuring listener and tnsnames files, and duplicating the target database for standby using RMAN. It details the commands and configurations required for setting up the standby database and ensuring proper data recovery and management. The exercise emphasizes the importance of correct file paths and parameters for successful database operations.

Uploaded by

Raúl Alvarenga
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Data Guard Workshop Lab Exercise Twelve

The document outlines the steps to configure Data Guard in Oracle Container and Pluggable databases, including creating a container database, configuring listener and tnsnames files, and duplicating the target database for standby using RMAN. It details the commands and configurations required for setting up the standby database and ensuring proper data recovery and management. The exercise emphasizes the importance of correct file paths and parameters for successful database operations.

Uploaded by

Raúl Alvarenga
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 46

Data Guard and Backup and Recovery Workshop

Lab Exercise Twelve

❖ Configure Data Guard in Container and Pluggable databases

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 1
Create the container database CDB1 via DBCA

[oracle@host01 trace]$ dbca

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 2
Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 3
Create an empty container database and ensure Local Undo Tablespaces are enabled for pluggable databases

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 4
Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 5
Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 6
Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 7
Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 8
Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 9
Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 10
Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 11
Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 12
Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 13
Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 14
Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 15
Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 16
Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 17
On the standby host (host02) edit the listener.ora file
Add a static entry for cdb1_sb and reload the listener (lsnrctl reload)

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = cdb1)

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

(GLOBAL_DBNAME = cdb1_sb)

On both the primary as well as standby hosts, add entries in the tnsnames.ora file

CDB1 =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = host01.localdomain)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = cdb1)

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 18
)

CDB1_sb =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = host02.localdomain)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = cdb1_sb)

Copy the password file from host01

[oracle@host01 trace]$ cd $ORACLE_HOME/dbs


[oracle@host01 dbs]$ scp -rp orapwcdb1 oracle@host02:/u01/app/oracle/product/12.2.0/dbhome_1/dbs
oracle@host02's password:
orapwcdb1 100% 3584 3.5KB/s 00:00

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 19
Create the init.ora file for the standby container database

Copy the init.ora from the primary database and make the following changes

*.db_unique_name='cdb1_sb'

*.standby_file_management=auto

*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=cdb1_sb'

*.log_archive_dest_2='SERVICE=cdb1 ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=cdb1'

*.log_archive_config='dg_config=(cdb1,cdb1_sb)'

*.fal_client=cdb1_sb

*.fal_server=cdb1

Start the standby instance in NOMOUNT state

[oracle@host02 admin]$ export ORACLE_SID=cdb1

[oracle@host02 admin]$ sqlplus sys as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Dec 8 09:38:33 2017

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

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 20
Enter password:
Connected to an idle instance.

SQL> startup nomount;


ORACLE instance started.

Total System Global Area 843055104 bytes


Fixed Size 8798360 bytes
Variable Size 322965352 bytes
Database Buffers 507510784 bytes
Redo Buffers 3780608 bytes

Create the standby database via RMAN DUPLICATE command

[oracle@host01 dbs]$ rman target sys/oracle@cdb1 auxiliary sys/oracle@cdb1_sb

Recovery Manager: Release 12.2.0.1.0 - Production on Fri Dec 8 09:43:52 2017

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

connected to target database: CDB1 (DBID=935901629)


connected to auxiliary database: CDB1 (not mounted)

RMAN>
duplicate target database for standby
from active database
dorecover

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 21
nofilenamecheck
;

Starting Duplicate Db at 08-DEC-17


using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=36 device type=DISK
current log archived

contents of Memory Script:


{
backup as copy reuse
targetfile '/u01/app/oracle/product/12.2.0/dbhome_1/dbs/orapwcdb1' auxiliary format
'/u01/app/oracle/product/12.2.0/dbhome_1/dbs/orapwcdb1' ;
}
executing Memory Script

Starting backup at 08-DEC-17


allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=68 device type=DISK
Finished backup at 08-DEC-17

contents of Memory Script:


{
restore clone from service 'cdb1' standby controlfile;
}
executing Memory Script

Starting restore at 08-DEC-17


using channel ORA_AUX_DISK_1

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 22
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdb1
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
output file name=/u01/app/oracle/oradata/cdb1/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/cdb1/control02.ctl
Finished restore at 08-DEC-17

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/cdb1/temp01.dbf";
set newname for tempfile 2 to
"/u01/app/oracle/oradata/cdb1/pdbseed/temp012017-12-08_09-23-50-691-AM.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/u01/app/oracle/oradata/cdb1/system01.dbf";
set newname for datafile 3 to
"/u01/app/oracle/oradata/cdb1/sysaux01.dbf";
set newname for datafile 4 to
"/u01/app/oracle/oradata/cdb1/undotbs01.dbf";

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 23
set newname for datafile 5 to
"/u01/app/oracle/oradata/cdb1/pdbseed/system01.dbf";
set newname for datafile 6 to
"/u01/app/oracle/oradata/cdb1/pdbseed/sysaux01.dbf";
set newname for datafile 7 to
"/u01/app/oracle/oradata/cdb1/users01.dbf";
set newname for datafile 8 to
"/u01/app/oracle/oradata/cdb1/pdbseed/undotbs01.dbf";
restore
from nonsparse from service
'cdb1' clone database
;
sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/cdb1/temp01.dbf in control file


renamed tempfile 2 to /u01/app/oracle/oradata/cdb1/pdbseed/temp012017-12-08_09-23-50-691-AM.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 24
executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 08-DEC-17


using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore


channel ORA_AUX_DISK_1: using network backup set from service cdb1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/cdb1/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdb1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/cdb1/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdb1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/cdb1/undotbs01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdb1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/cdb1/pdbseed/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 25
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdb1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/cdb1/pdbseed/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdb1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/cdb1/users01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdb1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/cdb1/pdbseed/undotbs01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 08-DEC-17

sql statement: alter system archive log current


current log archived

contents of Memory Script:


{
restore clone force from service 'cdb1'
archivelog from scn 1443826;
switch clone datafile all;
}
executing Memory Script

Starting restore at 08-DEC-17


using channel ORA_AUX_DISK_1

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 26
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service cdb1
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=3
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service cdb1
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=4
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 08-DEC-17

datafile 1 switched to datafile copy


input datafile copy RECID=4 STAMP=962185559 file name=/u01/app/oracle/oradata/cdb1/system01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=5 STAMP=962185559 file name=/u01/app/oracle/oradata/cdb1/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=6 STAMP=962185559 file name=/u01/app/oracle/oradata/cdb1/undotbs01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=7 STAMP=962185559 file name=/u01/app/oracle/oradata/cdb1/pdbseed/system01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=8 STAMP=962185559 file name=/u01/app/oracle/oradata/cdb1/pdbseed/sysaux01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=9 STAMP=962185559 file name=/u01/app/oracle/oradata/cdb1/users01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=10 STAMP=962185559 file name=/u01/app/oracle/oradata/cdb1/pdbseed/undotbs01.dbf

contents of Memory Script:


{

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 27
set until scn 1444009;
recover
standby
clone database
delete archivelog
;
}
executing Memory Script

executing command: SET until clause

Starting recover at 08-DEC-17


using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 3 is already on disk as file


/u01/app/oracle/fast_recovery_area/cdb1/CDB1_SB/archivelog/2017_12_08/o1_mf_1_3_f2mvpnt8_.arc
archived log for thread 1 with sequence 4 is already on disk as file
/u01/app/oracle/fast_recovery_area/cdb1/CDB1_SB/archivelog/2017_12_08/o1_mf_1_4_f2mvpp0f_.arc
archived log file name=/u01/app/oracle/fast_recovery_area/cdb1/CDB1_SB/archivelog/2017_12_08/o1_mf_1_3_f2mvpnt8_.arc thread=1
sequence=3
archived log file name=/u01/app/oracle/fast_recovery_area/cdb1/CDB1_SB/archivelog/2017_12_08/o1_mf_1_4_f2mvpp0f_.arc thread=1
sequence=4
media recovery complete, elapsed time: 00:00:00
Finished recover at 08-DEC-17
Finished Duplicate Db at 08-DEC-17

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 28
Open the standby container database

SQL> alter database open;

Database altered.

SQL> select database_role ,open_mode from v$database;

DATABASE_ROLE OPEN_MODE
---------------- --------------------
PHYSICAL STANDBY READ ONLY

Change Data Guard related parameters on the Primary container database

SQL> alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES)


DB_UNIQUE_NAME=cdb1' scope=both;

System altered.

SQL> alter system set log_archive_dest_2='SERVICE=cdb1_sb ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)


DB_UNIQUE_NAME=cdb1_sb' scope=both;

System altered.

SQL> alter system set log_archive_config='dg_config=(cdb1,cdb1_sb)' scope=both;

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 29
System altered.

SQL> alter system set fal_client=cdb1 scope=both;

System altered.

SQL> alter system set fal_server=cdb1_sb scope=both;

System altered.

SQL> alter system set standby_file_management=auto scope=both;

System altered.

On both Primary and Standby container databases create the Standby Log Files

SQL> alter database add standby logfile group 4 size 200m;

Database altered.

SQL> alter database add standby logfile group 5 size 200m;

Database altered.

SQL> alter database add standby logfile group 6 size 200m;

Database altered.

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 30
SQL> alter database add standby logfile group 7 size 200m;

Database altered.

Start Managed Recovery on the standby container database

SQL> recover managed standby database disconnect;


Media recovery complete.

Verify the Redo Transport destination is valid

SQL> select destination,status,error


from v$archive_dest_status
where rownum < 3;

DESTINATION
--------------------------------------------------------------------------------
STATUS ERROR
--------- -----------------------------------------------------------------

VALID

cdb1_sb
VALID

Create the Pluggable databases on the primary container database

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 31
Note the difference in the STANDBYS clause in the CREATE PLUGGABLE DATABASE statements

SQL> create pluggable database pdb1


admin user pdbadmin identified by oracle
file_name_convert=('/u01/app/oracle/oradata/cdb1/pdbseed/','/u01/app/oracle/oradata/cdb1/pdb1/')
standbys=('cdb1_sb');

Pluggable database created.

SQL> create pluggable database pdb2


admin user pdbadmin identified by oracle
file_name_convert=('/u01/app/oracle/oradata/cdb1/pdbseed/','/u01/app/oracle/oradata/cdb1/pdb2/')
standbys=NONE;

Pluggable database created.

Open the pluggable databases on the primary container database

SQL> alter pluggable database all open;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB$SEED

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 32
READ ONLY

PDB1
READ WRITE

PDB2
READ WRITE

On the standby container database check that the pluggable databases have been created and are in mount state

SQL> select name,open_mode from v$pdbs;

NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB$SEED
READ ONLY

PDB1
MOUNTED

PDB2
MOUNTED

On the primary container database switch a logfile

SQL> alter system switch logfile;

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 33
System altered.

On the standby database container try and open the pluggable databases PDB1 and PDB2

Note that we will not be able to open the PDB2 pluggable database.

SQL> alter pluggable database pdb1 open ;

Pluggable database altered.

SQL> alter pluggable database pdb2 open;


alter pluggable database pdb2 open
*
ERROR at line 1:
ORA-01111: name for data file 12 is unknown - rename to correct file

SQL> select name,open_mode from v$pdbs;

NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB$SEED
READ ONLY

PDB1

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 34
READ ONLY

PDB2
MOUNTED

The data files for PDB2 pluggable database are in OFFLINE and RECOVER mode

SQL> select name,status from v$datafile;

NAME
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
STATUS
-------
/u01/app/oracle/oradata/cdb1/system01.dbf
SYSTEM

/u01/app/oracle/oradata/cdb1/sysaux01.dbf
ONLINE

/u01/app/oracle/oradata/cdb1/undotbs01.dbf
ONLINE

/u01/app/oracle/oradata/cdb1/pdbseed/system01.dbf
SYSTEM

/u01/app/oracle/oradata/cdb1/pdbseed/sysaux01.dbf
ONLINE

/u01/app/oracle/oradata/cdb1/users01.dbf
ONLINE

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 35
/u01/app/oracle/oradata/cdb1/pdbseed/undotbs01.dbf
ONLINE

/u01/app/oracle/oradata/cdb1/pdb1/system01.dbf
SYSTEM

/u01/app/oracle/oradata/cdb1/pdb1/sysaux01.dbf
RECOVER

/u01/app/oracle/oradata/cdb1/pdb1/undotbs01.dbf
ONLINE

/u01/app/oracle/product/12.2.0/dbhome_1/dbs/UNNAMED00012
SYSOFF

/u01/app/oracle/product/12.2.0/dbhome_1/dbs/UNNAMED00013
RECOVER

/u01/app/oracle/product/12.2.0/dbhome_1/dbs/UNNAMED00014
RECOVER

13 rows selected.

Change the Protection Level on the primary container database and perform some DDL and DML activity

SQL> alter database set standby database to maximize availability;

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 36
Database altered.

SQL> alter session set container=pdb1;

Session altered.

SQL> create table system.myobjects


as select * from all_objects;

Table created.

SQL> commit;

Commit complete.

SQL> select count(*) from system.myobjects;

COUNT(*)
----------
71478

Verify the changes have been applied on the standby container database as well

SQL> alter session set container=pdb1;

Session altered.

SQL> select count(*) from system.myobjects;

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 37
COUNT(*)
----------
71478

On the standby container database set the parameter ENABLED_PDBS_ON_STANDBY

SQL> conn / as sysdba


Connected.

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> alter system set enabled_PDBs_on_standby='pdb1','pdb3';

System altered.

On the primary container database create the pluggable database PDB3

Note in this case no STANDBYS clause has been used in the CREATE PLUGGABLE DATABASE statement

SQL> conn / as sysdba


Connected.

SQL> create pluggable database pdb3

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 38
admin user pdbadmin identified by oracle
file_name_convert=('/u01/app/oracle/oradata/cdb1/pdbseed/','/u01/app/oracle/oradata/cdb1/pdb3/')
;

Pluggable database created.

SQL> alter pluggable database pdb3 open;

Pluggable database altered.

On the standby container database open the pluggable database PDB3

SQL> select name,open_mode from v$pdbs;

NAME OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
PDB$SEED READ ONLY
PDB1 READ ONLY
PDB2 MOUNTED
PDB3 MOUNTED

SQL> alter pluggable database pdb3 open;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 39
PDB$SEED READ ONLY
PDB1 READ ONLY
PDB2 MOUNTED
PDB3 READ ONLY

On the standby container database site, add an entry in tnsnames.ora for PDB1

PDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host02.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdb1)
)
)

On the primary container database verify that a switchover operation can be performed

SQL> conn / as sysdba


Connected.

SQL> ALTER DATABASE SWITCHOVER TO cdb1_sb VERIFY;


ALTER DATABASE SWITCHOVER TO cdb1_sb VERIFY
*
ERROR at line 1:
ORA-16475: succeeded with warnings, check alert log for more details

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 40
View the alert log for the container database

2017-12-08T11:14:14.702738+08:00
ALTER DATABASE SWITCHOVER TO cdb1_sb VERIFY
2017-12-08T11:14:14.872259+08:00
SWITCHOVER VERIFY: Send VERIFY request to switchover target CDB1_SB
SWITCHOVER VERIFY WARNING: switchover target has offline datafiles. Verify that those datafiles should remain offline.
SWITCHOVER VERIFY WARNING: switchover target temporary files are not the same with the primary. See switchover target's alert log for
details.
SWITCHOVER VERIFY WARNING: switchover target has offline pluggable databases.
ORA-16475 signalled during: ALTER DATABASE SWITCHOVER TO cdb1_sb VERIFY...

On the standby container database, add files to the temporary tablespaces for both PDB1 as well as PDB3

SQL> alter session set container=pdb1;

Session altered.

SQL> alter tablespace temp add tempfile '/u01/app/oracle/oradata/cdb1/pdb1/temp01.dbf' size 64m;

Tablespace altered.

SQL> conn / as sysdba


Connected.

SQL> alter session set container=pdb3;

Session altered.

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 41
SQL> alter tablespace temp add tempfile '/u01/app/oracle/oradata/cdb1/pdb3/temp01.dbf' size 64m;

Tablespace altered.

Perform a switchover to the standby container database

SQL> ALTER DATABASE SWITCHOVER TO cdb1_sb;

Database altered.

Open the new primary container database

Note that we will not be able to open PDB2

[oracle@host02 admin]$ sqlplus sys as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Dec 8 11:29:11 2017

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

Enter password:

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select database_role,open_mode from v$database;

DATABASE_ROLE OPEN_MODE

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 42
---------------- --------------------
PRIMARY MOUNTED

SQL> alter database open;

Database altered.

SQL> alter pluggable database all open;


alter pluggable database all open
*
ERROR at line 1:
ORA-01147: SYSTEM tablespace file 12 is offline

SQL> select name,open_mode from v$pdbs;

NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB$SEED
READ ONLY

PDB1
READ WRITE

PDB2
MOUNTED

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 43
NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB3
READ WRITE

Open the new standby container database and start all the pluggable databases except PDB2

[oracle@host01 dbs]$ sqlplus sys as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Dec 8 11:31:46 2017

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

Enter password:
Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area 843055104 bytes


Fixed Size 8798360 bytes
Variable Size 322965352 bytes
Database Buffers 507510784 bytes
Redo Buffers 3780608 bytes
Database mounted.
Database opened.

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 44
SQL> alter pluggable database all except pdb2 open;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB$SEED
READ ONLY

PDB1
READ ONLY

PDB2
MOUNTED

NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB3
READ ONLY

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 45
Start managed recovery on the new standby container database

SQL> recover managed standby database disconnect;


Media recovery complete.
SQL>

Perform another switchover operation

SQL> alter database switchover to cdb1;

Database altered.

Data Guard and Backup and Recovery Workshop Lab Exercise Twelve 46

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy