Monday, August 1, 2011

Oracle Data Guard Broker


Data Guard Broker

Creating the data guard broker for primary database(orcl1) and standby database(orcl2):
Prerequisite: Both the physical database and standby database must exist before dataguard broker can be  setup
1. Enable Data Guard Broker in both database:
SQL> sqlplus sys/oracle@orcl1 as sysdba
SQL> ALTER SYSTEM SET DG_BROKER_START=TRUE
SQL> sqlplus sys/oracle@orcl1 as sysdba
SQL> ALTER SYSTEM SET DG_BROKER_START=TRUE
2. Edit the listener.ora on the primary database so that it has the following entry:
(SID_DESC =
        (GLOBAL_DBNAME = orcl1_dgmgrl)
        (ORACLE_HOME = /u01/oracle/product/11.1.0/db_1)
        (SID_NAME = orcl2)
        )
3. Edit the listener.ora on the standby database so that it has the following entry:
(SID_DESC =
        (GLOBAL_DBNAME = orcl2_dgmgrl)
        (ORACLE_HOME = /u01/oracle/product/11.1.0/db_1)
        (SID_NAME = orcl2)
        )

4. Connect to DGMGRL and create the configuration file:
$ DGMGRL
DGMGRL> CREATE CONFIGURATION ‘orcldgbrkr’
> AS
> PRIMARY DATABASE IS ‘orcl1’
> CONNECT IDENTIFIER IS ‘orcl1’
;

DGMGRL> SHOW CONFIGURATION
5. Add the standby database in the dataguard broker configuration:
DGMGRL> ADD DATABASE ‘orcl2’
> AS
> CONNECT IDENTIFIER IS ‘orcl2’
>;
DGMGRL> SHOW CONFIGURATION
6. Enable the configuration:
DGMGRL> Enable Configuration
DGMGRL> SHOW CONFIGURATION
7. View the details of the primary and standby database:
DGMGRL> show database orcl1
DGMGRL> show database orcl2
To show additional details:
DGMGRL> show database verbose orcl1
DGMGRL> show database verbose orcl2
8. To perform a switchover:
DGMGRL>switchover to ‘orcl2’

Tuesday, July 12, 2011

Starting up Oracle Grid Control and services

[oracle@grid ~] $ cd  /u01/app/oracle/product/10.2.0/db10g/bin/
[oracle@grid bin] $ ./lsnrctl start
[oracle@grid bin] $ ./sqlplus / as sysdba
SQL> startup

[oracle@grid bin] $ cd /u01/app/oracle/product/10.2.0/oms10g/opmn/bin/
[oracle@grid bin] $ ./opmnctl stsrtsll
[oracle@grid bin] $ cd ../../bin/
[oracle@grid bin] $ ./emctl start iasconsole
[oracle@grid bin] $ ./emctl start oms

[oracle@grid bin] $ cd /u01/app/oracle/product/10.2.0/agent10g/bin/
[oracle@grid bin] $ ./emctl start agent

Securing the agent

Sometimes the agent fails to upload agent information in the Grid Control and the status in the Grid Control for the agent shows the status Agent Unreachable.





So I connected to the client $AGENTHOME/bin and tried to upload the agent data:



[oracle@host1 bin]$ ./emctl upload agent
Oracle Enterprise Manager 10g Release 10.2.0.1.0.
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
EMD upload error: uploadXMLFiles skipped :: OMS version not checked yet..

I checked the status of the agent and it was running.

 


After googling it a bit I found out that I should secure the agent in order for the upload process to work.

So I stopped the agent ./emctl stop agent and executed the ./emctl secure agent command. To my surprise it came up with another error:


[oracle@host1 ~]$ cd /u01/app/oracle/OracleHomes/agent10g/bin/
[oracle@host1 bin]$ ./emctl secure agent
Oracle Enterprise Manager 10g Release 10.2.0.1.0.
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
Enter Agent Registration password :
Agent is already stopped...   Done.
Securing agent...   Started.
Requesting an HTTPS Upload URL from the OMS...   Failed.
The OMS is not set up for Enterprise Manager Security.

 Hence I went to the OMS_HOME and secured the oms:
[oracle@host1 bin]$ cd $OMS_HOME/bin
[oracle@host1 bin]$ ./emctl secure oms
which succeeded without any issue.

Then I came back to the AGENT_HOME and stopped it and then cleared its state:
[oracle@host1 bin]$ cd $AGENT_HOME/bin
[oracle@host1 bin]$ ./emctl clearstate agent
Oracle Enterprise Manager 10g Release 10.2.0.1.0.
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
EMD clearstate completed successfully


Now I tried to secure the agent again

[oracle@host1 bin]$ ./emctl secure agent
Oracle Enterprise Manager 10g Release 10.2.0.1.0.
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
Enter Agent Registration password :
Agent is already stopped...   Done.
Securing agent...   Started.
Requesting an HTTPS Upload URL from the OMS...   Done.
Requesting an Oracle Wallet and Agent Key from the OMS...   Done.
Check if HTTPS Upload URL is accessible from the agent...   Done.
Configuring Agent for HTTPS in CENTRAL_AGENT mode...   Done.
EMD_URL set in /u01/app/oracle/OracleHomes/agent10g/sysman/config/emd.propertiesSecuring agent...   Successful

And vol la  it was successful.


Now I was sure that the upload will work so I started up the agent and executed command to upload the agent data and guess what it threw another error:

[oracle@host1 bin]$ ./emctl upload agent
Oracle Enterprise Manager 10g Release 10.2.0.1.0.
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
EMD upload error: Upload timedout before completion


So I went back and cleared the state of the agent AGAIN:

[oracle@host1 bin]$ ./emctl clearstate agent
Oracle Enterprise Manager 10g Release 10.2.0.1.0.
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
EMD clearstate completed successfully



And tried to upload the agent data:

[oracle@host1 bin]$ ./emctl upload agent
Oracle Enterprise Manager 10g Release 10.2.0.1.0.
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
EMD upload completed successfully
 

 And yes it was successful.


In order to confirm I went back and checked the status of the agent in the grid control and after five or six minutes it updated the status of the agent and all the services being informed to the Grid Control through the agent:




P.S. In several sites its specified to alter the value of EMD_URL in the $AGENT_HOME/sysman/config/emd.properties file and instead of https://xyz.com... change it to http://xyz.com... As far as my test goes I didn't make any changes there.