2009-08-28

OAS port conflict

Some commands to help with port conflicts:

#Solaris
lsof -i |grep :1854

cd $ORACLE_HOME/sysman
find . -name "*.xml" -exec grep "<rmi-server port=" {} \;

emctl config iasconsole port [portNumber]
emctl config iasconsole rmiport [portNumber]
emctl config agent port [portNumber]

emctl status agent
emctl status iasconsole

$ORACLE_HOME/opmn/bin/opmnctl status -l

2009-08-27

Oracle password file

Just syntax reminder.

RDBMS 11.1
orapwd FILE=filename [ENTRIES=numusers] [FORCE={Y|N}] [IGNORECASE={Y|N}] [NOSYSDBA={Y|N}]
Unix file name: orapwsid
Windows file name: PWDsid.ora

RDBMS 10.2 for UNIX-Based Operating Systems
orapwd file=orapwsid password=password entries=max_users force=y/n
if FILE is not full path, it is created in current directory.
the password file should be in the $ORACLE_HOME/dbs directory


RDBMS 10.2 for Microsoft Windows
orapwd FILE=PWDsid.ora PASSWORD=password ENTRIES=max_users FORCE=y/n
if FILE is not full path, it is created in current directory.
Oracle Database looks in the registry for the value of parameter ORA_SID_PWFILE. If no value is specified,
then it looks in the registry for the value of parameter ORA_PWFILE, which points to a file containing usernames,
passwords, and privileges. If that is not set, then it uses the default.
so the order is
ORA_SID_PWFILE
ORA_PWFILE
ORACLE_BASE\ORACLE_HOME\DATABASE\PWDsid.ORA

2009-07-01

Find oracle product version

APEX:
select version_no from apex_release;

Oracle Application Server (OAS 10.1.2 and 10.1.3):
grep -i version $ORACLE_HOME/config/ias.properties

OAS Java version (JDK)
cd $ORACLE_HOME/jdk/bin
java -version

OAS 10.1.3 "System Properties"
Use Application Server Control.
From main page "Cluster Topology" go to OC4J "home". Click "Administration" tab. Go to "Server Properties". Scroll down and click the link "System Properties".

Oracle Database Server (RDBMS):
1.
select * from v$version;
2.
cd $ORACLE_HOME/bin
file oracle
If the output of the "file oracle" command does not say 64-bit explicitly then you are running 32-bit Oracle.
3.
check banner of sqlplus
4.
Check for lib, lib32
$ORACLE_HOME/lib32
$ORACLE_HOME/lib
If there is only an ORACLE_HOME/lib directory then it is 32 bit

modified on 2011-04-15

2009-06-24

change sysdate

environment: Oracle 10.2

To change sysdate for testing purposes in one database,
create new scheduler job with e.g. 1 minute interval.

Following example code has +7 days offset.
Parameter fixed_date changes only sysdate, it doesn't change systimestamp.

begin
EXECUTE IMMEDIATE ( 'alter system set fixed_date='
|| ''''
|| to_char(systimestamp+7,'YYYY-MM-DD-HH24:MI:SS')
|| '''');
end;

2009-01-23

clone oracle 10g database software on AIX

Environment
Oracle 10.2.0.4, CPU Jan 2009, recommended bundle #3
UNIX AIX 5.3.0.0 (both source and target hosts, command oslevel)
source unix user orax104
target unix user orax115

Cloning
1. Install oracle software, recommended patches and CPU on source host.
2. Oracle recommends to shutdown any databases, listeners, agents etc before copying files.
3. prepare exception list
export CLONE=/oracle/export/install
cd $ORACLE_HOME
find . -name "*.log" >$CLONE/ExcludeList.txt
find . -name "*.err" >>$CLONE/ExcludeList.txt
# network/admin can be useful for next installation
#shrept.lst is needed for patch 7226548 (lock_SGA on AIX)
#find ./network/admin >>$CLONE/ExcludeList.txt
find ./oc4j/j2ee/OC4J_DBConsole_* >>$CLONE/ExcludeList.txt
find `hostname |cut -d "." -f 1`*_* >>$CLONE/ExcludeList.txt
# DBCA templates, If u have them
find ./assistants/dbca/templates >>$CLONE/ExcludeList.txt
cat $CLONE/ExcludeList.txt

4. archive Oracle home
cd $ORACLE_HOME
tar -X $CLONE/ExcludeList.txt -cvf - . | gzip -c >$CLONE/oracle_home.tar.gz

5. copy tar.gz file to target host
6. extract oracle home
cd /oracle/export/install
# file was renamed
gunzip rdbms_10.2.0.4_CPUJAN2009_generic_bundle3.tar.gz
# as root to preserve permissions
# cd $ORACLE_HOME
cd /oracle/rdbms/10.2.0/orax115
tar xvf /oracle/export/install/rdbms_10.2.0.4_CPUJAN2009_generic_bundle3.tar
# change owner. Owner group is the same (oinstall)
find . -user orax104 -exec chown orax115 {} \;

7. on target host as oracle user
cd $ORACLE_HOME/rdbms/lib
mv config.o config.o_backup
cd $ORACLE_HOME/oui/bin
#detach oracle home if it exists
./runInstaller -detachHome ORACLE_HOME="/oracle/rdbms/10.2.0/orax115"
./runInstaller -clone -silent -ignorePreReq ORACLE_HOME="/oracle/rdbms/10.2.0/orax115" ORACLE_HOME_NAME="db_home_10g2_1"

8. (optional) Let other users use Oracle Home.
cd $ORACLE_HOME/install
./changePerm.sh

Useful links:
  1. Metalink DocID 300062.1 How To Clone An Existing RDBMS Installation Using OUI
  2. Metalink DocID 558478.1 Cloning A Database Home And Changing The User/Group That Owns It
  3. Oracle Software Cloning Using Oracle Universal Installer
  4. http://www.pythian.com/blogs/1041/oracle-silent-mode-part-3-cloning-software-and-databases

2008-08-26

How to point an agent to different OMS

Environment: AIX5L, Oracle agent 10.2.0.3
2008-01-04

1. Connect to target host as a user which owns Oracle agent installation (home)
2. go to $ORACLE_HOME/bin
3. stop the agent:
emctl stop agent
4. edit emd.properties
vi $ORACLE_HOME/sysman/config/emd.properties
5. replace old OMS with new OMS.
REPOSITORY_URL=http://host:4889/em/upload
or for secure
REPOSITORY_URL=https://host:1159/em/upload
6. check agentTZRegion=Australia/Sydney (or Australia/NSW)
7. go to sysman/emd
cd
$ORACLE_HOME/sysman/emd
8. remove the following files:
rm -rf protocol.ini agntstmp.txt lastupld.xml recv/* collection/* upload/* state/*
9. go to bin
cd $ORACLE_HOME/bin
10. clean agent state:
emctl clearstate agent
11. unsecure agent:
emctl unsecure agent
12. (optional) secure agent again:
emctl secure agent passwd where passwd is a registration password
13. start agent:
emctl start agent
14. check the status:
emctl status agent
15. upload metric data (in 30 seconds or more):
emctl upload agent
16. check availability of targets in new EM GC
17. configure credentials of new connected targets within EM for all administrators whom belongs the targets.

In case of some problems during registration of targets in EM or errors during upload process (15) do the following:
1. Delete all targets from EM
2. Stop the agent on a host
3. Delete agent from EM
4. Change targets.xml file (save a copy) to remove everything but leave entries for oracle_emd (entry for agent) and for host (for server since there is no chance to add host in EM – it should be discovered)
5. Remove files from sysman/emd based on 8
6. Do steps 9-17


Metalink:
Subject: How to - Point an Agent to a different Grid Control OMS and Repository? Doc ID: Note:413228.1 Type: HOWTO Last Revision Date: 19-NOV-2007 Status: PUBLISHED

2008-06-12

Oracle Generic Heterogeneous Services and Transparent Gateways

RHEL 4.5 Oracle 10.2
  1. install package unixODBC
  2. install package freeTDS, if u don’t have it for ur linux go to www.freetds.org and get the source
  3. configure /etc/freetds.conf (path can be different)
  4. try to connect with tsql
  5. configure files /etc/odbc.ini, /etc/odbcinst.ini, see www.unixodbc.org for details
  6. try to connect with isql (user and password are obligatory parameters)
  7. create and customize an initialization file for your Generic Connectivity agent $ORACLE_HOME/hs/admin/inithsodbc.ora
# HS init parameters
#
HS_FDS_CONNECT_INFO = mssql
HS_FDS_TRACE_LEVEL = off
HS_FDS_SHAREABLE_NAME = /usr/lib/libodbc.so

#
# ODBC specific environment variables
#
set ODBCINI=/etc/odbc.ini
  1. add record in tnsnames.ora
HS1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = tcp)(HOST = sydora2)(PORT = 1521))
)
(CONNECT_DATA =
(SID = hsodbc)
)
(HS=OK)
)
  1. add record in listener.ora
SID_LIST_LISTENER_SYDORA2 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /opt/oracle/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = hsodbc)
(ORACLE_HOME = /opt/oracle/app/oracle/product/10.2.0/db_1)
(PROGRAM = hsodbc)
(ENVS=LD_LIBRARY_PATH=/opt/oracle/app/oracle/product/10.2.0/db_1/lib:/usr/local/lib:/usr/lib)
)
)
  1. restart listener
  2. create and test db link
  3. repeat steps on another node if it is a cluster and test it on each node