practices & solutions

Upload: xuan-sinh-pham

Post on 11-Oct-2015

28 views

Category:

Documents


0 download

TRANSCRIPT

  • Appendix A Practices and Solutions

  • Oracle Database 11g: Data Guard Administration A - 2

    Table of Contents Practices for Lesson 1: Introduction to Oracle Data Guard ................................................ 4 Practices for Lesson 2: Creating a Physical Standby Database by Using SQL and RMAN Commands .......................................................................................................................... 5

    Practice 2-1: Preparing the Primary Database ................................................................ 6 Practice 2-2: Creating the Physical Standby Database ................................................. 11 Practice 2-3: Verifying That the Physical Standby Database Is Performing Correctly 29

    Practices for Lesson 3: Oracle Data Guard Broker: Overview ......................................... 31 Practices for Lesson 4: Creating a Data Guard Broker Configuration ............................. 32

    Practice 4-1: Setting the DG_BROKER_START Initialization Parameter .................. 33 Practice 4-2: Configuring Listener to Allow Data Guard Broker to Restart Primary Database Instance Server Setup ................................................................................. 35 Practice 4-3: Configuring Listener to Allow Data Guard Broker to Restart Standby Database Instance Server Setup ................................................................................. 39 Practice 4-4: Creating an Oracle Net Service Name to Allow Standby Database Instance to Connect to Primary Database Instance Client Setup ............................... 43 Practice 4-5: Creating an Oracle Net Service Name for the Standby Database for Non-Standard Dynamic Registration .................................................................................... 46 Practice 4-6: Creating the Broker Configuration .......................................................... 50 Practice 4-7: Enabling the Broker Configuration ......................................................... 52

    Practices for Lesson 5: Creating a Physical Standby Database by Using Enterprise Manager Grid Control ....................................................................................................... 53

    Practice 5-1: Installing the Oracle Management Agent ................................................ 54 Practice 5-2: Configuring Monitoring Credentials for Your Primary Database ........... 59 Practice 5-3: Configuring Monitoring Credentials for Your Standby Database ........... 60 Practice 5-4: Configuring Preferred Credentials for Your Host Machine .................... 61 Practice 5-5: Adding a Physical Standby Database to Your Configuration ................. 62 Practice 5-6: Verifying the Broker Configuration ........................................................ 72 Practice 5-7: Deleting the Database .............................................................................. 75

    Practices for Lesson 6: Creating a Logical Standby Database ......................................... 78 Practice 6-1: Creating a Logical Standby Database ...................................................... 79 Practice 6-2: Implementing SQL Apply Filtering ........................................................ 84

    Practices for Lesson 7: Creating and Managing a Snapshot Standby Database ............... 89 Practice 7-1: Verifying Flashback Database on the Physical Standby Database.......... 90

    ------------------ ................................................................................................................... 90 Practice 7-2: Converting the Physical Standby Database to a Snapshot Standby Database ........................................................................................................................ 92 Practice 7-3: Updating the Databases and Verifying Redo Shipment .......................... 93 Practice 7-4: Converting the Snapshot Standby Database to a Physical Standby Database ........................................................................................................................ 95

    Practices for Lesson 8: Using Oracle Active Data Guard............................................... 100 Practice 8-1: Using Real-Time Query......................................................................... 101 Practice 8-2: Enabling Block Change Tracking.......................................................... 106

    Practices for Lesson 9: Configuring Data Protection Modes .......................................... 107 Practice 9-1: Setting the Data Protection Mode by Using DGMGRL ........................ 108

  • Oracle Database 11g: Data Guard Administration A - 3

    Practice 9-2: Setting the Data Protection Mode by Using Enterprise Manager Grid Control ........................................................................................................................ 112

    Practices for Lesson 10: Performing Role Transitions ................................................... 116 Practice 10-1: Performing Switchover by Using DGMGRL ...................................... 117 Practice 10-2: Performing Switchover by Using Enterprise Manager........................ 123

    Practices for Lesson 11: Using Flashback Database in a Data Guard Configuration ..... 125 Practice 11-1: Configuring Flashback Database on the Primary Database ................ 126 Practice 11-2: Configuring Flashback Database on the Standby Database ................ 127

    Practices for Lesson 12: Enabling Fast-Start Failover .................................................... 128 Practice 12-1: Enabling Fast-Start Failover ................................................................ 129 Practice 12-2: Starting the Observer ........................................................................... 131 Practice 12-3: Testing Fast-Start Failover .................................................................. 134 Practice 12-4: Switching Back to Your Primary Database ......................................... 138 Practice 12-5: Stopping the Observer and Disabling Fast-Start Failover ................... 140

    Practices for Lesson 13: Managing Client Connectivity ................................................ 142 Practice 13-1: Creating a Service for PCPRMY Instance .................................. 143 Practice 13-2: Creating a Service for the PCSBY1 Instance .............................. 145 Practice 13-3: Creating an Oracle Net Service Name on Your Primary Database Host..................................................................................................................................... 148 Practice 13-4: Creating an Oracle Net Service Name on Your Standby Database Host..................................................................................................................................... 150 Practice 13-5: Testing Your Implementation .............................................................. 151

    Practices for Lesson 14: Backup and Recovery Considerations in an Oracle Data Guard Configuration .................................................................................................................. 156

    Practice 14-1: Creating the Recovery Catalog ............................................................ 157 Practice 14-2: Registering Your Database in the Recovery Catalog .......................... 159 Practice 14-3: Configuring RMAN Parameters .......................................................... 162 Practice 14-4: Recovering a Data File in Your Primary Database ............................. 166

    Practices for Lesson 15: Patching and Upgrading Databases in a Data Guard Configuration .................................................................................................................. 173 Practices for Lesson 16: Monitoring a Data Guard Broker Configuration .................... 174

    Practice 16-1: Viewing Log File Details .................................................................... 175 Practice 16-2: Using DGMGRL to Monitor the Configuration .................................. 178

    Practices for Lesson 17: Optimizing a Data Guard Configuration ................................. 182 Practice 17-1: Configuring Network Compression of Redo Data .............................. 183

  • Oracle Database 11g: Data Guard Administration A - 4

    Practices for Lesson 1: Introduction to Oracle Data Guard

    There are no practices for Lesson 1, Introduction to Oracle Data Guard.

  • Oracle Database 11g: Data Guard Administration A - 5

    Practices for Lesson 2: Creating a Physical Standby Database by Using SQL and RMAN Commands

    In the practices for Lesson 2, Creating a Physical Standby Database by Using SQL and RMAN Commands, you create a physical standby database by using SQL and RMAN commands. Use this page to record information about the databases in your configuration. Primary Database Database Name: _________________________________________________ Instance Name: _________________________________________________ Database Unique Name: __________________________________________ Target Name: ___________________________________________________ Host: __________________________________________________________ Oracle Home: ____________________________________________________ Standby Database Database Name: _________________________________________________ Instance Name: _________________________________________________ Database Unique Name: __________________________________________ Target Name: ___________________________________________________ Host: __________________________________________________________ Oracle Home: ____________________________________________________ Standby Database Database Name: _________________________________________________ Instance Name: _________________________________________________ Database Unique Name: __________________________________________ Target Name: ___________________________________________________ Host: __________________________________________________________ Oracle Home: ____________________________________________________ Standby Database Database Name: _________________________________________________ Instance Name: _________________________________________________ Database Unique Name: __________________________________________ Target Name: ___________________________________________________ Host: __________________________________________________________ Oracle Home: ____________________________________________________

  • Oracle Database 11g: Data Guard Administration A - 6

    Practice 2-1: Preparing the Primary Database In this practice, you verify that the primary database is configured correctly to support a physical standby database. Your primary database is named pcprmy, where nn represents the number of the PC you are using in the classroom. You create a standby database named pcsby1, where nn represents the number of the PC that you are using in the classroom (and your primary database is on). For example, if you are using PC 5, your primary database is pc05prmy and your standby database is pc05sby1. 1) Open a terminal window. Change to the labs directory. Set the environment

    variables for your primary database using the oraenv utility. Invoke SQL*Plus and connect as SYSDBA to your primary database. Determine if FORCE LOGGING is enabled. If it is not enabled, enable FORCE LOGGING mode. [oracle@EDBVR6P1- ~]$ cd labs [oracle@EDBVR6P1- labs]$ . oraenv ORACLE_SID = [oracle] ? pc01prmy The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle [oracle@EDBVR6P1-pc01prmy labs]$ [[oracle@EDBVR6P1-pc01prmy labs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 17:43:22 2010 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> SELECT force_logging FROM v$database; FOR --- NO SQL> ALTER DATABASE FORCE LOGGING; Database altered. SQL> SELECT force_logging FROM v$database;

  • Practice 2-1: Preparing the Primary Database (continued)

    Oracle Database 11g: Data Guard Administration A - 7

    FOR --- YES

    2) Configure the standby redo logs on the primary database. You can use the cr_sby_redologs.sql script. SQL> @cr_sby_redologs SQL> ALTER DATABASE ADD STANDBY LOGFILE '+DATA' size 52428800 2 / Database altered. SQL> ALTER DATABASE ADD STANDBY LOGFILE '+DATA' size 52428800 2 / Database altered. SQL> ALTER DATABASE ADD STANDBY LOGFILE '+DATA' size 52428800 2 / Database altered. SQL> ALTER DATABASE ADD STANDBY LOGFILE '+DATA' size 52428800 2 / Database altered.

    3) Set the LOG_ARCHIVE_DEST_1 initialization parameter on the primary database to use the flash recovery area as the first archive log location.

    SQL> alter system set log_archive_dest_1 = 'LOCATION=USE_DB_RECOVERY_FILE_DEST'; System altered.

    4) Set the LOG_ARCHIVE_CONFIG and LOG_ARCHIVE_DEST_2 initialization parameters on the primary database. You must specify the name of your primary database and your standby database; do not use the names shown in the examples. Note: Be sure to leave a blank space before each of the attributes of LOG_ARCHIVE_DEST_2. SQL> alter system set log_archive_config = 'dg_config=(pc01prmy,pc01sby1)'; System altered. SQL> show parameter log_archive_config NAME TYPE VALUE -------------------- --------- ----------------------------- log_archive_config string dg_config=(pc01prmy,pc01sby1)

  • Practice 2-1: Preparing the Primary Database (continued)

    Oracle Database 11g: Data Guard Administration A - 8

    SQL> alter system 2 set log_archive_dest_2 = 3 'service=pc01sby1 async 4 valid_for=(online_logfile,primary_role) 5 db_unique_name=pc01sby1'; System altered. SQL> show parameter log_archive_dest_2 NAME TYPE VALUE -------------------- ------- ----------------------------- log_archive_dest_2 string service=pc01sby1 async valid_for=(online_logfile, primary_role) db_unique_name=pc01sby1 Note: Output formatted for legibility

    5) Configure ARCHIVELOG mode and enable automatic archiving. Note: Your sequence numbers may be different than the ones displayed. Do not perform a log switch because the network service for destination 2 has not been created yet.

    SQL> archive log list Database log mode No Archive Mode Automatic archival Disabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 6 Current log sequence 8 SQL> SHUTDOWN IMMEDIATE Database closed. Database dismounted. ORACLE instance shut down. SQL> STARTUP MOUNT ORACLE instance started. Total System Global Area 439406592 bytes Fixed Size 1337072 bytes Variable Size 394266896 bytes Database Buffers 37748736 bytes Redo Buffers 6053888 bytes Database mounted. SQL> ALTER DATABASE ARCHIVELOG; Database altered. SQL> ALTER DATABASE OPEN; Database altered.

  • Practice 2-1: Preparing the Primary Database (continued)

    Oracle Database 11g: Data Guard Administration A - 9

    6) Increase the size of the flash recovery area to 5 GB. Exit SQL*Plus.

    SQL> alter system set db_recovery_file_dest_size = 5G; System altered. SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options [oracle@EDBVR6P1-pc01prmy labs]$

    7) Invoke RMAN and log in to your primary database.

    [oracle@EDBVR6P1-pc01prmy labs]$ rman Recovery Manager: Release 11.2.0.1.0 - Production on Tue Feb 9 17:51:02 2010 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. RMAN> connect target / connected to target database: PC01PRMY (DBID=2580985790)

    8) Make a whole database backup, including archived redo log files. Exit RMAN.

    RMAN> backup database plus archivelog; Starting backup at 09-FEB-10 current log archived using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=145 device type=DISK channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=8 RECID=1 STAMP=710531375 input archived log thread=1 sequence=9 RECID=2 STAMP=710531376 input archived log thread=1 sequence=10 RECID=3 STAMP=710531518 channel ORA_DISK_1: starting piece 1 at 09-FEB-10 channel ORA_DISK_1: finished piece 1 at 09-FEB-10 piece handle=+FRA/pc01prmy/backupset/2010_02_09/annnf0_tag20100209t175159_0.267.710531519 tag=TAG20100209T175159 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 Finished backup at 09-FEB-10 Starting backup at 09-FEB-10 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set

  • Practice 2-1: Preparing the Primary Database (continued)

    Oracle Database 11g: Data Guard Administration A - 10

    channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=+DATA/pc01prmy/datafile/system.256.710507257 input datafile file number=00002 name=+DATA/pc01prmy/datafile/sysaux.257.710507261 input datafile file number=00005 name=+DATA/pc01prmy/datafile/example.276.710508055 input datafile file number=00003 name=+DATA/pc01prmy/datafile/undotbs1.258.710507263 input datafile file number=00004 name=+DATA/pc01prmy/datafile/users.259.710507263 channel ORA_DISK_1: starting piece 1 at 09-FEB-10 channel ORA_DISK_1: finished piece 1 at 09-FEB-10 piece handle=+FRA/pc01prmy/backupset/2010_02_09/nnndf0_tag20100209t175202_0.268.710531523 tag=TAG20100209T175202 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 09-FEB-10 channel ORA_DISK_1: finished piece 1 at 09-FEB-10 piece handle=+FRA/pc01prmy/backupset/2010_02_09/ncsnf0_tag20100209t175202_0.269.710531601 tag=TAG20100209T175202 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 Finished backup at 09-FEB-10 Starting backup at 09-FEB-10 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=11 RECID=4 STAMP=710531604 channel ORA_DISK_1: starting piece 1 at 09-FEB-10 channel ORA_DISK_1: finished piece 1 at 09-FEB-10 piece handle=+FRA/pc01prmy/backupset/2010_02_09/annnf0_tag20100209t175324_0.271.710531605 tag=TAG20100209T175324 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 09-FEB-10 RMAN> exit Recovery Manager complete. [oracle@EDBVR6P1-pc01prmy labs]$

  • Oracle Database 11g: Data Guard Administration A - 11

    Practice 2-2: Creating the Physical Standby Database In this practice, you create a physical standby database. Note: Be sure to verify the information you enter into fields in Oracle Net Manager before proceeding to the next page. 1) On your primary database system, use Oracle Net Manager to create an Oracle Net

    service name for your physical standby database. This helps the primary database instance to connect to the standby database instance.

    a) Launch Net Manager.

    [oracle@EDBVR6P1-pc01prmy labs]$ netmgr b) Expand Local. Select Service Naming and click the green plus sign in the left

    navigation bar.

    c) Enter pcsby1 in the Net Service Name field and click Next.

    Note: For the value of nn, enter the number of the PC to which you are assigned.

    d) Select TCP/IP (Internet Protocol) and click Next.

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 12

    e) Enter the fully qualified host name of the machine on which you are creating your physical standby database and 12001 in the Port Number field. Click Next. Note: edbvr6p2.us.oracle.com is used only as an example.

    f) Enter pcsby1.us.oracle.com in the Service Name field and click

    Next. Note: For the value of nn, enter the number of the PC to which you are assigned.

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 13

    g) Click Finish. h) Select File > Save Network Configuration to save the information to the

    tnsnames.ora file. Your tnsnames.ora file should have entries similar to the following:

    [oracle@EDBVR6P1-pc01prmy labs]$ cat $ORACLE_HOME/network/admin/tnsnames.ora # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. PC01PRMY = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = edbvr6p1.us.oracle.com)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pc01prmy.us.oracle.com) ) ) PC01DB11 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = edbvr6p1.us.oracle.com)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pc01db11.us.oracle.com) ) ) PC01SBY1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = edbvr6p2.us.oracle.com)(PORT = 12001)) ) (CONNECT_DATA = (SERVICE_NAME = pc01sby1.us.oracle.com) ) ) [oracle@EDBVR6P1-pc01prmy labs]$ i) Exit Oracle Net Manager.

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 14

    2) Open a new terminal window and use ssh to connect to the machine on which your physical standby database will be created. Log in as the oracle user with a password of oracle. You will need to set the environment variables for the primary Oracle database installed on that machine. The ORACLE_SID value is machine specific. Leave this window with environment variables set when done with this step. Set DISPLAY to your machine. [oracle@EDBVR6P1-pc01prmy ~]$ xhost + access control disabled, clients can connect from any host [oracle@EDBVR6P1-pc01prmy ~]$ ssh edbvr6p2 The authenticity of host 'edbvr6p2 (10.150.23.85)' can't be established. RSA key fingerprint is cc:b1:11:60:dd:4c:28:43:4a:ab:66:a1:b7:1f:d7:0c. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'edbvr6p2,10.150.23.85' (RSA) to the list of known hosts. oracle@edbvr6p2's password: oracle Last login: Tue Feb 9 13:31:22 2010 from 141.144.112.73 [oracle@EDBVR6P2- ~]$ . oraenv ORACLE_SID = [oracle] ? pc02prmy The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle [oracle@EDBVR6P2-pc02prmy ~]$ export DISPLAY=edbvr6p1:2

    3) Launch Oracle Net Manager to configure an entry for your standby database in the listener.ora file. a) Expand Local. b) Expand Listeners. c) Select LISTENER1. d) Select Database Services in the list. e) Click Add Database.

    f) Enter pcsby1.us.oracle.com in the Global Database Name field. Accept the default for Oracle Home Directory. Enter pcsby1 in the SID field. Note: For the value of nn, enter the number of the PC to which you are assigned.

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 15

    g) Select File > Save Network Configuration. h) Select File > Exit.

    4) On the same machine (the one on which you are creating your standby database), invoke the listener control utility to start the LISTENER1 listener. [oracle@EDBVR6P2-pc02prmy ~]$ lsnrctl start listener1 LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 09-FEB-2010 18:12:06 Copyright (c) 1991, 2009, Oracle. All rights reserved. Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.1.0 - Production System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Log messages written to /u01/app/oracle/diag/tnslsnr/EDBVR6P2/listener1/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p2.us.oracle.com)(PORT=12001))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p2.us.oracle.com)(PORT=12001))) STATUS of the LISTENER ------------------------ Alias listener1 Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 09-FEB-2010 18:12:06 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 16

    Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/EDBVR6P2/listener1/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p2.us.oracle.com)(PORT=12001))) Services Summary... ... Service "pc01sby1.us.oracle.com" has 1 instance(s). Instance "pc01sby1", status UNKNOWN, has 1 handler(s) for this service... ... The command completed successfully [oracle@EDBVR6P2-pc02prmy ~]$

    5) Return to the terminal window for your primary database system. Change to the $ORACLE_HOME/dbs directory and view the contents of the directory. [oracle@EDBVR6P1-pc01prmy labs]$ cd $ORACLE_HOME/dbs [oracle@EDBVR6P1-pc01prmy dbs]$ ls hc_DBUA0.dat initpc01db11.ora orapwpc01db11 peshm_pc01prmy_0 hc_pc01db11.dat initpc01prmy.ora orapwpc01prmy snapcf_pc01prmy.f hc_pc01prmy.dat lkPC01DB11 peshm_DBUA0_0 init.ora lkPC01PRMY peshm_pc01db11_0 [oracle@EDBVR6P1-pc01prmy dbs]$

    6) FTP to the host where your standby database will be created. Specify a username of oracle and a password of oracle to log on. [oracle@EDBVR6P1-pc01prmy dbs]$ ftp edbvr6p2 Connected to edBVr6p2.us.oracle.com. 220 edBVr6p2.us.oracle.com FTP server (Version wu-2.6.1-20) ready. 530 Please login with USER and PASS. 530 Please login with USER and PASS. KERBEROS_V4 rejected as an authentication type Name (edbvr6p2:oracle): oracle 331 Password required for oracle Password: 230 User oracle logged in. Remote system type is UNIX. Using binary mode to transfer files. ftp>

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 17

    7) FTP your primary database password file to the standby database system, renaming the password file so that it can be used for your physical standby database. Exit the FTP session.

    ftp> put orapwpc01prmy orapwpc01sby1 local: orapwpc01prmy remote: orapwpc01sby1 227 Entering Passive Mode (10,150,23,85,229,121) 150 Opening BINARY mode data connection for orapwpc01sby1. 226 Transfer complete. 1536 bytes sent in 4.3e-05 seconds (3.5e+04 Kbytes/s) ftp> quit 221-You have transferred 1536 bytes in 1 files. 221-Total traffic for this session was 2046 bytes in 1 transfers. 221 Thank you for using the FTP service on edBVr6p2.us.oracle.com.

    8) Return to your standby database system window. Relocate the password file to the $ORACLE_HOME/dbs directory. Verify that you have successfully moved it and named it correctly.

    [oracle@EDBVR6P2-pc02prmy ~]$ ls db.env grid.env oradiag_oracle setup Desktop labs orapwpc01sby1 setup_scripts.tar [oracle@EDBVR6P2-pc02prmy ~]$ mv orapwpc01sby1 $ORACLE_HOME/dbs [oracle@EDBVR6P2-pc02prmy ~]$ cd $ORACLE_HOME/dbs [oracle@EDBVR6P2-pc02prmy dbs]$ ls hc_DBUA0.dat initpc02db11.ora orapwpc01sby1 peshm_pc02db11_0 hc_pc02db11.dat initpc02prmy.ora orapwpc02db11 peshm_pc02prmy_0 hc_pc02prmy.dat lkPC02DB11 orapwpc02prmy init.ora lkPC02PRMY peshm_DBUA0_0 [oracle@EDBVR6P2-pc02prmy dbs]$

    9) On the standby database host, create an initialization parameter file named initpcsby1.ora containing a single parameter: DB_NAME=pcsby1. [oracle@EDBVR6P2-pc02prmy dbs]$ vi initpc01sby1.ora > [oracle@EDBVR6P2-pc02prmy dbs]$ more initpc01sby1.ora DB_NAME=pc01sby1 [oracle@EDBVR6P2-pc02prmy dbs]$

    10) On the standby database host, change to the /u01/app/oracle/admin directory. Create the pcsby1 directory. [oracle@EDBVR6P2-pc02prmy dbs]$ cd /u01/app/oracle/admin [oracle@EDBVR6P2-pc02prmy admin]$ ls +ASM pc02db11 pc02prmy [oracle@EDBVR6P2-pc02prmy admin]$ mkdir pc01sby1

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 18

    11) Change to the pcsby1 directory and create the adump, dpdump, and pfile directories.

    [oracle@EDBVR6P2-pc02prmy admin]$ cd pc01sby1 [oracle@EDBVR6P2-pc02prmy pc01sby1]$ mkdir adump dpdump pfile

    12) On the standby host, set the ORACLE_SID environment variable to pcsby1 and start the instance in NOMOUNT mode with the text initialization parameter file. Exit SQL*Plus.

    [oracle@EDBVR6P2-pc02prmy pc01sby1]$ export ORACLE_SID=pc01sby1 [oracle@EDBVR6P2-pc01sby1 pc01sby1]$ echo $ORACLE_SID pc01sby1 [oracle@EDBVR6P2-pc01sby1 pc01sby1]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 18:22:02 2010 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount pfile=$ORACLE_HOME/dbs/initpc01sby1.ora ORACLE instance started. Total System Global Area 150667264 bytes Fixed Size 1335080 bytes Variable Size 92274904 bytes Database Buffers 50331648 bytes Redo Buffers 6725632 bytes SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@EDBVR6P2-pc01sby1 pc01sby1]$ exit logout Connection to edbvr6p2 closed. [oracle@EDBVR6P1-pc01prmy ~]$ exit

    13) On the primary database host, verify that the ORACLE_SID environment variable is set to pcprmy. [oracle@EDBVR6P1-pc01prmy dbs]$ echo $ORACLE_SID pc01prmy [oracle@EDBVR6P1-pc01prmy dbs]$

    14) On the primary database host, change to the $HOME/labs directory. Verify that the cr_phys_sby1.txt script contains the correct values for your primary and standby databases.

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 19

    [oracle@EDBVR6P1-pc01prmy dbs]$ cd $HOME/labs [oracle@EDBVR6P1-pc01prmy labs]$ cat cr_phys_sby1.txt run { allocate channel prmy1 type disk; allocate channel prmy2 type disk; allocate channel prmy3 type disk; allocate channel prmy4 type disk; allocate auxiliary channel stby type disk; duplicate target database for standby from active database spfile parameter_value_convert 'pc01prmy','pc01sby1' set db_unique_name='pc01sby1' set db_create_file_dest='+SBDAT' set db_recovery_file_dest='+SBFRA' set db_recovery_file_dest_size='5G' set control_files='+SBDAT' set log_archive_max_processes='5' set fal_client='pc01sby1' set fal_server='pc01prmy' set standby_file_management='AUTO' set log_archive_config='dg_config=(pc01prmy,pc01sby1)' set log_archive_dest_2='service=pc01prmy ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=pc01prmy' ; } [oracle@EDBVR6P1-pc01prmy labs]$

    15) Invoke RMAN and connect as SYSDBA to the target database. Connect to the auxiliary database.

    [oracle@EDBVR6P1-pc01prmy labs]$ rman Recovery Manager: Release 11.2.0.1.0 - Production on Tue Feb 9 18:26:16 2010 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. RMAN> connect target sys/oracle_4U connected to target database: PC01PRMY (DBID=2580985790) RMAN> connect auxiliary sys/oracle_4U@pc01sby1 connected to auxiliary database: PC01SBY1 (not mounted) RMAN>

    16) Execute the cr_phys_sby1.txt script.

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 20

    RMAN> @cr_phys_sby1.txt RMAN> run { 2> allocate channel prmy1 type disk; 3> allocate channel prmy2 type disk; 4> allocate channel prmy3 type disk; 5> allocate channel prmy4 type disk; 6> allocate auxiliary channel stby type disk; 7> duplicate target database for standby from active database 8> spfile 9> parameter_value_convert 'pc01prmy','pc01sby1' 10> set db_unique_name='pc01sby1' 11> set db_create_file_dest='+SBDAT' 12> set db_recovery_file_dest='+SBFRA' 13> set db_recovery_file_dest_size='5G' 14> set control_files='+SBDAT' 15> set log_archive_max_processes='5' 16> set fal_client='pc01sby1' 17> set fal_server='pc01prmy' 18> set standby_file_management='AUTO' 19> set log_archive_config='dg_config=(pc01prmy,pc01sby1)' 20> set log_archive_dest_2='service=pc01prmy ASYNC 21> valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=pc01prmy' 22> ; 23> } using target database control file instead of recovery catalog allocated channel: prmy1 channel prmy1: SID=25 device type=DISK allocated channel: prmy2 channel prmy2: SID=144 device type=DISK allocated channel: prmy3 channel prmy3: SID=23 device type=DISK allocated channel: prmy4 channel prmy4: SID=147 device type=DISK allocated channel: stby channel stby: SID=96 device type=DISK Starting Duplicate Db at 09-FEB-10 contents of Memory Script: { backup as copy reuse

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 21

    targetfile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwpc01prmy' auxiliary format '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwpc01sby1' targetfile '+DATA/pc01prmy/spfilepc01prmy.ora' auxiliary format '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilepc01sby1.ora' ; sql clone "alter system set spfile= ''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilepc01sby1.ora''"; } executing Memory Script Starting backup at 09-FEB-10 Finished backup at 09-FEB-10 sql statement: alter system set spfile= ''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilepc01sby1.ora'' contents of Memory Script: { sql clone "alter system set audit_file_dest = ''/u01/app/oracle/admin/pc01sby1/adump'' comment= '''' scope=spfile"; sql clone "alter system set dispatchers = ''(PROTOCOL=TCP) (SERVICE=pc01sby1XDB)'' comment= '''' scope=spfile"; sql clone "alter system set db_unique_name = ''pc01sby1'' comment= '''' scope=spfile"; sql clone "alter system set db_create_file_dest = ''+SBDAT'' comment= '''' scope=spfile"; sql clone "alter system set db_recovery_file_dest = ''+SBFRA'' comment= '''' scope=spfile"; sql clone "alter system set db_recovery_file_dest_size = 5G comment= '''' scope=spfile"; sql clone "alter system set control_files = ''+SBDAT'' comment= '''' scope=spfile"; sql clone "alter system set log_archive_max_processes = 5 comment= '''' scope=spfile"; sql clone "alter system set fal_client = ''pc01sby1'' comment=

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 22

    '''' scope=spfile"; sql clone "alter system set fal_server = ''pc01prmy'' 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=(pc01prmy,pc01sby1)'' comment= '''' scope=spfile"; sql clone "alter system set log_archive_dest_2 = ''service=pc01prmy ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=pc01prmy'' comment= '''' scope=spfile"; shutdown clone immediate; startup clone nomount; } executing Memory Script sql statement: alter system set audit_file_dest = ''/u01/app/oracle/admin/pc01sby1/adump'' comment= '''' scope=spfile sql statement: alter system set dispatchers = ''(PROTOCOL=TCP) (SERVICE=pc01sby1XDB)'' comment= '''' scope=spfile sql statement: alter system set db_unique_name = ''pc01sby1'' comment= '''' scope=spfile sql statement: alter system set db_create_file_dest = ''+SBDAT'' comment= '''' scope=spfile sql statement: alter system set db_recovery_file_dest = ''+SBFRA'' comment= '''' scope=spfile sql statement: alter system set db_recovery_file_dest_size = 5G comment= '''' scope=spfile sql statement: alter system set control_files = ''+SBDAT'' comment= '''' scope=spfile sql statement: alter system set log_archive_max_processes = 5 comment= '''' scope=spfile sql statement: alter system set fal_client = ''pc01sby1'' comment= '''' scope=spfile

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 23

    sql statement: alter system set fal_server = ''pc01prmy'' 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=(pc01prmy,pc01sby1)'' comment= '''' scope=spfile sql statement: alter system set log_archive_dest_2 = ''service=pc01prmy ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=pc01prmy'' comment= '''' scope=spfile Oracle instance shut down connected to auxiliary database (not started) Oracle instance started Total System Global Area 439406592 bytes Fixed Size 1337072 bytes Variable Size 268437776 bytes Database Buffers 163577856 bytes Redo Buffers 6053888 bytes allocated channel: stby channel stby: SID=11 device type=DISK contents of Memory Script: { sql clone "alter system set control_files = ''+SBDAT/pc01sby1/controlfile/current.256.710533699'' comment= ''Set by RMAN'' scope=spfile"; backup as copy current controlfile for standby auxiliary format '+SBDAT/pc01sby1/controlfile/current.257.710533699'; sql clone "alter system set control_files = ''+SBDAT/pc01sby1/controlfile/current.257.710533699'' comment= ''Set by RMAN'' scope=spfile"; shutdown clone immediate; startup clone nomount; } executing Memory Script sql statement: alter system set control_files = ''+SBDAT/pc01sby1/controlfile/current.256.710533699'' comment= ''Set by RMAN'' scope=spfile Starting backup at 09-FEB-10 channel prmy1: starting datafile copy

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 24

    copying standby control file output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_pc01prmy.f tag=TAG20100209T182739 RECID=1 STAMP=710533659 channel prmy1: datafile copy complete, elapsed time: 00:00:03 Finished backup at 09-FEB-10 sql statement: alter system set control_files = ''+SBDAT/pc01sby1/controlfile/current.257.710533699'' comment= ''Set by RMAN'' scope=spfile Oracle instance shut down connected to auxiliary database (not started) Oracle instance started Total System Global Area 439406592 bytes Fixed Size 1337072 bytes Variable Size 268437776 bytes Database Buffers 163577856 bytes Redo Buffers 6053888 bytes allocated channel: stby channel stby: SID=11 device type=DISK 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 clone tempfile 1 to new; switch clone tempfile all; set newname for clone datafile 1 to new; set newname for clone datafile 2 to new; set newname for clone datafile 3 to new; set newname for clone datafile 4 to new; set newname for clone datafile 5 to new; backup as copy reuse datafile 1 auxiliary format new datafile 2 auxiliary format new datafile 3 auxiliary format new datafile 4 auxiliary format new datafile 5 auxiliary format new ; sql 'alter system archive log current';

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 25

    } executing Memory Script executing command: SET NEWNAME renamed tempfile 1 to +SBDAT in control file executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting backup at 09-FEB-10 channel prmy1: starting datafile copy input datafile file number=00001 name=+DATA/pc01prmy/datafile/system.256.710507257 channel prmy2: starting datafile copy input datafile file number=00002 name=+DATA/pc01prmy/datafile/sysaux.257.710507261 channel prmy3: starting datafile copy input datafile file number=00005 name=+DATA/pc01prmy/datafile/example.276.710508055 channel prmy4: starting datafile copy input datafile file number=00003 name=+DATA/pc01prmy/datafile/undotbs1.258.710507263 output file name=+SBDAT/pc01sby1/datafile/undotbs1.259.710533719 tag=TAG20100209T182757 channel prmy4: datafile copy complete, elapsed time: 00:00:46 channel prmy4: starting datafile copy input datafile file number=00004 name=+DATA/pc01prmy/datafile/users.259.710507263 output file name=+SBDAT/pc01sby1/datafile/example.260.710533719 tag=TAG20100209T182757 channel prmy3: datafile copy complete, elapsed time: 00:01:13 output file name=+SBDAT/pc01sby1/datafile/users.262.710533773 tag=TAG20100209T182757 channel prmy4: datafile copy complete, elapsed time: 00:00:38 output file name=+SBDAT/pc01sby1/datafile/system.258.710533719 tag=TAG20100209T182757 channel prmy1: datafile copy complete, elapsed time: 00:02:05 output file name=+SBDAT/pc01sby1/datafile/sysaux.261.710533719 tag=TAG20100209T182757 channel prmy2: datafile copy complete, elapsed time: 00:02:15

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 26

    Finished backup at 09-FEB-10 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=710533855 file name=+SBDAT/pc01sby1/datafile/system.258.710533719 datafile 2 switched to datafile copy input datafile copy RECID=2 STAMP=710533855 file name=+SBDAT/pc01sby1/datafile/sysaux.261.710533719 datafile 3 switched to datafile copy input datafile copy RECID=3 STAMP=710533855 file name=+SBDAT/pc01sby1/datafile/undotbs1.259.710533719 datafile 4 switched to datafile copy input datafile copy RECID=4 STAMP=710533855 file name=+SBDAT/pc01sby1/datafile/users.262.710533773 datafile 5 switched to datafile copy input datafile copy RECID=5 STAMP=710533855 file name=+SBDAT/pc01sby1/datafile/example.260.710533719 Finished Duplicate Db at 09-FEB-10 released channel: prmy1 released channel: prmy2 released channel: prmy3 released channel: prmy4 released channel: stby RMAN> **end-of-file** RMAN>

    17) Exit your RMAN session and log in to SQL*Plus on your primary database system.

    RMAN> exit Recovery Manager complete. [oracle@EDBVR6P1-pc01prmy labs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 18:32:18 2010 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to:

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 27

    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL>

    18) Perform a log switch on the primary database.

    SQL> alter system switch logfile; System altered. SQL>

    19) Open a terminal window for the system that your physical standby database is on. Add an entry for the pcsby1 standby database to the /etc/oratab file. Use the oraenv utility to set your environment variables. Change to the labs directory. Log in to SQL*Plus as the SYSDBA user. Start Redo Apply. [oracle@EDBVR6P1-pc01prmy ~]$ ssh edbvr6p2 oracle@edbvr6p2's password: oracle Last login: Tue Feb 9 18:14:31 2010 from edBVr6p1.us.oracle.com [oracle@EDBVR6P2- ~]$ vi /etc/oratab > [oracle@EDBVR6P2- ~]$ cat /etc/oratab .. +ASM:/u01/app/oracle/product/11.2.0/grid:N pc02db11:/u01/app/oracle/product/11.2.0/dbhome_1:N # line added by Agent pc02prmy:/u01/app/oracle/product/11.2.0/dbhome_1:N # line added by Agent pc01sby1:/u01/app/oracle/product/11.2.0/dbhome_1:N [oracle@EDBVR6P2-pc01sby1 ~]$ . oraenv ORACLE_SID = [+ASM] ? pc01sby1 The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle [oracle@EDBVR6P2-pc01sby1 ~]$ cd $HOME/labs [oracle@EDBVR6P2-pc01sby1 labs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 18:39:01 2010 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to:

  • Practice 2-2: Creating the Physical Standby Database (continued)

    Oracle Database 11g: Data Guard Administration A - 28

    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> alter database recover managed standby database 2 using current logfile disconnect; Database altered.

  • Oracle Database 11g: Data Guard Administration A - 29

    Practice 2-3: Verifying That the Physical Standby Database Is Performing Correctly In this practice, you verify that the standby database is performing correctly.

    1) On the standby database, identify the existing archived redo log files. Use the query_archived_log.sql file. Note: The starting number of archived redo logs and their sequence numbers can vary.

    SQL> @query_archived_log SQL> SELECT sequence#, first_time, next_time 2 FROM v$archived_log 3 ORDER BY sequence# 4 / SEQUENCE# FIRST_TIM NEXT_TIME ---------- --------- --------- 12 09-FEB-10 09-FEB-10 13 09-FEB-10 09-FEB-10 14 09-FEB-10 09-FEB-10

    2) On the primary database, perform a few log switches.

    SQL> alter system switch logfile; System altered. SQL> alter system switch logfile; System altered. SQL> alter system switch logfile; System altered.

    3) On the standby database, verify that the new redo data was received and archived.

    SQL> @query_archived_log SQL> SET echo ON SQL> SELECT sequence#, first_time, next_time 2 FROM v$archived_log 3 ORDER BY sequence# 4 / SEQUENCE# FIRST_TIM NEXT_TIME ---------- --------- --------- 12 09-FEB-10 09-FEB-10 13 09-FEB-10 09-FEB-10 14 09-FEB-10 09-FEB-10 15 09-FEB-10 09-FEB-10 16 09-FEB-10 09-FEB-10 17 09-FEB-10 09-FEB-10 6 rows selected.

  • Practice 2-3: Verifying That the Physical Standby Database Is Performing Correctly (continued)

    Oracle Database 11g: Data Guard Administration A - 30

    4) On the standby database, verify that the new archived redo log files were applied. You can use the query_applied_log.sql file. SQL> @query_applied_log SQL> SET echo ON SQL> SELECT sequence#, applied 2 FROM v$archived_log 3 / SEQUENCE# APPLIED ---------- --------- 13 YES 12 YES 14 YES 15 YES 16 YES 17 IN-MEMORY 6 rows selected. SQL>

  • Oracle Database 11g: Data Guard Administration A - 31

    Practices for Lesson 3: Oracle Data Guard Broker: Overview

    There are no practices for Lesson 3, Oracle Data Guard Broker: Overview.

  • Oracle Database 11g: Data Guard Administration A - 32

    Practices for Lesson 4: Creating a Data Guard Broker Configuration

    In the practices for Lesson 4, Creating a Data Guard Broker Configuration, you create a broker configuration.

  • Oracle Database 11g: Data Guard Administration A - 33

    Practice 4-1: Setting the DG_BROKER_START Initialization Parameter In this practice, you set the DG_BROKER_START initialization parameter to TRUE for your primary database and physical standby database.

    1) Invoke SQL*Plus on your primary database system. Connect to your primary database as the SYSDBA user and check the value of DG_BROKER_START. [oracle@EDBVR6P1-pc01prmy labs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 18:43:41 2010 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> show parameter dg_broker_start NAME TYPE VALUE ------------------------------------ ----------- ------------- dg_broker_start boolean FALSE

    2) Set the DG_BROKER_START parameter to TRUE. SQL> alter system set dg_broker_start=true; System altered. SQL> show parameter dg_broker_start NAME TYPE VALUE ------------------------------------ ----------- ------------- dg_broker_start boolean TRUE

    3) Open a terminal window for the system that your standby database is on. Use the oraenv utility to set the environment variables for your standby database. The oraenv utility requires that the /etc/oratab file includes an entry for the standby database. Invoke SQL*Plus on your standby database system. Connect to your physical standby database as the SYSDBA user and check the value of DG_BROKER_START. [oracle@EDBVR6P1-pc01prmy ~]$ ssh edbvr6p2 oracle@edbvr6p2's password: oracle Last login: Tue Feb 9 18:34:04 2010 from edbvr6p1.us.oracle.com

  • Practice 4-1: Setting the DG_BROKER_START Initialization Parameter (continued)

    Oracle Database 11g: Data Guard Administration A - 34

    [oracle@EDBVR6P2- ~]$ . oraenv ORACLE_SID = [oracle] ? pc01sby1 The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle [oracle@EDBVR6P2-pc01sby1 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 18:47:04 2010 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> show parameter dg_broker_start NAME TYPE VALUE ------------------------------------ ----------- ------------ dg_broker_start boolean FALSE SQL>

    4) Set the value of DG_BROKER_START to TRUE on your standby database. SQL> alter system set dg_broker_start=true; System altered. SQL> show parameter dg_broker_start NAME TYPE VALUE ------------------------------------ ----------- ------------- dg_broker_start boolean TRUE SQL> exit

  • Oracle Database 11g: Data Guard Administration A - 35

    Practice 4-2: Configuring Listener to Allow Data Guard Broker to Restart Primary Database Instance Server Setup In this practice, you define a listener service for the primary database that includes the db_unique_name_DGMGRL.db_domain values for GLOBAL_DBNAME. Note: Be sure to verify the information that you enter into fields in Oracle Net Manager before proceeding to the next page.

    1) Open a terminal window to the system that your primary database is on. Set the environment variables for the Grid Infrastructure (ASM instance and default listener).

    [oracle@EDBVR6P1-pc01prmy labs]$ . oraenv ORACLE_SID = [pc01prmy] ? +ASM The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is /u01/app/oracle

    2) Launch Oracle Net Manager.

    [oracle@EDBVR6P1-+ASM labs]$ netmgr 3) Expand Local. 4) Expand Listeners. 5) Select LISTENER. 6) Select Database Services in the list. 7) Click Add Database.

    8) Enter pcprmy_DGMGRL.us.oracle.com in the Global Database Name field. You will need to override the value for the Oracle Home Directory. You are editing the networking files in the /u01/app/oracle/product/11.2.0/grid/network/admin directory, but the database is in /u01/app/oracle/product/11.2.0/dbhome_1/. Enter pcprmy in the SID field.

    9) Select File > Save Network Configuration. 10) Select File > Exit. 11) Shut down the listener. Restart the listener.

    [oracle@EDBVR6P1-+ASM labs]$ lsnrctl stop

  • Practice 4-2: Configuring Listener to Allow Data Guard Broker to Restart Primary Database Instance Server Setup (continued)

    Oracle Database 11g: Data Guard Administration A - 36

    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 09-FEB-2010 18:51:34 Copyright (c) 1991, 2009, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p1.us.oracle.com)(PORT=12001))) The command completed successfully [oracle@EDBVR6P1-+ASM labs]$ lsnrctl start LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-FEB-2010 09:52:05 Copyright (c) 1991, 2009, Oracle. All rights reserved. Starting /u01/app/oracle/product/11.2.0/grid/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.1.0 - Production System parameter file is /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora Log messages written to /u01/app/oracle/diag/tnslsnr/EDBVR6P1/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p1.us.oracle.com)(PORT=1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 22-FEB-2010 09:52:06 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/EDBVR6P1/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

  • Practice 4-2: Configuring Listener to Allow Data Guard Broker to Restart Primary Database Instance Server Setup (continued)

    Oracle Database 11g: Data Guard Administration A - 37

    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p1.us.oracle.com)(PORT=1521))) Services Summary... Service "pc01prmy_DGMGRL.us.oracle.com" has 1 instance(s). Instance "pc01prmy", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully [oracle@EDBVR6P1-+ASM labs]$

  • Practice 4-2: Configuring Listener to Allow Data Guard Broker to Restart Primary Database Instance Server Setup (continued)

    Oracle Database 11g: Data Guard Administration A - 38

    12) Ensure that your listener.ora file contains entries similar to the following: [oracle@EDBVR6P1-+ASM labs]$ cat $ORACLE_HOME/network/admin/listener.ora # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = pc01prmy_DGMGRL.us.oracle.com) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1) (SID_NAME = pc01prmy) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = edBVr6p1.us.oracle.com)(PORT = 1521)) ) ) ADR_BASE_LISTENER = /u01/app/oracle ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON

  • Oracle Database 11g: Data Guard Administration A - 39

    Practice 4-3: Configuring Listener to Allow Data Guard Broker to Restart Standby Database Instance Server Setup In this practice, you define a listener service for the standby database that includes the db_unique_name_DGMGRL.db_domain value for GLOBAL_DBNAME. Note: Be sure to verify the information you enter into fields in Oracle Net Manager before proceeding to the next page.

    1) Open a terminal window to the system that your standby database is on. Launch Oracle Net Manager.

    [oracle@EDBVR6P1-pc01prmy labs]$ xhost + access control disabled, clients can connect from any host [oracle@EDBVR6P1-pc01prmy labs]$ ssh edbvr6p2 oracle@edbvr6p2's password: oracle Last login: Tue Feb 9 18:46:41 2010 from edbvr6p1.us.oracle.com [oracle@EDBVR6P2- ~]$ . oraenv ORACLE_SID = [oracle] ? pc01sby1 The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle [oracle@EDBVR6P2-pc01sby1 ~]$ export DISPLAY=edbvr6p1:2 [oracle@EDBVR6P2-pc01sby1 ~]$ netmgr

    2) Expand Local. 3) Expand Listeners. 4) Select LISTENER1. 5) Select Database Services in the list. 6) Click Add Database.

    7) Enter pcsby1_DGMGRL.us.oracle.com in the Global Database Name field. Accept the default value for the Oracle Home Directory. Enter pcsby1 in the SID field.

  • Practice 4-3: Configuring Listener to Allow Data Guard Broker to Restart Standby Database Instance Server Setup (continued)

    Oracle Database 11g: Data Guard Administration A - 40

    8) Select File > Save Network Configuration. 9) Select File > Exit.

    10) Shut down the LISTENER1 listener. Restart the LISTENER1 listener. [oracle@EDBVR6P2-pc01sby1 ~]$ lsnrctl stop listener1 LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 09-FEB-2010 18:57:51 Copyright (c) 1991, 2009, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p2.us.oracle.com)(PORT=12001))) The command completed successfully [oracle@EDBVR6P2-pc01sby1 ~]$ lsnrctl start listener1 LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 09-FEB-2010 18:57:59 Copyright (c) 1991, 2009, Oracle. All rights reserved. Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.1.0 - Production System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

  • Practice 4-3: Configuring Listener to Allow Data Guard Broker to Restart Standby Database Instance Server Setup (continued)

    Oracle Database 11g: Data Guard Administration A - 41

    Log messages written to /u01/app/oracle/diag/tnslsnr/EDBVR6P2/listener1/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p2.us.oracle.com)(PORT=12001))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbvr6p2.us.oracle.com)(PORT=12001))) STATUS of the LISTENER ------------------------ Alias listener1 Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 09-FEB-2010 18:57:59 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/EDBVR6P2/listener1/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edBVr6p2.us.oracle.com)(PORT=12001))) Services Summary... Service "pc01sby1.us.oracle.com" has 1 instance(s). Instance "pc01sby1", status UNKNOWN, has 1 handler(s) for this service... Service "pc01sby1_DGMGRL.us.oracle.com" has 1 instance(s). Instance "pc01sby1", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully [oracle@EDBVR6P2-pc01sby1 ~]$

    11) Ensure that your listener.ora file (in $ORACLE_HOME/network/admin) contains entries similar to the following:

    [oracle@EDBVR6P2-pc01sby1 ~]$ cat $ORACLE_HOME/network/admin/listener.ora # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome _1/network/admin/listener.ora # Generated by Oracle configuration tools. LISTENER1 = (DESCRIPTION =

  • Practice 4-3: Configuring Listener to Allow Data Guard Broker to Restart Standby Database Instance Server Setup (continued)

    Oracle Database 11g: Data Guard Administration A - 42

    (ADDRESS = (PROTOCOL = TCP)(HOST = edbvr6p2.us.oracle.com)(PORT = 12001)) ) SID_LIST_LISTENER1 = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = pc01sby1.us.oracle.com) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1) (SID_NAME = pc01sby1) ) (SID_DESC = (GLOBAL_DBNAME = pc01sby1_DGMGRL.us.oracle.com) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1) (SID_NAME = pc01sby1) ) ) ADR_BASE_LISTENER1 = /u01/app/oracle

  • Oracle Database 11g: Data Guard Administration A - 43

    Practice 4-4: Creating an Oracle Net Service Name to Allow Standby Database Instance to Connect to Primary Database Instance Client Setup In this practice, you define an Oracle Net service name for the primary database on the system on which your physical standby database is created. Note: Be sure to verify the information you enter into fields in Oracle Net Manager before proceeding to the next page.

    1) On the system on which your physical standby database is created, invoke Oracle Net Manager.

    2) Expand Local. Select Service Naming and click the green plus sign in the left navigation pane.

    3) Enter pcprmy in the Net Service Name field and click Next.

    4) Select TCP/IP (Internet Protocol) and click Next. 5) Enter the fully qualified host name of the machine that your primary database is on

    with a port number of 1521 and click Next. The screenshot shows an example. Be sure to enter the host name that you are using.

  • Practice 4-4: Creating an Oracle Net Service Name to Allow Standby Database Instance to Connect to Primary Database Instance Client Setup (continued)

    Oracle Database 11g: Data Guard Administration A - 44

    6) Enter pcprmy.us.oracle.com in the Service Name field and click Next.

    7) Click Finish. 8) Select File > Save Network Configuration to save the information to the

    tnsnames.ora file.

  • Practice 4-4: Creating an Oracle Net Service Name to Allow Standby Database Instance to Connect to Primary Database Instance Client Setup (continued)

    Oracle Database 11g: Data Guard Administration A - 45

    9) Exit Oracle Net Manager.

    10) Ensure that your tnsnames.ora file has entries similar to the following: [oracle@EDBVR6P2-pc01sby1 ~]$ cat $ORACLE_HOME/network/admin/tnsnames.ora # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome _1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. PC02PRMY = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = edbvr6p2.us.oracle.com)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pc02prmy.us.oracle.com) ) ) PC01PRMY = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = edbvr6p1.us.oracle.com)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = pc01prmy.us.oracle.com) ) ) PC02DB11 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = edbvr6p2.us.oracle.com)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pc02db11.us.oracle.com) ) ) [oracle@EDBVR6P2-pc01sby1 ~]$

  • Oracle Database 11g: Data Guard Administration A - 46

    Practice 4-5: Creating an Oracle Net Service Name for the Standby Database for Non-Standard Dynamic Registration In this practice, you define an Oracle Net service name for the standby database on the system on which the standby database is created. Note: Be sure to verify the information you enter into fields in Oracle Net Manager before proceeding to the next page.

    1) On the system on which your physical standby database is created, invoke Oracle Net Manager.

    2) Expand Local. Select Service Naming and click the green plus sign.

    3) Enter pcsby1 in the Net Service Name field and click Next.

    4) Select TCP/IP (Internet Protocol) and click Next. 5) Enter the fully qualified host name of the machine that your physical standby

    database is on. Change the port number to 12001. Click Next.

  • Practice 4-5: Creating an Oracle Net Service Name for the Standby Database for Non-Standard Dynamic Registration (continued)

    Oracle Database 11g: Data Guard Administration A - 47

    6) Enter pcsby1.us.oracle.com in the Service Name field and click Next.

    7) Click Finish. 8) Select File > Save Network Configuration to save the information to the

    tnsnames.ora file. 9) Exit Oracle Net Manager.

  • Practice 4-5: Creating an Oracle Net Service Name for the Standby Database for Non-Standard Dynamic Registration (continued)

    Oracle Database 11g: Data Guard Administration A - 48

    10) Ensure that your tnsnames.ora file has entries similar to the following: [oracle@EDBVR6P2-pc01sby1 ~]$ cat $ORACLE_HOME/network/admin/tnsnames.ora # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. PC02PRMY = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = edbvr6p2.us.oracle.com)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pc02prmy.us.oracle.com) ) ) PC01PRMY = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = edbvr6p1.us.oracle.com)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = pc01prmy.us.oracle.com) ) ) PC02DB11 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = edbvr6p2.us.oracle.com)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pc02db11.us.oracle.com) ) ) PC01SBY1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = edbvr6p2.us.oracle.com)(PORT = 12001))

  • Practice 4-5: Creating an Oracle Net Service Name for the Standby Database for Non-Standard Dynamic Registration (continued)

    Oracle Database 11g: Data Guard Administration A - 49

    ) (CONNECT_DATA = (SERVICE_NAME = pc01sby1.us.oracle.com) ) ) [oracle@EDBVR6P2-pc01sby1 ~]$

    11) Invoke SQL*Plus for your physical standby database and set the LOCAL_LISTENER parameter to pcsby1. Be sure to set the ORACLE_SID environment variable to pcsby1 before invoking SQL*Plus. [oracle@EDBVR6P2-pc01sby1 ~]$ echo $ORACLE_SID pc01sby1 [oracle@EDBVR6P2-pc01sby1 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 9 19:14:59 2010 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> alter system set local_listener=pc01sby1; System altered. SQL> exit

  • Oracle Database 11g: Data Guard Administration A - 50

    Practice 4-6: Creating the Broker Configuration In this practice, you create a Data Guard broker configuration.

    1) On your primary database system, invoke DGMGRL and connect to your primary database.

    [oracle@EDBVR6P1-pc01prmy labs]$ dgmgrl DGMGRL for Linux: Version 11.2.0.1.0 - Production Copyright (c) 2000, 2009, Oracle. All rights reserved. Welcome to DGMGRL, type "help" for information. DGMGRL> connect sys/oracle_4U Connected. DGMGRL>

    2) Create a broker configuration named DGConfig1 and include a profile for the primary database.

    DGMGRL> create configuration 'DGConfig1' as > primary database is 'pc01prmy' > connect identifier is pc01prmy; Configuration "DGConfig1" created with primary database "pc01prmy" DGMGRL>

    3) Display information about the configuration.

    DGMGRL> show configuration Configuration - DGConfig1 Protection Mode: MaxPerformance Databases: pc01prmy - Primary database Fast-Start Failover: DISABLED Configuration Status: DISABLED DGMGRL>

    4) Add your physical standby database to the broker configuration.

    DGMGRL> add database 'pc01sby1' as > connect identifier is pc01sby1; Database "pc01sby1" added DGMGRL>

  • Practice 4-6: Creating the Broker Configuration (continued)

    Oracle Database 11g: Data Guard Administration A - 51

    5) Verify that the pcsby1 database was added to the configuration. DGMGRL> show configuration Configuration - DGConfig1 Protection Mode: MaxPerformance Databases: pc01prmy - Primary database pc01sby1 - Physical standby database Fast-Start Failover: DISABLED Configuration Status: DISABLED DGMGRL>

  • Oracle Database 11g: Data Guard Administration A - 52

    Practice 4-7: Enabling the Broker Configuration In this practice, you enable the broker configuration.

    1) Enable the entire configuration.

    DGMGRL> enable configuration; Enabled.

    2) Verify that the configuration was successfully enabled. If you receive a warning message (WARNING: ORA-16610 Set Property in Progress) or (WARNING: ORA-16610 Command "Broken automatic health check" in Progress), wait for a few minutes and issue the SHOW CONFIGURATION command again. DGMGRL> show configuration Configuration - DGConfig1 Protection Mode: MaxPerformance Databases: pc01prmy - Primary database pc01sby1 - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS DGMGRL> exit [oracle@EDBVR6P1-pc01prmy labs]$

    Note: If you receive one of the following messages Warning: ORA-16607: one or more databases have failed or Warning: ORA-16792: configurable property value is inconsistent with database setting, you may need to restart one or both of your database instances. Discuss your situation with your course instructor.

  • Oracle Database 11g: Data Guard Administration A - 53

    Practices for Lesson 5: Creating a Physical Standby Database by Using Enterprise Manager Grid Control

    In the practices for Lesson 5, Creating a Physical Standby Database by Using Enterprise Manager Grid Control, you use Enterprise Manager Grid Control to create a physical standby database.

  • Oracle Database 11g: Data Guard Administration A - 54

    Practice 5-1: Installing the Oracle Management Agent In this practice, you install the Oracle Management Agent so that you can use Enterprise Manager Grid Control. The Oracle Management Agent was installed with Enterprise Manager 10.2.0.1.0 on the Grid Control Server, and then the 10.2.0.5.0 patch was applied to AGENT_HOME along with the agent merge patch 9138201. You will be using the cloning technique to install the Oracle Management Agent on your machine. The entire AGENT_HOME from a successful installation of the Grid Control Server has been compressed and stored in the /stage/10.2.0.5.0/agent directory on your machine. Your instructor will provide the name of the machine that Enterprise Manager Grid Control is installed on. Record the name of the machine here and in step 7: ______________________________________________________________________

    1) On your primary database host machine, open a terminal window and log on as the oracle user with a password of oracle. Verify that you have not set environment variables such as ORACLE_HOME or ORACLE_SID pointed to the database software. Use the "unset ORACLE_HOME" command to remove them. [oracle@EDBVR6P1- ~]$ set | grep ORA ORACLE_BASE=/u01/app/oracle PS1='[\u@\h-`echo $ORACLE_SID` \W]$ '

    2) Change directories to the root ( / ) file system and uncompress the stage Oracle Management Agent software. Note: You must be in the root ( / ) file system to ensure that the uncompressed software goes into the correct directories.

    [oracle@EDBVR6P1- ~]$ cd / [oracle@EDBVR6P1- /]$ tar zxvf /stage/10.2.0.5.0/agent/agent.tar.gz .. .. u01/app/oracle/OracleHomes/agent10g/rdbms/install/ u01/app/oracle/OracleHomes/agent10g/rdbms/install/sbs/ u01/app/oracle/OracleHomes/agent10g/rdbms/install/sbs/olsadmintool.sbs u01/app/oracle/OracleHomes/agent10g/rdbms/install/sbs/olsoidsync.sbs [oracle@EDBVR6P1- /]$

    3) Remove all files in the upload and state directories for the cloned Oracle Management Agent. You can use the clean_agent_dir.sh script to perform this step. [oracle@EDBVR6P1- /]$ cd $HOME/labs [oracle@EDBVR6P1- labs]$ ./clean_agent_dirs.sh rm: cannot remove `/u01/app/oracle/OracleHomes/agent10g/sysman/emd/state/storage': Is a directory or you may execute the individual commands

  • Practice 5-1: Installing the Oracle Management Agent (continued)

    Oracle Database 11g: Data Guard Administration A - 55

    [oracle@EDBVR6P1- /]$ rm /u01/app/oracle/OracleHomes/agent10g/sysman/emd/upload/* [oracle@EDBVR6P1- /]$ [oracle@EDBVR6P1- /]$ rm /u01/app/oracle/OracleHomes/agent10g/sysman/emd/state/* rm: cannot remove `/u01/app/oracle/OracleHomes/agent10g/sysman/emd/state/storage': Is a directory [oracle@EDBVR6P1- /]$

    4) Use the Oracle Universal Installer to perform the clone installation of the Oracle Management Agent. You can use the oui_agent.sh script to perform this step: [oracle@EDBVR6P1- labs]$ ./oui_agent.sh Or you may execute the individual command [oracle@EDBVR6P1- /]$ /u01/app/oracle/OracleHomes/agent10g/oui/bin/runInstaller -clone -forceClone ORACLE_HOME=/u01/app/oracle/OracleHomes/agent10g ORACLE_HOME_NAME=OHOME1 -noconfig silent b_chainedInstall=false oracle.sysman.top.agent:s_installType=AGENT .. .. .. -------------------------------------- The cloning of OHOME1 was successful. Please check '/u01/app/oraInventory/logs/cloneActions2010-02-09_07-29-41PM.log' for more details.

    5) Use a text editor to modify the emd.properties file and change the URL for the Grid Control Server to the one used in the classroom. Your instructor can provide you with the address. You can turn on line numbers in the vi utility with the command ":set number". Change the value of REPOSITORY_URL (around line number 34) and emdWalletSrcUrl (around line number 158) to the Grid Control Server address provided by your instructor. Save your changes after editing the file.

    [oracle@EDBVR6P1- labs]$ vi /u01/app/oracle/OracleHomes/agent10g/sysman/config/emd.properties .. 33 # 34 REPOSITORY_URL=http://vx0326.us.oracle.com:4889/em/upload 35 .. .. 157 # 158 emdWalletSrcUrl = http://vx0326.us.oracle.com:4889/em/wallets/emd

  • Practice 5-1: Installing the Oracle Management Agent (continued)

    Oracle Database 11g: Data Guard Administration A - 56

    159 emdWalletDest = /u01/app/oracle/OracleHomes/agent10g/sysman/config/server

    6) Run the root.sh script from the Oracle home directory of the Management Agent. Note: Do not overwrite the files in the /usr/local/bin directory because the versions in the Agent home are 10g versions, and the installed scripts are 11g versions.

    [oracle@EDBVR6P1- labs]$ su - Password: oracle [root@EDBVR6P1 ~]# /u01/app/oracle/OracleHomes/agent10g/root.sh Running Oracle10 root.sh script... The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/oracle/OracleHomes/agent10g Enter the full pathname of the local bin directory: [/usr/local/bin]: The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: 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.sh script. Now product-specific root actions will be performed. Finished product-specific root actions. Finished product-specific root actions. [root@EDBVR6P1 ~]# exit

    7) Run the Agent Configuration Assistant utility (agentca) with the reconfigure option (-f). [oracle@EDBVR6P1- labs]$ /u01/app/oracle/OracleHomes/agent10g/bin/agentca f Stopping the agent using /u01/app/oracle/OracleHomes/agent10g/bin/emctl stop agent Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.

  • Practice 5-1: Installing the Oracle Management Agent (continued)

    Oracle Database 11g: Data Guard Administration A - 57

    Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved. Running agentca using /u01/app/oracle/OracleHomes/agent10g/oui/bin/runConfig.sh ORACLE_HOME=/u01/app/oracle/OracleHomes/agent10g ACTION=Configure MODE=Perform RESPONSE_FILE=/u01/app/oracle/OracleHomes/agent10g/response_file RERUN=TRUE INV_PTR_LOC=/u01/app/oracle/OracleHomes/agent10g/oraInst.loc COMPONENT_XML={oracle.sysman.top.agent.10_2_0_1_0.xml} Perform - mode is starting for action: Configure Perform - mode finished for action: Configure You can see the log file: /u01/app/oracle/OracleHomes/agent10g/cfgtoollogs/oui/configActions2010-02-09_07-34-56-PM.log [oracle@EDBVR6P1- labs]$

    8) Set up the environment variables for the Agent home and secure the agent. The /usr/local/bin/agent.env script has been provided to assist in setting the environment variables.

    [oracle@EDBVR6P1- labs]$ . agent.env [oracle@EDBVR6P1- labs]$ emctl secure agent Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0. Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved. Agent successfully stopped... Done. Securing agent... Started. Enter Agent Registration Password : oracle1 Agent successfully restarted... Done. Securing agent... Successful. [oracle@EDBVR6P1- labs]$

    9) Verify that the agent is running. Continue to reexecute the 'emctl status agent' command until Number of XML files pending upload goes to zero.

    [oracle@EDBVR6P1- labs]$ emctl status agent Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0. Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved. --------------------------------------------------------------- Agent Version : 10.2.0.5.0 OMS Version : 10.2.0.5.0 Protocol Version : 10.2.0.5.0

  • Practice 5-1: Installing the Oracle Management Agent (continued)

    Oracle Database 11g: Data Guard Administration A - 58

    Agent Home : /u01/app/oracle/OracleHomes/agent10g Agent binaries : /u01/app/oracle/OracleHomes/agent10g Agent Process ID : 31034 Parent Process ID : 31014 Agent URL : https://edBVr6p1.us.oracle.com:3872/emd/main/ Repository URL : https://vx0326.us.oracle.com:1159/em/upload Started at : 2010-04-06 18:16:43 Started by user : oracle Last Reload : 2010-04-06 18:16:43 Last successful upload : 2010-04-06 18:19:23 Total Megabytes of XML files uploaded so far : 10.49 Number of XML files pending upload : 0 Size of XML files pending upload(MB) : 0.00 Available disk space on upload filesystem : 59.61% Last successful heartbeat to OMS : 2010-04-06 18:18:47 --------------------------------------------------------------- Agent is Running and Ready

  • Oracle Database 11g: Data Guard Administration A - 59

    Practice 5-2: Configuring Monitoring Credentials for Your Primary Database In this practice, you configure monitoring credentials for your primary database. 1) Open your browser and invoke Enterprise Manager by entering the following URL:

    http://:4889/em 2) Log in to Enterprise Manager Grid Control with a username of SYSMAN and

    password of oracle1. 3) The Grid Control home page appears. Click the Targets tab. 4) The Hosts page appears. Ensure that your primary database host appears in the list.

    Click Databases. 5) The Databases page appears. Select the Search List option. Select your primary

    database from the list of databases (by clicking the option button and not the database name link) and click Configure.

    6) Select sysdba in the Role list. Enter sys in the Monitor Username field. Enter oracle_4U in the Monitor Password field. Click Test Connection.

    7) After you receive a message that the connection test was successful, click Next. 8) The Configure Database Instance: Review page appears. Click Submit on this page. 9) A page displays the message Target saving is in progress. 10) You receive a message that the properties were updated. Click OK. 11) The Databases page is updated with the status for your configured database. Ensure

    that the status for your database is Up before proceeding to the next practice.

    12) Repeat steps 5 through 11 for the pcdb11 database.

  • Oracle Database 11g: Data Guard Administration A - 60

    Practice 5-3: Configuring Monitoring Credentials for Your Standby Database In this practice, you configure credentials for monitoring your standby database. Note: Before beginning this practice, you must confirm that the Oracle Management Agent is successfully installed on your standby database host. 1) On the Databases page, select your standby database (by clicking the option button)

    and click Configure.

    2) Select SYSDBA in the Role list. Enter sys in the Monitor Username field and oracle_4U in the Monitor Password field. Enter 12001 in the Port field.

    3) Click Test Connection. You should receive a message indicating that the connection test was successful. Click Next.

    4) On the Configure Database Instance: Review page, click Submit. A page displays the message Target saving is in progress.

    5) The Database Instance Configuration Result page appears. Click OK. 6) You are returned to the Databases page. Ensure that the status for your database is

    Up before proceeding to the next practice."

  • Oracle Database 11g: Data Guard Administration A - 61

    Practice 5-4: Configuring Preferred Credentials for Your Host Machine In this practice, you configure the preferred credentials for your host machine.

    1) On the home page, click Preferences at the top-right corner of the page. 2) Click Preferred Credentials from the Preferences menu. 3) Click the Set Credentials Icon for the Host Target Type. 4) Under the Target Credentials sections, enter the following for your primary database

    host machine:

    a) Normal Username: oracle b) Normal Password: oracle c) Privileged Username: root d) Privileged Password: oracle

    5) Click Test to verify the credentials. 6) Click Apply to save the credentials if verification was successful.

  • Oracle Database 11g: Data Guard Administration A - 62

    Practice 5-5: Adding a Physical Standby Database to Your Configuration In this practice, you add a new physical standby database to your configuration by using Enterprise Manager Grid Control. Note: The agent must be running on your standby host machine before you can continue with this step! 1) Select your primary database by clicking the link on the Databases page. 2) Click Availability. Select Setup and Manage in the Data Guard section of the

    Availability page.

    3) Enter database login credentials (sys/oracle_4U as sysdba) if requested. Click on the box to save as preferred credentials.

    4) Click Add Standby Database.

    5) On the Add Standby Database page, select Create a new physical standby database

    and click Continue.

  • Practice 5-5: Adding a Physical Standby Database to Your Configuration (continued)

    Oracle Database 11g: Data Guard Administration A - 63

    6) On the Add Standby Database: Backup Type page, select Perform an online backup

    of the primary database with Use Recovery Manager (RMAN) to copy datafiles, and click Next.

  • Practice 5-5: Adding a Physical Standby Database to Your Configuration (continued)

    Oracle Database 11g: Data Guard Administration A - 64

    7) On the Add Standby Database: Backup Options page, accept the default number of Concurrent File Copy Processes. Enter the Primary Host Credentials (Username: oracle and Password: oracle) and select Save as Preferred Credential. Click Next.

    8) On the Add Standby Database: Database Location page, enter pcsby2 in the

    Instance Name field. Select the same host that you used for your other physical standby database using the flashlight icon. Select the Oracle Database software home and not the Grid Infrastructure software home. Enter the Standby Host Credentials (Username: oracle and Password: oracle) if needed, and select Save as Preferred Credential. Click Next.

  • Practice 5-5: Adding a Physical Standby Database to Your Configuration (continued)

    Oracle Database 11g: Data Guard Administration A - 65

    9) On the Add Standby Database: ASM Instance Login page, enter the SYS password

    for the ASM instance on the standby host (Password: oracle_4U) and click Login.

  • Practice 5-5: Adding a Physical Standby Database to Your Configuration (continued)

    Oracle Database 11g: Data Guard Administration A - 66

    10) In the Standby Database File Locations section, select the SBDAT ASM disk group

    for the Database Area using the flashlight icon. Select the SBFRA ASM disk group for the Flash Recovery Area using the flashlight icon. Leave all other settings at the default value and click Next.

  • Practice 5-5: Adding a Physical Standby Database to Your Configuration (continued)

    Oracle Database 11g: Data Guard Administration A - 67

    11) On the Add Standby Database Configuration page, enter pcsby2 in the

    Database Unique Name and Target Name fields. Select Use SYSDBA monitoring credentials and click Next.

  • Practice 5-5: Adding a Physical Standby Database to Your Configuration (continued)

    Oracle Database 11g: Data Guard Administration A - 68

  • Practice 5-5: Adding a Physical Standby Database to Your Configuration (continued)

    Oracle Database 11g: Data Guard Administration A - 69

    12) On the Add Standby Database Review page, review the information about the standby database to be created. If you are satisfied with the configuration information, click Finish or click Back to make changes. The Processing: Add Standby Database page appears.

    Note: If Enterprise Manager remains on this page for more than 10 minutes, click the Jobs tab to verify that the job is started.

  • Practice 5-5: Adding a Physical Standby Database to Your Configuration (continued)

    Oracle Database 11g: Data Guard Administration A - 70

    13) You are returned to the Data Guard Overview page. Select Real Time: 1 Minute

    Refresh in the View Data list to easily view the progress of standby database creation. You can also click the Creation in progress link to monitor standby database creation.

  • Practice 5-5: Adding a Physical Standby Database to Your Configuration (continued)

    Oracle Database 11g: Data Guard Administration A - 71

    14) After the standby database creation is completed, note that the new physical standby database is listed in the Standby Databases section.

  • Oracle Database 11g: Data Guard Administration A - 72

    Practice 5-6: Verifying the Broker Configuration In this practice, you use Enterprise Manager Grid Control to verify your configuration.

    1) In the Additional Administration section of the Data Guard Overview page, click Verify Configuration. The Processing: Verify page is displayed. The Processing: Verify Completed page displays the results of the verify operation.