Tuesday, June 28, 2011

Steps to set database on flashback mode in RAC for Oracle 11g

 

---- Check if flashback on?

SELECT flashback_on, log_mode
FROM v$database;

--- Check for Flashback Parameters existing

set linesize 121
col name format a30
col value format a30

SELECT name, value
FROM gv$parameter
WHERE name LIKE '%flashback%';

---- Stop the RAC Database , it will stop all the instances of the DB

srvctl stop database -d sfodb

--- Start the DB in mount state

srvctl start instance -d sfodb -i sfo38u1 -o mount 

-- Set the Flashback on

alter database flashback on;

--- Open the database

alter database open;

--- Start the remaining instances of the RAC

srvctl start instance -d sfodb -i sfo38u2 -o mount exclusive

-- Verify the flashback settings

select INST_ID,Name, FLASHBACK_ON from gv$database;

Saturday, June 18, 2011

ORA-00257: archiver error. Connect internal only, until freed.

 

Error:

ORA-00257: archive error, Connect internal only, until freed.
followed by
The database is not available due to the following conditions: Stuck Archiver
followed by
Warning: Disk group +DG_UAT_FLASH_01 is 92% used


*Cause: 
The archiver process received an error while trying to archive a redo log.  If the problem is not resolved soon, the database will stop executing transactions. The most likely cause of this message is the destination device is out of space to store the redo log file.

*Action: 
Check archiver trace file for a detailed description of the problem. Also verify that the device specified in the initialization  parameter  ARCHIVE_LOG_DEST is set up properly for archiving.

Method   1. Without increasing DB_RECOVERY_FILE_DEST_SIZE.

Approach 1: Move the archive log from the FRA to some other location to free up FRA

Step 1: Check whether the database is in archive log mode and automatic archiving is enabled

SQL> archive log list

Database log mode            Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     5559
Current log sequence           5561

Step 2:  As the archive destination is defined by USE_DB_RECOVERY_FILE_DEST, find the archive destination by

SQL> show parameter db_recovery_file_dest;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      +DG_UAT_FLASH_01
db_recovery_file_dest_size           big integer 110G

Note the value for db_recovery_file_dest_size. Here it is 11G.

Step 3:  Find the space used in flash recovery area by :

SQL> SELECT * FROM V$RECOVERY_FILE_DEST;

NAME
--------------------------------------------------------------------------------
SPACE_LIMIT SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
----------- ---------- ----------------- ---------------
+DG_UAT_FLASH_01
1.1811E+11 3.0249E+10        2.7808E+10            1140

Step 4:  If SPACE_USED is equal to SPACE_LIMIT of db_recovery_file_dest, move the archive logs to different destination.

Step 5:  Archive all the log files

SQL> alter system archive log all;

Step 6:  Just switch the logs to verify:

SQL> alter system switch logfile;

Second Approach: Delete the Archive Log , when it is not needed to free up the DB_RECOVERY_FILE_DEST
Alternatively, we can solve this type of problem without increasing DB_RECOVERY_FILE_DEST_SIZE is to delete (archive log) files from DB_RECOVERY_FILE_DEST if we are sure we have backups and the archived logs are no longer necessary.

$rman target /
RMAN>delete archivelog until time 'SYSDATE-1';

Method 2:  By increasing DB_RECOVERY_FILE_DEST_SIZE.

Step 1:  See the path of flash recovery area.

SQL> show parameter db_recovery_file_dest;

Step 2: Disable the Flash Recovery Area

SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='';

Step 3: Increase the Flash Recovery Area

SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 200g;

Step 4: Enable the Flash Recovery Area

SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = ‘+DG_UAT_FLASH_01’;

Friday, June 17, 2011

OEM OMS 10g Server Commands to start, stop and know the status (opmnctl)


Check status of the GRID management server

1) export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn

2) cd $ORACLE_HOME/bin

3) ./opmnctl status

oracle@omsrvrap$  export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn
oracle@omsrvrap$  cd $ORACLE_HOME/bin
oracle@omsrvrap$  opmnctl status

Processes in Instance: EnterpriseManager0.omsrvrap.dbosmsrvr.siva.com
-------------------+--------------------+---------+---------
ias-component      | process-type       |     pid | status 
-------------------+--------------------+---------+---------
LogLoader          | logloaderd         |     N/A | Down   
HTTP_Server        | HTTP_Server        |    9146 | Alive  
dcm-daemon         | dcm-daemon         |     N/A | Down   
OC4J               | home               |    9147 | Alive  
OC4J               | OC4J_EM            |    9148 | Alive  
OC4J               | OC4J_EMPROV        |    9150 | Alive  
OC4J               | OCMRepeater        |    9151 | Alive  
WebCache           | WebCache           |    9152 | Alive  
WebCache           | WebCacheAdmin      |    9153 | Alive  
DSA                | DSA                |     N/A | Down   


Stop the GRID management server

1) export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn

2) cd $ORACLE_HOME/bin

3) ./opmnctl stopall

oracle@omsrvrap$  export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn
oracle@omsrvrap$  cd $ORACLE_HOME/bin
oracle@omsrvrap$  opmnctl status

opmnctl: stopping opmn and all managed processes...

Start the GRID management server

1) export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn

2) cd $ORACLE_HOME/bin

3) ./opmnctl startall


oracle@omsrvrap$  export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn
oracle@omsrvrap$  cd $ORACLE_HOME/bin
oracle@omsrvrap$  opmnctl status

opmnctl: starting opmn and all managed processes...

OEM Grid 10g Agent commands to start, stop and know the status. ( emctl )

Oracle10g OEM GRID Agent ( emctl )Commands

Check status of the GRID control agent

1) export ORACLE_HOME=/app/oracle/product/10g/agent10g

2) cd $ORACLE_HOME/bin

3) ./emctl status agent

oracle@dbsrvr1$ export ORACLE_HOME=/app/oracle/product/10g/agent10g
oracle@dbsrvr1$ cd $ORACLE_HOME/bin
oracle@dbsrvr1$ ./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
Agent Home : /app/oracle/product/10g/agent10g
Agent binaries : /app/oracle/product/10g/agent10g
Agent Process ID : 20124
Parent Process ID : 20080
Agent URL : https://dbsrvr1.dbsrvr.siva.com:3872/emd/main/
Repository URL : https://hp6600ap.dbsrvr.siva.com:1159/em/upload
Started at : 2010-03-09 12:04:07
Started by user : oracle
Last Reload : 2010-03-09 12:08:39
Last successful upload : 2009-07-09 14:26:42
Total Megabytes of XML files uploaded so far : 291.89
Number of XML files pending upload : 0
Size of XML files pending upload(MB) : 0.00
Available disk space on upload filesystem : 35.13%
Last successful heartbeat to OMS : 2010-03-09 12:26:07
Agent is Running and Ready

STOP the GRID control agent

1) export ORACLE_HOME=/app/oracle/product/10g/agent10g

2) cd $ORACLE_HOME/bin

3) ./emctl stop agent

oracle@dbsrvr1$ export ORACLE_HOME=/app/oracle/product/10g/agent10g
oracle@dbsrvr1$ cd $ORACLE_HOME/bin
oracle@dbsrvr1$ ./emctl stop agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
Stopping agent ... stopped.


START the GRID control agent

1) export ORACLE_HOME=/app/oracle/product/10g/agent10g

2) cd $ORACLE_HOME/bin

3) ./emctl start agent

.

oracle@dbsrvr1$ export ORACLE_HOME=/app/oracle/product/10g/agent10g
oracle@dbsrvr1$ cd $ORACLE_HOME/bin
oracle@dbsrvr1$ /emctl start agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
Starting agent ................................ started.

Wednesday, June 15, 2011

ORA-00980: synonym translation is no longer valid

 

Error:  ORA-00980: synonym translation is no longer valid

Cause:

1. Synonym created on non-existing object by mistake.

2. The synonyms referencing the object is dropped but synonym is not dropped

3. Dropped a user, but the synonyms referencing the objects owned by that dropped user.

Query to find the invalid synonyms

select * from dba_synonyms s
where table_owner not in('SYSTEM','SYS')
and db_link is null
and not exists
(select 1
from dba_objects o
where s.table_owner=o.owner
and s.table_name=o.object_name);

select 'drop '||decode (s.owner,'PUBLIC','PUBLIC SYNONYM ','SYNONYM'||s.owner||'.')||s.synonym_name||';'
from dba_synonyms s
where table_owner not in('SYSTEM','SYS')
and db_link is null
and not exists
(select 1 from dba_objects o
where s.table_owner=o.owner
and s.table_name=o.object_name)

The query above generate the script to drop the synonyms whose translation is no longer valid

 

 

Wednesday, June 01, 2011

OEM Agent Log Files


The OEM Agent files are placed on AGENT_HOME/sysman/log/ by default.

OEM Agent Log File Management Agent log file emagent.log
OEM Agent Trace File Management Agent trace file emagent.trc
OEM Agent startup log file Management Agent startup log file emagent.nohup