Friday, December 28, 2012

Query to track session generating redo


set lin 180
set pagesize 2000
col INST_ID format 999
col PROGRAM format A35
col MODULE format A35
col USERNAME format A25

select s.inst_id, s.sid, serial#, program, module, username, value redo_size
from gv$session s, gv$sesstat ss, v$statname sn
where s.sid = ss.sid
and ss.statistic# = sn.statistic#
and sn.name = 'redo size'
and s.inst_id = ss.inst_id
order by redo_size ;

Tuesday, December 18, 2012

Manual (slient) 12c agent installation


-bash-3.2$ ./emcli login -username=sysman -password=****
Login successful
-bash-3.2$ ./emcli sync
Synchronized successfully
-bash-3.2$ ./emcli get_supported_platforms
Getting list of platforms ...
Check the logs at /pkgmnoms/oms/oracle/12.1.0.2/oms/bin/agent.log
About to access self-update code path to retrieve the platforms list..
Getting Platforms list  ...
-----------------------------------------------
Version = 12.1.0.1.0
Platform = Linux x86-64
-----------------------------------------------
Version = 12.1.0.1.0
Platform = HP-UX PA-RISC (64-bit)
-----------------------------------------------
Version = 12.1.0.1.0
Platform = HP-UX Itanium
-----------------------------------------------
Version = 12.1.0.1.0
Platform = Oracle Solaris on SPARC (64-bit)
-----------------------------------------------
Platforms list displayed successfully.
-bash-3.2$
-bash-3.2$

Once done with checking of agent, we will extract agent software to any location (/tmp in our case) and transfer the software to target machine where we need to install the agent.

-bash-3.2$ ./emcli get_agentimage -destination=/tmp -platform="Oracle Solaris on SPARC (64-bit)" -version="12.1.0.1.0"
Platform:Oracle Solaris on SPARC (64-bit)
Destination:/tmp
=== Partition Detail ===
Space free : 2 GB
Space required : 1 GB
Check the logs at /tmp/get_agentimage_2012-07-17_08-16-35-AM.log
Setting property ORACLE_HOME to:/pkgmnoms/oms/oracle/12.1.0.2/oms
calling pulloneoffs with arguments:/pkgmnoms/oms/oracle/12.1.0.2/oms/pkgmnoms/oms/oracle/12.1.0.2/updates/55/C4191F66D29C0B40E0436D2028188B2212.1.0.1.0solaris
Check this logs for more information: /pkgmnoms/oms/oracle/12.1.0.2/oms/sysman/prov/agentpush/logs
-bash-3.2$ cd /tmp
-bash-3.2$ ls -lart 12.1.0.1.0*.zip
-rw-r----- 1 oracle oinstall 286075811 Jul 17 08:16 12.1.0.1.0_AgentCore_23.zip
-bash-3.2$

Scp to target machine.

After software is copied to the AGENT_BASE location, it is needed to unzip.


At target machine:

had:/app/oracle/amddhome/agent] ls
12.1.0.1.0_AgentCore_23.zip
had:/app/oracle/amddhome/agent] ls -lart
total 558744
-rwxr-xr-x   1 oracle   dba      286075811 Jul 17 12:23 12.1.0.1.0_AgentCore_23.zip
drwxrwxrwx   2 oracle   dba           96 Jul 17 12:23 .
drwxr-xr-x   6 oracle   dba         1024 Jul 17 12:23 ..
had:/app/oracle/amddhome/agent] unzip 12.1.0.1.0_AgentCore_23.zip
Archive:  12.1.0.1.0_AgentCore_23.zip
  inflating: unzip
  inflating: agentDeploy.sh
  inflating: agentimage.properties
  inflating: agent.rsp
extracting: agentcoreimage.zip
extracting: 12.1.0.1.0_PluginsOneoffs_23.zip
had:/app/oracle/amddhome/agent]


To install the agent all needed is to agent base directory, OMS_HOST, any free port and agent registration password. In case password is not known it can be changed from OEM CONSOLE SETUP -> SECURITY -> REGISTRATION PASSWORD. Once done with all the information, script is needed to execute as below.

suzan:/app/oracle/amddhome/agent] ./agentDeploy.sh AGENT_BASE_DIR=/app/oracle/amddhome/agent OMS_HOST=devd1.come.com EM_UPLOAD_PORT=4902 AGENT_REGISTRATION_PASSWORD=oracle123

AGENT_BASE_DIR=/app/oracle/amddhome/agent

-e Validating the OMS_HOST & EM_UPLOAD_PORT
Executing command : /app/oracle/amddhome/agent/core/12.1.0.1.0/jdk/bin/java -classpath /app/oracle/amddhome/agent/core/12.1.0.1.0/jlib/agentInstaller.jar:/app/oracle/amddhome/agent/core/12.1.0.1.0/oui/jlib/OraInstaller.jar oracle.sysman.agent.installer.AgentInstaller /app/oracle/amddhome/agent/core/12.1.0.1.0 /app/oracle/amddhome/agent /app/oracle/amddhome/agent -prereq

Validating oms host & port with url: http://pacdcorwdevd1.cable.comcast.com:4902/empbs/genwallet
Validating oms host & port with url: https://pacdcorwdevd1.cable.comcast.com:4902/empbs/genwallet
Return status:3
Unzipping the agentcoreimage.zip to /app/oracle/amddhome/agent ....
12.1.0.1.0_PluginsOneoffs_23.zip
Executing command : /app/oracle/amddhome/agent/unzip -o /app/oracle/amddhome/agent/12.1.0.1.0_PluginsOneoffs_23.zip -d /app/oracle/amddhome/agent
-e
Checking the ownership of agent base directory:/app/oracle/amddhome/agent
Checking for proper ownership on the agent base directory.
Checks whether the agent base directory is owned by the agent user oracle  and that its parent directory is owned by either the agent user or root.
....
Login name is : oracle & file owner is : oracle
............
Agent Base directory verification completed Successfully.
-e
Ownership check completed.
Executing command : /app/oracle/amddhome/agent/core/12.1.0.1.0/jdk/bin/java  -d64 -classpath /app/oracle/amddhome/agent/core/12.1.0.1.0/oui/jlib/OraInstaller.jar:/app/oracle/amddhome/agent/core/12.1.0.1.0/oui/jlib/xmlparserv2.jar:/app/oracle/amddhome/agent/core/12.1.0.1.0/oui/jlib/srvm.jar:/app/oracle/amddhome/agent/core/12.1.0.1.0/oui/jlib/emCfg.jar:/app/oracle/amddhome/agent/core/12.1.0.1.0/jlib/agentInstaller.jar:/app/oracle/amddhome/agent/core/12.1.0.1.0/oui/jlib/share.jar oracle.sysman.agent.installer.AgentInstaller /app/oracle/amddhome/agent/core/12.1.0.1.0 /app/oracle/amddhome/agent /app/oracle/amddhome/agent AGENT_BASE_DIR=/app/oracle/amddhome/agent AGENT_BASE_DIR=/app/oracle/amddhome/agent OMS_HOST=devd1.come.com EM_UPLOAD_PORT=4902 AGENT_REGISTRATION_PASSWORD=oracle123


Executing agent install prereqs...
Executing command: /app/oracle/amddhome/agent/core/12.1.0.1.0/oui/bin/runInstaller -ignoreSysPrereqs -prereqchecker -silent -ignoreSysPrereqs -waitForCompletion  -prereqlogloc /app/oracle/amddhome/agent/core/12.1.0.1.0/cfgtoollogs/agentDeploy -entryPoint oracle.sysman.top.agent_Complete -detailedExitCodes PREREQ_CONFIG_LOCATION=/app/oracle/amddhome/agent/core/12.1.0.1.0/prereqs
Prereq Logs Location:/app/oracle/amddhome/agent/core/12.1.0.1.0/cfgtoollogs/agentDeploy/prereq.log
Agent install prereqs completed successfully

Cloning the agent home...
Executing command: /app/oracle/amddhome/agent/core/12.1.0.1.0/oui/bin/runInstaller -ignoreSysPrereqs -clone -forceClone -silent -waitForCompletion -nowait ORACLE_HOME=/app/oracle/amddhome/agent/core/12.1.0.1.0   AGENT_BASE_DIR=/app/oracle/amddhome/agent AGENT_BASE_DIR=/app/oracle/amddhome/agent OMS_HOST=devd1.come.com EM_UPLOAD_PORT=4902 AGENT_REGISTRATION_PASSWORD=oracle123 -noconfig  ORACLE_HOME_NAME=agent12g2 -force AGENT_PORT=-1
Clone Action Logs Location:/oravl01/oracle/oraInventory/logs/cloneActions.log
Cloning of agent home completed successfully

Attaching sbin home...
Executing command: /app/oracle/amddhome/agent/core/12.1.0.1.0/oui/bin/runInstaller -ignoreSysPrereqs -attachHome -waitForCompletion -nowait ORACLE_HOME=/app/oracle/amddhome/agent/sbin ORACLE_HOME_NAME=sbin12g2 -force
Attach Home Logs Location:/app/oracle/amddhome/agent/core/12.1.0.1.0/cfgtoollogs/agentDeploy/AttachHome.log
Attach home for sbin home completed successfully.

Updating home dependencies...
Executing command: /app/oracle/amddhome/agent/core/12.1.0.1.0/oui/bin/runInstaller -ignoreSysPrereqs -updateHomeDeps -waitForCompletion HOME_DEPENDENCY_LIST="/app/oracle/amddhome/agent/sbin:/app/oracle/amddhome/agent/core/12.1.0.1.0" -invPtrLoc /app/oracle/amddhome/agent/core/12.1.0.1.0/oraInst.loc -force
Update Home Dependencies Location:/app/oracle/amddhome/agent/core/12.1.0.1.0/cfgtoollogs/agentDeploy/UpdateHomeDeps.log
Update home dependency completed successfully.

Performing the agent configuration...
Executing command: /app/oracle/amddhome/agent/core/12.1.0.1.0/oui/bin/runConfig.sh ORACLE_HOME=/app/oracle/amddhome/agent/core/12.1.0.1.0 RESPONSE_FILE=/app/oracle/amddhome/agent/core/12.1.0.1.0/agent.rsp ACTION=configure MODE=perform COMPONENT_XML={oracle.sysman.top.agent.11_1_0_1_0.xml} RERUN=true
Configuration Log Location:/app/oracle/amddhome/agent/core/12.1.0.1.0/cfgtoollogs/cfgfw/CfmLogger.log
Agent Configuration completed successfully

The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root script to run
/app/oracle/amddhome/agent/core/12.1.0.1.0/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
Agent Deployment Successful.
Agent deployment log location:
/app/oracle/amddhome/agent/core/12.1.0.1.0/cfgtoollogs/agentDeploy/agentDeploy_.log
Agent deployment completed successfully.

suzan:/app/oracle/amddhome/agent]

Agent hostname should be what is pinable from OMS server. If needed we can use ORACLE_HOSTNAME vaiable.

suzan:/app/oracle/amddhome/agent] ./agentDeploy.sh AGENT_BASE_DIR=/app/oracle/amddhome/agent OMS_HOST=devd1.come.com EM_UPLOAD_PORT=4902 AGENT_REGISTRATION_PASSWORD=oracle123 ORACLE_HOSTNAME=suzan.sys.come.net

Friday, December 14, 2012

Oracle Enterprise Manager Database Control on Windows 7


Installing Oracle Enterprise Manager Database Control on localhost machine (Windows 7).

Prerequisites:

SYS and DBSNMP password must be known, listener port and ORACLE HOME should be known.

Database should not have SYSMAN, MGMT_VIEW scheman with MGMT_USER role.

Also drop all the public synonyms for which table owner is sysman.

drop user sysman cascade;
drop role MGMT_USER;
drop user MGMT_VIEW cascade;

select 'drop public synonym ' || SYNONYM_NAME || ';' from dba_synonyms where owner='PUBLIC' and table_owner='SYSMAN';

Once done with all below.

C:\Windows\system32>emca -config dbcontrol db -repos create

STARTED EMCA at Dec 13, 2012 9:16:28 PM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: oracle
Listener port number: 1521
Listener ORACLE_HOME [ C:\app\JAYVA\product\11.2.0\dbhome_1 ]:
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Password for SYSMAN user: Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
-----------------------------------------------------------------

You have specified the following settings

Database ORACLE_HOME ................ C:\app\JAYVA\product\11.2.0\dbhome_1

Local hostname ................ localhost
Listener ORACLE_HOME ................ C:\app\JAYVA\product\11.2.0\dbhome_1
Listener port number ................ 1521
Database SID ................ oracle
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............

-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: Y
Dec 13, 2012 9:16:52 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at C:\app\JAYVA\cfgtoollogs\emca\oracle\emca_2012_12_13_21_16_28.log.
Dec 13, 2012 9:16:53 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Dec 13, 2012 9:23:32 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Dec 13, 2012 9:23:42 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Dec 13, 2012 9:24:46 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Dec 13, 2012 9:24:59 PM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
INFO: Software library configured successfully.
Dec 13, 2012 9:24:59 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Deploying Provisioning archives ...
Dec 13, 2012 9:25:34 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Provisioning archives deployed successfully.
Dec 13, 2012 9:25:34 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Dec 13, 2012 9:25:42 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Dec 13, 2012 9:25:42 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Dec 13, 2012 9:26:48 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Dec 13, 2012 9:26:49 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://localhost:5500/em <<<<<<<<<<<
Dec 13, 2012 9:26:51 PM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING:
************************  WARNING  ************************

Management Repository has been placed in secure mode wherein Enterprise Manager
data will be encrypted.  The encryption key has been placed in the file: C:/app/JAYVA/product/11.2.0/dbhome_1/localhost_oracle/sysman/config/emkey.ora.  
Please ensure this file is backed up as the encrypted data will become unusable if this file is lost.

***********************************************************
Enterprise Manager configuration completed successfully
FINISHED EMCA at Dec 13, 2012 9:26:51 PM

C:\Windows\system32>

In case of any issue, please check log on location:

ORACLE_BASE\cfgtoollogs\emca\\ emca_repos_create_.log.

In case you get error for ORACLE_UNQNAME as below:

C:\Users\jayva>emctl status dbconsole
Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.

C:\Users\jayva>

Check for file at location ORACLE_HOME\ oc4j\j2ee\ OC4J_DBConsole_localhost_oracle

Here localhost is the hostname & oracle is unqname. Might be differ in your environment.