June 19, 2013

Cant install package elfutils-libelf-devel-*

Oracle 11g Installation on Oracle Linux 5.9


While installing oracle 11g it may show dependency error at rpm "
elfutils-libelf-devel-* "

rpm -Uvh elfutils-libelf-devel-*

In that case please install both package using following command :
 
rpm -ivh elfutils-libelf-devel-0.137-3.el5.x86_64.rpm elfutils-libelf-devel-static-0.137-3.el5.x86_64.rpm

June 14, 2013

ORA-01262 , ORA-01261

SQL> startup pfile=/u01/app/oracle/product/11.2.0/db_1/dbs/initDB11G.ora

ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated
ORA-01262: Stat failed on a file destination directory
Linux-x86_64 Error: 2: No such file or directory




ORA-01262:

Stat failed on a file destination directory
Cause: Unable to get information about an Oracle managed files destination directory.
Action: Check the permissions on the directory or use a different directory name.


If this error rises when startup database using pfile please verify whether all the path or directory specified in init.ora is exist or not. 

Manually creating Oracle 11g Database





Step 1:Specify an Instance Identifier (SID)
export ORACLE_SID=db11g

Step 2:Ensure That the Required Environment Variables Are Set
$PATH
$ORACLE_HOME
$ORACLE_BASE
   
Step 3:Choose a Database Administrator Authentication Method
  •         With a password file
  •         With operating system authentication
orapwd file=$ORACLE_HOME/dbs/orapwdb11g password=sys

Step 4:Create the Initialization Parameter File
Sample init.ora file will be available in $ORACLE_HOME/dbs. Edit init.ora if needed. 

db_name='db11g'
memory_target=1G
processes = 150
audit_file_dest='$ORACLE_BASE/admin/orcl/adump'
audit_trail ='none'
db_block_size=8192
db_domain=''
db_recovery_file_dest='$ORACLE_BASE/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='$ORACLE_BASE'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='11.2.0'


For convenience, store your initialization parameter file in the Oracle Database default location, using the default file name. Then when you start your database, it will not be necessary to specify the PFILE clause of the STARTUP command, because Oracle Database automatically looks in the default location for the initialization parameter file.

*Default location will be $ORACLE_HOME/dbs
*Default name will be initORACLE_SID.ora

Step 6:Connect to the Instance

sqlplus /nolog

SQL> conn / as sysdba
Connected to an idle instance.

Step 7:Create a Server Parameter File

SQL> create spfile from pfile;
File created.

Step 8: Start the Instance
startup nomount

Step 9: Issue the CREATE DATABASE Statement
 CREATE DATABASE db11g
 USER SYS IDENTIFIED BY sys
 USER SYSTEM IDENTIFIED BY sys
 LOGFILE GROUP 1 ('/u01/app/oracle/oradata/db11g/redo01a.log') SIZE 100M BLOCKSIZE 512,
                  GROUP 2 ('/u01/app/oracle/oradata/db11g/redo02a.log') SIZE 100M BLOCKSIZE 512,
                  GROUP 3 ('/u01/app/oracle/oradata/db11g/redo03a.log') SIZE 100M BLOCKSIZE 512
 MAXLOGFILES 5
 MAXLOGMEMBERS 5
 MAXLOGHISTORY 1
 MAXDATAFILES 100
 CHARACTER SET US7ASCII
 NATIONAL CHARACTER SET AL16UTF16
 EXTENT MANAGEMENT LOCAL
 DATAFILE '/u01/app/oracle/oradata/db11g/system01.dbf' SIZE 325M REUSE
 SYSAUX DATAFILE '/u01/app/oracle/oradata/db11g/sysaux01.dbf' SIZE 325M REUSE
 DEFAULT TABLESPACE users
 DATAFILE '/u01/app/oracle/oradata/db11g/users01.dbf'
 SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
 DEFAULT TEMPORARY TABLESPACE temp
 TEMPFILE '/u01/app/oracle/oradata/db11g/temp01.dbf'
 SIZE 20M REUSE
 UNDO TABLESPACE undotbs1
 DATAFILE '/u01/app/oracle/oradata/db11g/undotbs01.dbf'
 SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;


Step 10: Run Scripts to Build Data Dictionary Views

@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/sqlplus/admin/pupbld.sql    -- connect as system to execute this script

'?' will automatically locate $ORACLE_HOME.


More Reference: Oracle 11gR2 Documentation

April 15, 2013

Managing Dataguard.


To check status of Archive files in both Primary and Standby

SELECT process, status, thread#, sequence#,delay_mins, block#, blocks
FROM v$managed_standby  ;


Determine the most recently archived redo log file. 

SELECT MAX(sequence#), thread#
FROM v$archived_log
GROUP BY thread# ;



Determine the most recently archived redo log file at each redo transport destination.
SELECT destination, status, archived_thread#, archived_seq#
FROM v$archived_dest_status

WHERE status <> 'deferred'
AND status <> 'inactive';

April 12, 2013

Spatial Index Partition Error


ORA-14086: a partitioned index may not be rebuilt as a whole

Action    : Rebuild the index a partition at a time
Example: ALTER INDEX index_name REBUILD PARTITION partition_name;


ORA-29954: domain index partition is marked LOADING/FAILED/UNUSABLE

Action     : Wait if the specified index partition is marked LOADING Rebuild the specified 
                   index partition if it is marked FAILED or UNUSABLE.
Example :ALTER INDEX index_name REBUILD PARTITION partition_name;



Spatial Table Partition


Partitioning is an Oracle Database feature in which a single table is decomposed into multiple smaller tables called partitions.Range partitioning is the supported partitioning scheme for tables with spatial indexes. 



Range Partition Table 

CREATE TABLE tab_part
(geom MDSYS.SDO_GEOMETRY,
 id   NUMBER(10),
 mod  NUMBER(2)
)
PARTITION BY RANGE (mod)
(PARTITION p1_tab VALUES LESS THAN (3),
 PARTITION p2_tab VALUES LESS THAN (5),
 PARTITION p3_tab VALUES LESS THAN (7)
);

We should have entry in user_sdo_geom_metadata before  creating spatial Index.

INSERT INTO user_sdo_geom_metadata
SELECT 'TAB_PART' TABLE_NAME, COLUMN_NAME, DIMINFO, SRID 
FROM   user_sdo_geom_metadata 
WHERE TABLE_NAME= 'TAB1'      -- TAB1 have same entry in user_sdo_geom_metadata
AND COLUMN_NAME ='geom';

Create the partitioned spatial index specifying the keyword UNUSABLE

CREATE INDEX tab_part_sidx ON TAP_PART(geom)
INDEXTYPE IS MDSYS.SPATIAL_INDEX
LOCAL (
PARTITION P1 ,
PARTITION P2 ,
PARTITION P3 )
UNUSABLE;

If the index is created UNUSABLE, and each
partition is rebuilt separately, then if one or more partition’s indexes fail to build correctly only those
partition’s indexes will need to be rebuilt.


After creating the index UNUSABLE, each partition’s spatial index can then be created using the
ALTER INDEX … REBUILD PARTITION command.


alter index TAB_PART_SIDX rebuild partition p1;
alter index TAB_PART_SIDX rebuild partition p2;
alter index TAB_PART_SIDX rebuild partition p3;