Tuesday, August 16, 2011

Recreate EM 12C repository

> ./emca -config dbcontrol db -repos recreate

STARTED EMCA at Dec 8, 2012 10:33:43 AM

EM Configuration Assistant, Version 11.2.0.3.0 Production

Copyright (c) 2003, 2011, Oracle.  All rights reserved.

Enter the following information:

Database SID: pacloud

Listener port number: 1521

Listener ORACLE_HOME [ /opt/oracle/app/oracle/product/11.2.0/db_1 ]:

Password for SYS user:

Password for DBSNMP user:

Password for SYSMAN user:

Email address for notifications (optional): dbasupport@protectair.com

Outgoing Mail (SMTP) server for notifications (optional):

-----------------------------------------------------------------

You have specified the following settings

Database ORACLE_HOME ................ /opt/oracle/app/oracle/product/11.2.0/db_1

Local hostname ................ culp-dbmgmt01.pa.parsonsvic.com

Listener ORACLE_HOME ................ /opt/oracle/app/oracle/product/11.2.0/db_1

Listener port number ................ 1521

Database SID ................ pacloud

Email address for notifications ............... dbasupport@protectair.com

Outgoing Mail (SMTP) server for notifications ...............

-----------------------------------------------------------------

----------------------------------------------------------------------

WARNING : While repository is dropped the database will be put in quiesce mode.

----------------------------------------------------------------------

Do you wish to continue? [yes(Y)/no(N)]: Y

Dec 8, 2012 10:34:51 AM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /opt/oracle/app/oracle/cfgtoollogs/emca/pacloud/emca_2012_01_08_10_33_43.log.

Dec 8, 2012 10:34:52 AM oracle.sysman.emcp.EMReposConfig invoke

INFO: Dropping the EM repository (this may take a while) ...

http://docs.oracle.com/cd/B28359_01/server.111/b28319/emca.htm

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

Tuesday, April 21, 2009

ORA-01207 File is More Recent Than Controlfile - Old Controlfile

Let's use the oerr utility to look at the ORA-01207 error:

$> oerr ora 1207
01207, 00000, "file is more recent than control file - old control file"
// *Cause:  The control file change sequence number in the data file is
//         greater than the number in the control file. This implies that
//         the wrong control file is being used. Note that repeatedly causing
//         this error can make it stop happening without correcting the real
//         problem. Every attempt to open the database will advance the
//         control file change sequence number until it is great enough.
// *Action: Use the current control file or do backup control file recovery to
//         make the control file current. Be sure to follow all restrictions
//         on doing a backup control file recovery.

The Oracle documentation notes these restrictions on doing a BACKUP CONTROLFILE RECOVERY:
The following notes and restrictions apply regardless of whether you use a recovery catalog:
  • You must run the RECOVER command after restoring a backup control file, even if no datafiles have been restored.
  • You must open the database with the RESETLOGS option after performing either complete or point-in-time recovery with a backup control file.
  • If the online redo logs are inaccessible, then you must perform incomplete recovery to an SCN before the earliest SCN in the online redo logs. This limitation is necessary because RMAN does not back up online logs.
  • During recovery, RMAN automatically searches for online and archived redo logs that are not recorded in the RMAN repository, and catalogs any that it finds so that it can use them in recovery.  

    RMAN attempts to find a valid archived log in any of the current archiving destinations with the current log format. The current format is specified in the initialization parameter file used to start the instance (or all instances in a Real Application Clusters installation). Similarly, RMAN attempts to find the online redo logs by using the filenames as specified in the control file.  

    If you changed the archiving destination or format during recovery, or if you added new online log members after the backup of the control file, then RMAN may not be able to automatically catalog a needed online or archived log. 

Monday, September 15, 2008

Oracle Recovery


CKPT is an Oracle backgroud process that timestamps all datafiles and control files to indicate that a checkpoint has occurred. It signals DBWn to write blocks to disk.

Online Redo Log records changes to the database as they occur. it enable Oracle database to recover committed data not yet written to the data file. the contents of the log include uncommitted transaction, undo data, and schema and object management statements.

Archived Redo Log is a coping of filled groups of redo log files on offline destinations. The archived redo log contains a copy of every group created since archivelog mode enabled. The archive log files can be used to recover database from last backup to current failure point.

Monday, August 25, 2008

Types of Oracle Database Failures

There are six general categories for database related failures.

Statement Failures occur when a single database operation fails, such as insert, delete statment.
User Process Failures happen when the abnormal termination of a user session, any uncommited transaction must be cleaned up
Network Failures can be found when the hardware failures between the server and client. It also includes a listener process fails on Oracle server.
User Error Failures when the operation's result is not what the user intended even there is no error message generated, such as delete or modify data or drop an index.
Instance Failues occurs when the instance shuts down without synchronizing all the database files to the same system change number.
Media Failures that are any type of failure that results in the loss of one or more database files.

Oracle Instance Structure

A database instance is a set of memory structures that manage database files. It includes a memory area (SGA) and several background processes.

The most important SGA components are the following:
Database buffer cache is the memory area that stores copies of data blocks read from data file.
Redo log buffer is a circular buffer that stores redo entries describing changes made to the database.
Shared pool caches various types of program data, such as parsed SQL, PL/SQL code, system parameters and data dictionary information.
Large pool is an optional memory area intended for memory allocations that are larger than is appropriate for the shared pool.
Streams pool stores buffered queue messages and provides memory for Oracle Streams processes
Fixed SGA is an internal housekeeping area.

Background processes run by default in a database instance started.
PMON monitors the other background process and performs process recovery
SMON is in charge of a variety of system-level cleanup duties.
DBWn writes the contents of database buffers to data files.
LGWR manages the redo log buffer.
CKPT updates the control file and data file header with checkpoint information and signals DBWn to write blocks to disk.
MMON performs many tasks related to the Automatic Workload Repository.
REC0 automatically resolves failures in distributed transactions.