24 November 2012

Database compatible parameter is set to "11.2.0.0.0" and diskgroup database compatibility attribute is set to "11.2.0.2.0".


Issue:

Database compatible parameter is set to “11.2.0.0.0” and diskgroup database compatibility attribute is set to “11.2.0.2.0” while creating new database.
Solution
$ cd $ORACLE_HOME/assistants/dbca/templates/
[oracle@db01 templates]$ ls -lha
total 286M
drwxr-xr-x 2 oracle oinstall 4.0K Oct  5 19:03 .
drwxr-xr-x 6 oracle oinstall 4.0K Jun 30 13:01 ..
-rw-r--r-- 1 oracle oinstall 5.0K Oct  5 19:03 Data_Warehouse.dbc
-rw-r--r-- 1 oracle oinstall 5.0K Oct  5 18:56 Data_Warehouse.dbc.bk
-rwxr-xr-x 1 oracle oinstall  21M Sep 22  2011 example01.dfb
-rwxr-xr-x 1 oracle oinstall 1.5M Sep 22  2011 example.dmp
-rw-r--r-- 1 oracle oinstall 4.9K Sep 17  2011 General_Purpose.dbc
-rw-r--r-- 1 oracle oinstall  12K Feb 15  2010 New_Database.dbt
-rwxr-xr-x 1 oracle oinstall 9.3M Sep 22  2011 Seed_Database.ctl
-rwxr-xr-x 1 oracle oinstall 254M Sep 22  2011 Seed_Database.dfb
Edit template
Find
   <InitParamAttributes>
      <InitParams>
         <initParam name="db_name" value=""/>
         <initParam name="dispatchers" value="(PROTOCOL=TCP) (SERVICE={SID}XDB)"/>
         <initParam name="audit_file_dest" value="{ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/adump"/>

Enable DDL Audit


ALTER SYSTEM SET enable_ddl_logging=TRUE
The result will go to
$ORACLE_BASE/diag/rdbms/db1/DB1/alert
log.xml

ORA-1113 when open database


Issue:
alter database open
ORA-1113 signalled during: alter database open...
Starting ORACLE instance (normal)
Solution:
startup mount
ALTER DATABASE RECOVER  database;
or
Check backup mode
        -- Hot backup status
        SELECT  COUNT(*) FROM v$backup WHERE status ='ACTIVE';
        -- Tablespaces in hot backup mode
        SELECT  distinct ddf.tablespace_name tablespace_name
        FROM    v$backup vb, DBA_DATA_FILES ddf
        WHERE   vb.status ='ACTIVE' and vb.file#  = ddf.file_id;
ALTER TABLESPACE (<tbs_name from the query before>) END BACKUP ;

22 November 2012

Agent is Running but Not Ready


Issue
[oracle@db1 bin]$ ./emctl status agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version     : 11.1.0.1.0
OMS Version       : 11.1.0.1.0
Protocol Version  : 11.1.0.0.0
Agent Home        : /u01/app/oracle/product/EMbase/oracle/MW/agent11g/db1.local
Agent binaries    : /u01/app/oracle/product/EMbase/oracle/MW/agent11g
Agent Process ID  : 24910
Parent Process ID : 24865
---------------------------------------------------------------
Agent is Running but Not Ready
Workout
1. emctl stop agent
2. ps -ef | grep emagent
        kill all the process
3. emctl start agent
        Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
        Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
        Starting agent ........................................................................................................................... started but not ready.
Solution
emctl unsecure agent
emctl secure agent

How to convert to cluster database



Convert to cluster DB, make database clustered
1. copy init<>.ora and orapwd<> to another host
2. save spfile to init<>.ora
3. create UNDOTBS2,..
4. add logfiles for thread 2,..
5. assign UNDOTBS for each instance
6. assign instance_number for each instance;

11 June 2012

ORA-600 [kkfi.qbcvfr]

Issue: ORA-600 [kkfi.qbcvfr]

Environment:
RDBMS: 11.2.0.2
OS: Linux 5.5

Error in alert log:
ORA-600 [kkfi.qbcvfr]

Solution:
Patch 9965278

Possible solution (temporary):
alter system/session set "_replace_virtual_columns" = false;
alter system/session set "_disable_function_based_index"=true;
alter system/session set "_fix_control"="6754080:off";
alter system/session set "_fix_control"="8706652:off";

Exadata Storage srvers CellCli and dcli commands


-- Exadata Starage Servers
CELLCLI
-- use root user to do the work
-- cell configuration files
cellinit.ora, cellip.ora
-- on database server
cellinit.ora - identifies the storage network interface on the database server
        cat /etc/oracle/cell/network-config/cellinit.ora
cellip.ora - identifies the Exadata cells that are accessible to the database server
        cat /etc/oracle/cell/network-config/cellip.ora
-- ASM view to check disk configuration
        V$ASM_DISKGROUP
      
-- support & diagnostic utility
/opt/oracle.SupportTools
--  usefull commands
cellcli> list cell
cellcli> alter cell restart services all -- restarting RS, CELLSRV, and MS services
cellcli> alter cell {SHUTDOWN | RESTART | STARTUP } services {RS | MS | CELLSRV | ALL}
cellcli> create celldisk all harddisk {interleaving='normal_redundancy'}
cellcli> list celldisk
         CD_00_xdb1cel03         normal
         CD_01_xdb1cel03         normal
cellcli> create griddisk all prefix=data, size=300G
cellcli> list griddisk
         DATA_XDB1_CD_00_xdb1cel03       active
         DATA_XDB1_CD_01_xdb1cel03       active
-- to crate disk group on flash         
cellcli> drop flashcache
cellcli> create flashcache all size=100G
cellcli> create griddisk all flashdisk prefix=flash
-- to use all flash cache
cellcli> drop flashcache
cellcli> create flashlog all
cellcli> create flashcache all
------------------------------------------------------------------------------------------------------------------
-- DCLI
-- /opt/oracle/cell/cellsrv/bin/dcli or /usr/local/bin/dcli
dcli -g cell_list date
dcli -c cell01,cell02,cell03 cellcli -e list cell
dcli -g cell_list -x cellclicommands.scl
dcli -g mydbservers -l root -x dbwork.sh
-- cell_list is a file with the list of cells
------------------------------------------------------------------------------------------------------------------
-- IORM  I/O Resource Manager
cellcli> list iormplan detail
         name:                   xdb1cel03_IORMPLAN
         catPlan:
         dbPlan:
         objective:              off
         status:                 active
cellcli> alter iormplan objective='balanced'
-- {balanced | off | low_latency | high_throughput | auto}
-- interdatabase Plane Example
cellcli> alter iormplan dbplan =((name=sales_prod, level=1, allocation=80),
                                                (name=finance_prod, level=1, allocation=20),
                                                (name=sales_dev, level=2, allocation=100),
                                                (name=sales_test, level=3, allocation=50),
                                                (name=other, level=3, allocation=50)
                                                ),
                                catplan=''
-- interdatabase Plane and Database Role
cellcli> alter iormplan dbplan =((name=sales1, level=1, allocation=30, role=primary),
                                                (name=sales2, level=1, allocation=35, role=primary),
                                                (name=sales3, level=2, allocation=20, role=standby),
                                                (name=sales4, level=2, allocation=25, role=standby),
                                                (name=other, level=3, allocation=50)
                                                ),
                                catplan=''
-- Flash Memory usage
cellcli> alter iormplan dbplan =((name=oltp, level=1, allocation=80, flashCache=on, flashLog=on),
                                                (name=dss, level=1, allocation=20 limit=50, flashCache=off, flashLog=on),
                                                (name=other, level=2, allocation=100, flashCache=off, flashLog=off),
-- catplan usage
        catplan=((name=INTERACTIVE, level=1, allocation=60),
                         (name=BATCH, level=1, allocation=40)
                        )
-- Activation iormplan
cellcli> alter iormplan active

12 January 2012

Alert log from DB side

--
-- view alert log from DB side
--
-- 0. get info
select * from dba_directories
select * from v$instance
-- 1. create dir
create directory ALERT_LOG as 'G:\SBLSYS\ORADBA\TRACE\BDUMP'
-- 2. create external table
create table alert_log_f (txt varchar2(2000))
organization external (type oracle_loader -- oracle_datapump <-for 10g -- oracle_loader <-for Oracle 9i
default directory ALERT_LOG
--      access parameters (
--          --records delimited by newline
--          nologfile nobadfile
--          fields terminated by 2000 ltrim
--      )
  location('alert_orcl.log'))
reject limit unlimited;
drop table alert_log_f
-- 3. check
select * from alert_log_f where lower(txt) like '%ora-%'

11 January 2012

How to enable Automatic Memory Management in Oracle 11G

How to enable Automatic Memory Management in Oracle 11G
1. Set MEMORY_TARGET as (memory_target = sga_target + max(pga_aggregate_target, maximum PGA allocated))
        ALTER SYSTEM SET MEMORY_TARGET = mM SCOPE = SPFILE;
2. Set parameter MEMORY_MAX_TARGET
        ALTER SYSTEM SET MEMORY_MAX_TARGET = nM SCOPE = SPFILE;
Note:   1. n > m
                2. if don't specify MEMORY_TARGET it sets to zero by default
                        and you can manipulate its value dynamicaly not exceeding MEMORY_MAX_TARGET
3. Set SGA_TARGET to zero
        ALTER SYSTEM SET SGA_TARGET = 0;
4. Set PGA_AGGREGATE_TARGET to zero
        ALTER SYSTEM SET PGA_AGGREGATE_TARGET = 0;
       
Note:
The preceding steps instruct you to set SGA_TARGET and PGA_AGGREGATE_TARGET to zero
so that the sizes of the SGA and instance PGA are tuned up and down as required,
without restrictions. You can omit the statements that set these parameter values to zero
and leave either or both of the values as positive numbers.
In this case, the values act as minimum values for the sizes of the SGA or instance PGA.       

10 January 2012

How to clear mailbox queue on Linux


Clear mail queue
1. Login as root
cd /var/spool/mqueue
2. delete all files
rm *