Friday, October 22, 2010

reCreate Dataguard Broker


Step By Step How to Recreate Dataguard Broker Configuration.
Fix

Step 1. Stop broker in both of primary and standby databases (in all instances in case of RAC):


SQL>ALTER SYSTEM SET DG_BROKER_START=FALSE;
Step 2. Drop old broker configuration files from both primary and standby:

Check the location of files using : "show parameter dg_broker_config_file"
By default the broker configuration files will be in "$ORACLE_HOME/dbs" in Unix and "$ORACLE_HOME/database" in Windows.
SQL> show parameter dg_broker_config_file

NAME                   TYPE   VALUE
---------------------- ------ ----------------------------------------
dg_broker_config_file1 string \oracle\product\10.2.0\dbs\dr1PROD10G.dat
dg_broker_config_file2 string \oracle\product\10.2.0\dbs\dr2PROD10G.dat
Drop the files using ASMCMD if files are on ASM:


ASMCMD> cd DATA/PROD10G/
ASMCMD> rm dr1PROD10G.dat
ASMCMD> rm dr2PROD10G.dat
Drop the files using :

Unix


$cd $ORACLE_HOME/dbs
$ rm dr1PROD10G.dat
$ rm dr2PROD10G.dat

Windows
c:\>cd $ORACLE_HOME/database
D:\oracle\product\10.2.0\db_2\database> del dr1PROD10G.dat
D:\oracle\product\10.2.0\db_2\database> del dr2PROD10G.dat
Step 3. Start broker in both of primary and standby (in all instances in case of RAC):


SQL>ALTER SYSTEM SET DG_BROKER_START=TRUE;
Step 4. Connect to DGMGRL on primary: (from instance one in case of RAC)


$dgmgrl
DGMGRL for Linux: Version 10.2.0.3.0 - Production

Copyright (c) 2000, 2005, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.

DGMGRL> CONNECT sys/;
Connected.
Step 5. Create configuration on primary:


DGMGRL> CREATE CONFIGURATION 'PRODCONF' AS PRIMARY DATABASE IS 'PROD10G' CONNECT IDENTIFIER IS PROD10G;

Configuration "PRODCONF" created with primary database "PROD10G"
Step 6. Add standby in the configuration:


DGMGRL> ADD DATABASE 'STDBY10G' AS CONNECT IDENTIFIER IS STDBY10G MAINTAINED AS PHYSICAL;

Database "STDBY10G" added
Step 7. Enable Configuration:


DGMGRL> ENABLE CONFIGURATION;
Enabled.
Use the SHOW command to verify that the configuration and its databases were successfully enabled and brought online:


DGMGRL> SHOW CONFIGURATION;

Configuration
Name: PRODCONF
Enabled: YES
Protection Mode: MaxPerformance
Fast-Start Failover: DISABLED

Databases:
PROD10G - Primary database
STDBY10G - Physical standby database

Current status for "PRODCONF"
SUCCESS
References

NOTE:454418.1 - Unable To Recreate Data Guard Fast Start Failover Configuration With DGMGRL
Doc ID 808783.1- Step By Step How to Recreate Dataguard Broker Configuration ()

Thursday, May 13, 2010

Drop and Cleanup a Non-RAC Database

To drop and cleanup a Non-RAC Oracle database, implement following steps as user oracle.


Step 1 – Drop OEM

Set ORACLE_SID and ORACLE_UNQNAME as follows:
$>. oraenv <= set ORACLE_SID
$>cd
$>. .profile  <= set ORACLE_UNQNAME using .profile

Try to drop OEM (if exists) as follows:
$>emca -deconfig dbcontrol db -repos drop

If OEM is dropped by emca, followings will be deleted . Otherwise delete them manually:

Directories:
$><ORACLE_HOME>/<HOSTNAME>_<ORACLE_SID>
$><ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<HOSTNAME>_<ORACLE_SID>

ORACLE_SID related entries (if exists ) in following files:
$><ORACLE_HOME>/install/ReadMe.txt         <= oem port entries - optional
$><ORACLE_HOME>/install/portlist.txt       <= oem port entries


Step 2 – Drop Database

$>sqlplus / as sysdba
sqlplus>shutdown immediate;
sqlplus>starup mount exclusive restrict;
sqlplus>drop database;


Step 3 – Cleanp Residues

Delete following directories manually if exists:
$><ORACLE_BASE>/diag/rdbms/<ORACLE_SID>    <= diagnostic directory

Delete following files manually if exists:
$><ORACLE_HOME>/dbs/init<ORACLE_SID>.ora  <= init.ora file
$><ORACLE_HOME>/dbs/orapw<ORACLE_SID>      <= passwd file

Delete ORACLE_SID related entries (if exists ) from following files:
$>/var/opt/oracle/oratab                    <= oratab
$><ORACLE_HOME>/network/admin/tnsnames.ora <= tnsnames entries
$><ORACLE_HOME>/network/admin/listener.ora <= listener entries