Latest Entries »

login as root

clustat -i 3

then it will give us the below output

Cluster Status for MSCB-DC-CLUSTER @ Mon Feb 28 11:03:57 2011
Member Status: Quorate

 Member Name                                                     ID   Status
 —— —-                                                     —- ——
 MSCB-DC-DB01                                                        1 Online, Local, rgmanager
 MSCB-DC-DB02                                                        2 Online, rgmanager

 Service Name                                                     Owner (Last)                                                     State
 ——- —-                                                     —– ——                                                     —–
 service:MSCB-DC-SERVICE1                                         MSCB-DC-DB01                                                     started

At command prompt type –  setup

Go to  – Network configuration

edit  – device

go to  – etho (etho) – Realtek semiconductor Co., Ltd

then hit enter and it will go to Devernet Configuration

Static Ip 172.100.151.46(here put the ip)
Netmask 255.255.255.0
default gateway Ip 172.100.151.1

then after saving all at command prompt

service network restart

then reboot there server

When linux server will reboot it will run the file called dbora

 [oracle@MSCB-DC-TESTDB ~]$ cat /etc/init.d/dbora

 ### Database MSCBPROD ###

nohup sh /etc/init.d/testing.sh >> /etc/init.d/testtt.log 2>&1 &

export ORACLE_SID=MSCBPROD

export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db_1

export PATH=$ORACLE_HOME/bin:$PATH:.

cd $ORACLE_HOME/bin lsnrctl

 start sqlplus sys/oracle as sysdba <

spool /oracle/app/oracle/product/11.2.0/db_1/sqlplus_ms.log

startup

exit

In brief the rule-based method means that when executing a query the database must follow certain predefined rules and matter what data is stored in affected database

tables. The cost-based method means the database must decide which query execution plan to choose using best guess approach that takes into account what data is stored

in db.

A long time ago the only optimizer in the Oracle database was the Rule-Based Optimizer (RBO). Basically the RBO used a set of rules to determine how to execute a

query. If an index was available on a table the RBO rules said to always use the index. There are some cases where the use of an index slowed down a query. For example

assume someone put an index on the GENDER column which holds one of two values MALE and FEMALE. 

Then someone issues the following query: 

SELECT * FROM emp WHERE gender ‘FEMALE’; If the above query returned approximately 50 of the rows then using an index would actually slow things down. It would be

faster to read the entire table and throw away all rows that have MALE values. Experts in Oracle query optimization have come to a rule of thumb that says if the

number of rows returned is more than 5-10 of the total table volume using an index would slow things down. The RBO would always use an index if present because its

rules said to. 

It became obvious that the RBO armed with its set of discrete rules did not always make great decisions. The biggest problem with the RBO was that it did not take the

data distribution into account. So the Cost-Based Optimizer (CBO) was born. The CBO uses statistics about the table its indexes and the data distribution to make

better informed decisions. 

Using our previous example assume that the company has employees that are 95 female and 5 male. If you query for females then you do not want to use the index. If you

query for males then you would like to use the index. The CBO has information at hand to help make these kind of determinations that were not available in the old RBO.

What is Cost-Based Optimization? 

The Oracle cost-based optimizer is designed to determine the most efficient way to carry out a SQL statement, but it can’t reach do this without good, up-to-date

statistical information on the data being accessed. The optimizer can use a rules-based approach to work without statistical information, but this approach is less

intelligent than the cost-based approach. With the rules-based approach, the optimizer chooses an execution plan based a set of rules about what types of operations

usually execute faster than other types. With the cost-based approach, the optimizer factors in statistical information about the contents of the particular schema

objects (tables, clusters, or indexes) being accessed. 

Rule Based Optimizer Obsolescence

The Rule Based Optimizer (RBO) is now obsolete in Oracle 10g. The functionality is still present but no new functionality has been included in it and it is no longer

supported by Oracle. It is only present to provide backwards compatibility during the migration to the query optimizer (Cost Based Optimizer). The results of this

osolescence are:

– The CHOOSE and RULE options for the OPTIMIZER_MODE parameter still exist but are no longer supported. 
– The default value for the OPTIMIZER_MODE parameter is ALL_ROWS. 
– The CHOOSE and RULE optimizer hints still exist but are no longer supported. 
– Code requiring the RBO must be migrated to use the query optimizer.

Hard Parse and Soft Parse
The execution of an sql statement consists of the following steps:
1)Parsing
2)Optimization and Row source generation
3)Execution
4)Fetch

Parsing is the first step in the processing of an sql statement.
Parsing involves the following two main functions:

1)Syntax check
2)Semantic analysis

1)Syntax check

During this phase, oracle checks for any syntax errors in the sql statement.For example,
SQL> select * fro emp
  2  ;
select * fro emp
         *
ERROR at line 1:
ORA-00923: FROM keyword not found where expected

The above error comes as a result of syntax check.Oracle checks the sql for any sql grammatical errors.It checks whether the sql follow all the rules it is meant to.

2)Semantic analysis

During this phase,oracle checks the validity of the sql statement in the light of database objects.Oracle checks a number of things,for example:

-Is the object exist?
-Does the user have all the necessary privileges?
-Are there any ambiguity in the sql statement?
etc etc

These checks are performed at symantic analysis.For example,

SQL> select * from employee;
select * from employee
              *
ERROR at line 1:
ORA-00942: table or view does not exist

Although the syntax is correct but oracle reported a semantic error.
Similarly for an sql statement of the type:
SQL> select empno,deptno from emp,dept where emp.deptno=dept.deptno;
select empno,deptno from emp,dept where emp.deptno=dept.deptno
             *
ERROR at line 1:
ORA-00918: column ambiguously defined

As oracle has no way to know which table the columns col1 and col2 belongs,it throws the error.

After these two steps, oracle checks whether the statement that we are parsing is already present in memory or not.
If it is present in memory then oracle can skip the further two phases ie optimization and row source generation.This is know as Soft parse.

If the statement is not present in memory then oracle would have to parse,optimize and generate the plan for the statement.All this reprocessing is known as hard

parse.

So what the fuss about soft and hard parse??

A soft parse is less cpu intensive than the hard parse. Optimizing the query and generating row source operations are cpu intensive tasks. So if the database is

undergoing a large amount of hard parses,this might slow down the database or eventually hang it.

So the goal should be to soft parse the query once and execute it many times.

I hope it make some sense.

[oracle@cal3idbs01 ~]$ cd $ORACLE_HOME/
[oracle@cal3idbs01 10.2.0.3]$ cd OPatch/
[oracle@cal3idbs01 OPatch]$ ls
crs  docs  emdpatch.pl  fmw  jlib  ocm  opatch  opatch.bat  opatch.ini  opatch.pl  opatchprereqs  README.txt
[oracle@cal3idbs01 OPatch]$ ./opatch lsinventory
Invoking OPatch 11.2.0.1.1

Oracle Interim Patch Installer version 11.2.0.1.1
Copyright (c) 2009, Oracle Corporation.  All rights reserved.
Oracle Home       : /opt/oracle/product/10.2.0.3
Central Inventory : /opt/oracle/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.2.0.1.1
OUI version       : 10.2.0.3.0
OUI location      : /opt/oracle/product/10.2.0.3/oui
Log file location : /opt/oracle/product/10.2.0.3/cfgtoollogs/opatch/opatch2010-02-03_11-16-50AM.log

Patch history file: /opt/oracle/product/10.2.0.3/cfgtoollogs/opatch/opatch_history.txt

Lsinventory Output file location : /opt/oracle/product/10.2.0.3/cfgtoollogs/opatch/lsinv/lsinventory2010-02-03_11-16-50AM.txt

Installed Top-level Products (2):

Oracle Database 10g                                                  10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 2                            10.2.0.3.0
There are 2 products installed in this Oracle Home.
Interim patches (7) :

Patch  5957325      : applied on Sat Jan 02 11:37:43 MST 2010
   Created on 20 Mar 2008, 09:20:17 hrs PST8PDT
   Bugs fixed:
     5957325

Patch  5901891      : applied on Sat Jan 02 11:22:19 MST 2010
   Created on 16 Apr 2007, 00:14:55 hrs US/Pacific
   Bugs fixed:
     5548389, 5901923, 5885186, 5901891, 5881721

Patch  5240469      : applied on Sat Jan 02 11:18:23 MST 2010
   Created on 13 Feb 2007, 01:18:47 hrs US/Eastern
   Bugs fixed:
     5240469

Patch  5556081      : applied on Fri Jan 01 01:18:43  MST 2010
   Created on 29 May 2007, 00:23:10 hrs PST8PDT
   Bugs fixed:
     5556081

Patch  5632264      : applied on Fri Jan 01 01:17:45 MST 2010
   Created on 7 Feb 2007, 02:28:44 hrs US/Pacific
   Bugs fixed:
     5632264

Patch  5648872      : applied on Fri Jan 01 01:15:16 MST 2010
   Created on 23 Mar 2007, 21:04:04 hrs US/Pacific
   Bugs fixed:
     5648872

Patch  5557962      : applied on Fri Jan 01 01:01:49 MST 2010
   Created on 9 Nov 2006, 23:23:06 hrs PST8PDT
   Bugs fixed:
     4269423, 5557962, 5528974

There is a file called cost.ksh in that file below are the contents
export ORACLE_SID=orcl
export ORACLE_HOME=/u02/pras/11g
export PATH=$ORACLE_HOME/bin:$PATH:.(here there should be gap)

sqlplus “/ as sysdba” << EOF
select name from v\$database;
<< EOF

Then give the below permission to that file

chmod 755
chmod 777

for e.g chmod 755 cost.ksh

After giving permission go into the file and edit sumthing and revert the changes

then placing it in the crontab

crontab -e

10 19 * * * /opt/oracle/cost.ksh >> /opt/oracle/cost.log 2>&1 &

(Here we have schedule to run it on 7:10pm every day)

rman > spool log to abc.txt

rman > list backup of database;

rman > spool off
rman > exit
vi abc.txt

$ cat /opt/oracle/admin/SEBLD/scripts/sebld.rmn
export ORACLE_SID=SEBLD
export ORACLE_HOME=/opt/oracle/product/10gr2
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
$ORACLE_HOME/bin/rman target / << EOF
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
Backup database include current controlfile;
Crosscheck archivelog all;
Backup archivelog all delete input ;
delete noprompt obsolete ;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
EOF
[oracle@dal604se40 /opt/oracle]
$
0 23 * * 4 /opt/oracle/admin/SEBLD/scripts/sebld.rmn > /opt/oracle/admin/SEBLD/scripts/sebld.log 2>&1

SQL> select distinct status from dba_ind_partitions;

STATUS
——–
USABLE
UNUSABLE

SQL> select count(1) from dba_ind_partitions where status=’UNUSABLE’;

  COUNT(1)
———-
         2

select ‘ alter index ‘||index_owner||’.’||index_name||’ rebuild partition ‘||partition_name||’;’ from dba_ind_partitions where status=’UNUSABLE’;

SQL>  alter index ODS_DLSPG.XIE1SEND_STATUS_TBL rebuild partition P_2009_12;

Index altered.

SQL> alter index ODS_DLSPG.XIE3SEND_STATUS_TBL rebuild partition P_2009_12;

Index altered.

SQL> select count(1) from dba_ind_partitions where status=’UNUSABLE’;

  COUNT(1)
———-
         0
SQL> select distinct status from dba_ind_partitions;

STATUS
——–
USABLE

SQL> select count(1) from dba_ind_partitions where status=’UNUSABLE’;

  COUNT(1)
———-
         0