SEC2
2017-02-07 23:35 ᵬyŧểᵬyŧȅ 阅读(770) 评论(0) 编辑 收藏 举报201 - Install and Patch Enterprise Manager Grid Control Software
1. 文档(EM)
l Enterprise Manager Grid Control Advanced Installation and Configuration Guide
2. GC 软件安装目录
Database: /u01/app/oracle/product/11.2.0/dbhome_1
WebLogic: /u01/app/oracle/middleware
EM GC: /u01/app/oracle/gc_inst
3. 建立虚拟机 EVEN
1)复制 ODD VM Template,建立新 VM EVEN,修改其中的 ODD.vmx 文件:
displayName = "EVEN"
2)添加新 VM 到 VMware
File ->
-> Open ->
-> Select "D:\VM\EVEN\ODD.vmx" - >
-> Open
3)修改新 VM 的内存
Click "Edit virtual machine settings" - >
-> "Memory for this virtual machine" = 4096
4)配置新 VM 的网卡 MAC
Click "Edit virtual machine settings" - >
-> Click "Network Adapter" - >
-> Click "Advanced" - >
-> Click "Generate"
5)启动新 VM EVEN,login as root
Select to confirm that we have copied the virtual machine.
-- Open a terminal to setup the network
-- Delete the "eth0.bak" and modify the "eth0″.
system-config-network
第 1 页 共 14 页
ORACLE 11g OCM
Click "eth0" ->
-> Click "Edit" ->
-> Select "Statically set IP addresses" ->
-> Address="192.168.23.30",Subnet Mask="255.255.255.0", Gateway address="192.168.23.2" ->
-> Click "OK" - >
-> Click "Deactivate" - >
-> Click "Activate" - >
-> Click "File" - >
-> Click "Save"
6)修改新 VM 的 HOSTNAME
-- Edit the file "/etc/sysconfig/network"
HOSTNAME=even.oracle.com
-- Active the new host name
hostname even.oracle.com
7)修改 hosts 文件
vi /etc/hosts
-- 注意保留以下 2 行不要修改
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
-- 按练习环境的网络配置添加以下 host
192.168.23.20 odd.oracle.com odd
192.168.23.30 even.oracle.com even
8)检查 oracle user limits
vi /etc/security/limits.conf
-- Check and add the following lines at the end of file
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 4096
oracle hard nofile 65536
oracle soft stack 10240
9)检查 OS settings
vi /etc/sysctl.conf
-- 按 Oracle 文档要求修正以下各参数:
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
第 2 页 共 14 页
ORACLE 11g OCM
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
-- 修改后加载新的设置参数
/sbin/sysctl -p
10)Check or create the necessary directories .
mkdir -p /u01/app/oraInventory
mkdir -p /u01/app/oracle/oradata
mkdir -p /u01/app/oracle/fast_recovery_area
chown -R oracle:oinstall /u01/app/oracle
chown -R oracle:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oracle
chmod -R 775 /u01/app/oraInventory
11)Check the groups of user oracle
usermod -G dba,oper,asmadmin,asmdba,asmoper oracle
12)Change the OS ntpd service
vi /etc/sysconfig/ntpd
-- Change to the following setting
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"
-- Save and restart the NTP daemon
service ntpd restart
13)加载 OEL 安装盘,检查安装所需的其它软件包
Click VMWare "VM" - >
-> Click "Removable Devices" - >
-> Click "CD/DVD (IDE)" - >
-> Click "Settings" - >
-> Click "Browse" - >
-> Select Oracle Linux "Enterprise-R5-U4-Server-i386-dvd.iso" ISO - >
-> Click "Open" - >
-> Click "Connected" - >
-> Click "OK"
cd /media/Enterprise\ Linux\ dvd\ 20090908/Server/
rpm -Uvh compat-db-4.2.52-5.1.i386.rpm
14)复制安装软件到 VM EVEN 的/stage 目录(as user oracle)
· p10404530_112030_LINUX_1of7.zip
第 3 页 共 14 页
ORACLE 11g OCM
· p10404530_112030_LINUX_2of7.zip
· GridControl_11.1.0.1.0_Linux_1of3.zip
· GridControl_11.1.0.1.0_Linux_2of3.zip
· GridControl_11.1.0.1.0_Linux_1of3.zip
· wls1032_linux32.bin
15)Unzip the DB software as user oracle
cd /stage
unzip p10404530_112030_LINUX_1of7.zip
unzip p10404530_112030_LINUX_2of7.zip
rm p10404530_112030_LINUX_1of7.zip
rm p10404530_112030_LINUX_2of7.zip
16)配置环境(as user oracle)
vi /home/oracle/profile_emrep
-- Add the following lines
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=EMREP
export PATH=$ORACLE_HOME/bin:$PATH
-- 设置环境变量
. ~/profile_emrep
4. 安装 Oracle DB 软件
Run "/stage/database/runInstaller " as user oracle ->
-> Deselect "I wish to receive security updates vi My Oracle Support." ->
-> Click "Skip software updates" ->
-> Click "Install database software only" ->
-> Click the default "Single instance installation database" ->
-> Select only the "English" language ->
-> Select default "Enterprise Edition (4 GB)" ->
-> Oracle Base = "/u01/app/oracle"
Software Location = "/u01/app/oracle/product/11.2.0/dbhome_1 " ->
-> Inventory Location = "/u01/app/oraInventory " ->
-> oraInventory Group Name = "oinstall" - >
-> Database Administrator (OSDBA) Group = "dba"
Database Operator (OSOPER) Group = "oinstall" ->
-> Click "Install" ->
-> Run the two scripts as root
"/u01/app/oraInventory/orainstRoot.sh "
"/u01/app/oracle/product/11.2.0/dbhome_1/root.sh " ->
第 4 页 共 14 页
ORACLE 11g OCM
-> Click "OK" - >
-> Click "Close"
5. 建立 OMS DB
Run "dbca" as user oracle ->
-> Select "Create database" - >
-> Select "General Purpose or Transaction Processing" - >
-> Global Database Name = "EMREP.oracle.com" and SID = "EMREP" - >
-> Deselect "Configure Enterprise Manager" - >
-> Select "Use the Same Administrative Password for All Account"->
-> Password = "oracle" and Confirm Password = "oracle" - >
-> Storage Type = "File System" - >
-> Select "Use Common Location for All Database Files"->
-> Database Files Location = "{ORACLE_BASE}/oradata " - >
-> Select the default settings for Fast Recovery Area - >
-> Select "Enable Archiving" - >
-> Click "Memory" Tab -> Enter the memory size 700MB and select Use Automatic Memory Management
-> Click "Character Sets" Tab -> Click "Use Unicode (AL32UTF8)" - >
-> Click "Finish" - >
-> Click "OK" ->
-> Click "Exit"
6. 建立网络配置
Run "netca" as user oracle
Select "Listener configuration" ->
-> Select "Add" ->
-> Select the default name "LISTENER" ->
-> Highlight the IPC and add it to the "Selected Protocols" list ->
-> Select the default "Use the standard port number of 1521" ->
-> IPC Key value = "extproc" ->
-> Click next ->...
Select "Local Net Service Name configuration"->
-> Click "Add" ->
-> Service Name = "EMREP.oracle.com" ->
-> Click "TCP" ->
-> Host name = "even.oracle.com" ->
-> Select "Yes, perform a test" ->
-> Username = "system" and Password = "oracle" -> ... ->
-> Net Service Name = "EMREP" ->
第 5 页 共 14 页
ORACLE 11g OCM
-> Click next ->...
Select "Naming Methods configuration" ->
-> Move methods "Local Naming", "Directory Naming" and "Easy Connect Naming" ->
-> Click "Finish"
7. GC 安装前检查
1)参照 EM 文档及系统环境要求,检查修正以下参数或设置:
· cluster_database: TRUE (Only for RAC)
· compatible: 10.2.0.1.0 or higher
· max_commit_propagation_delay: 0
· remote_login_passwordfile: SHARED or EXCLUSIVE
· statistics_level: TYPICAL
· TIMED_STATISTICS: TRUE
· UNDO_MANAGEMENT: AUTO
· workarea_size_policy: AUTO
· DB_BLOCK_SIZE: 8192 or greater
· instance_groups
· JOB_QUEUE_PROCESSES: 10 or greater
· log_buffer: 10485760 or greater
· memory_target
· open_cursors: 300 or greater
· parallel_instance_group
· processes: 500 or greater
· session_cached_cursors: 200 or greater
· sga_target
· undo tablespace size: 200M or greater
-- Modify the parameters in the SPFILE
alter system set processes=500 scope=spfile;
alter system set session_cached_cursors=200 scope=spfile;
alter system set log_buffer=10485760 scope=spfile;
alter database datafile '/u01/app/oracle/oradata/EMREP/undotbs01.dbf' resize 250M;
-- Restart the instance
shutdown immediate
startup
2)删除本地 EM DC 资料库
-- Run as oracle
$ORACLE_HOME/bin/emca -deconfig dbcontrol db -repos drop
-- ORACLE_SID = "EMREP", Port = "1521", SYS and SYSMAN Password = "oracle"
第 6 页 共 14 页
ORACLE 11g OCM
8. 安装 Weblogic Server
1)安装 Weblogic Server 10.3.2
-- As user oracle
cd /stage
chmod u+x wls1032_linux32.bin
./wls1032_linux32.bin
Click next ->
-> Middleware Home Directory = "/u01/app/oracle/middleware " ->
-> Click next ->
-> Deselect "I wish to receive security updates via My Oracle Support" ->
-> In the pop-up window Click "Yes" ->
-> Click next - >
-> Select default "Typical" ->
-> Click next ->
-> Click next ->
-> Click next ->
-> Deselect "Run Quickstart" ->
-> Click "Done"
-- Delete the installation file
rm /stage/wls1032_linux32.bin
2)安装 Smart Update 3.3.0
· p12426828_1035_Generic.zip -> /stage
· jdk-6u18-linux-i586.bin -> /stage
-- Install jdk 1.6 (as user oracle)
cd /stage
chmod u+x jdk-6u18-linux-i586.bin
./jdk-6u18-linux-i586.bin
vi /stage/profile_jdk16
-- Add the following settings
export JAVA_HOME=/stage/jdk1.6.0_18
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
-- Active jdk 1.6 settings
. /stage/profile_jdk16
-- Install Smart Update 3.3.0
cd /stage
unzip p12426828_1035_Generic.zip
java -jar patch-client-installer330_generic32.jar
第 7 页 共 14 页
ORACLE 11g OCM
Click next ->
-> Select "Use an existing Middleware Home" ->
-> Click next - >
-> Select default "Typical" ->
-> Click next -> ...
3)安装 Weblogic Server 补丁
· p9438213_10320_Generic.zip -> /stage
-- Unzip the patch 9438213
cd /stage
unzip p9438213_10320_Generic.zip
-- Create the path for patches
mkdir -p /u01/app/oracle/middleware/utils/bsu/cache_dir
-- Move the contents to the new path
mv *.xml /u01/app/oracle/middleware/utils/bsu/cache_dir
mv *.jar /u01/app/oracle/middleware/utils/bsu/cache_dir
-- Start the Smart Update
-- click "Yes" to update to Smart Update v3.3.0 online
cd /u01/app/oracle/middleware/utils/bsu
./bsu.sh
-- Click the green arrow on WDJ7 to install all patches WDJ7/NIXN/4D53/XLXA
第 8 页 共 14 页
ORACLE 11g OCM
9. 安装 Grid Control
1)安装 GC 软件
-- Unzip Grid Control 11.1.0.1 as user oracle
cd /stage
unzip GridControl_11.1.0.1.0_Linux_1of3.zip
unzip GridControl_11.1.0.1.0_Linux_2of3.zip
unzip GridControl_11.1.0.1.0_Linux_3of3.zip
rm GridControl_11.1.0.1.0_Linux_1of3.zip
rm GridControl_11.1.0.1.0_Linux_2of3.zip
rm GridControl_11.1.0.1.0_Linux_3of3.zip
-- 建议在练习安装 GC 前,先在此保存 VM EVEN 的快照.
-- Run the installer
/stage/runInstaller
Deselect "I wish to receive security updates via My Oracle Support"->
-> In the pop-up window click "Yes" - >
-> Select "Skip Software Updates"->
-> Select "Install a new Enterprise Manager System"->
-> Middleware home location = "/u01/app/oracle/middleware " ->
-> OMS Instance base location = "/u01/app/oracle/gc_inst" ->
第 9 页 共 14 页
ORACLE 11g OCM
-> Click next ->
-> Enter a password for Weblogic and the Node Manager = "***" (e.g."oracle12") ->
-> Click next - >
-> Database Host Name = "even.oracle.com",
Port = 1521, Service/SID = EMREP, SYS Password = "oracle" ->
-> Click next ->
-> SYSMAN Password / Confirm Password = "***" (e.g."oracle12") ->
-> Select the default location for TBS ->
-> Click next ->
-> Registration Agent Password / Confirm Password = "***" (e.g."oracle12") ->
-> Click next ->
-> Click next ->
-> Click "Install" ->
-> Run the script as root "/u01/app/oracle/middleware/oms11g/allroot.sh"
Press the Enter key for each of the prompts. ->
-> Click "OK" - >
-> Click "Close"
2)登录检查 EM GC
l Enterprise Manager Grid Control URL: https://even.oracle.com:7799/em
Login as user/pwd: sysman/***. Accept the Oracle license at first.
l WebLogic Admin Server URL: https://even.oracle.com:7101/console
Login as user/pwd: weblogic/***
3)注册本机 EMREP DB
-- Unlock the DBSNMP user in the EMREP DB
alter user dbsnmp identified by "oracle" account unlock;
Click "Alerts" -> Click "Unknown Availability" ->
-> Click "EMREP.oracle.com" in the Target column ->
-> Click "Configure" - >
-> Monitor Password = "oracle"->
-> Click "Test Connection" - >
-> Click next - >
-> Click "Submit"
10. 安装 GC 补丁
1) Install common patches
· p6880880_111000_LINUX.zip -> /stage (updated OPatch version)
· p9431704_111120_Generic.zip -> /stage (common patch for GC)
-- Unzip the patch 6880880
cd /stage
第 10 页 共 14 页
ORACLE 11g OCM
unzip p6880880_111000_LINUX.zip
rm p6880880_111000_LINUX.zip
-- Make a backup
mv /u01/app/oracle/middleware/oracle_common/OPatch
/u01/app/oracle/middleware/oracle_common/OPatch_bkup
-- OPatch utility upgrade
cp -pR /stage/OPatch /u01/app/oracle/middleware/oracle_common/OPatch
-- Check the upgrade version
/u01/app/oracle/middleware/oracle_common/OPatch/opatch version
OPatch Version: 11.1.0.11.0
-- Unzip the patch 9431704
cd /stage
unzip p9431704_111120_Generic.zip
rm p9431704_111120_Generic.zip
-- Stop OMS
export MW_HOME=/u01/app/oracle/middleware
$MW_HOME/oms11g/bin/emctl stop oms -all
-- Apply the patch
cd /stage/9431704
export ORACLE_HOME=/u01/app/oracle/middleware/oracle_common
$ORACLE_HOME/OPatch/opatch apply
-- Start OMS (也可待以下的 patches 安装后再启动)
export MW_HOME=/u01/app/oracle/middleware
$MW_HOME/oms11g/bin/emctl start oms
2) Install PSU for OMS and the agent
· p9346282_111010_LINUX.zip - > /stage (PSU 7 for agent)
· p9914120_111010_Generic.zip - > /stage (patch for agent)
· p12620174_111010_Generic.zip - > /stage (patch for PSU 9 of OMS)
· p16572176_111010_Generic.zip - > /stage (PSU 9 of OMS)
· p13536618_111019_Generic.zip - > /stage (resource manager patch for OMS PSU 9)
-- Stop the agent and the OMS service before installing the patches
/u01/app/oracle/middleware/agent11g/bin/emctl stop agent
/u01/app/oracle/middleware/oms11g/bin/emctl stop oms -all
------------------------------------------------------------------
-- Install the patches for agent
export ORACLE_HOME=/u01/app/oracle/middleware/agent11g
-- Update the OPatch utility of Agent
mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch_bkup
cp -pR /stage/OPatch $ORACLE_HOME/OPatch
-- Unzip the patch 9346282
cd /stage
unzip p9346282_111010_LINUX.zip
rm p9346282_111010_LINUX.zip
第 11 页 共 14 页
ORACLE 11g OCM
-- Apply the patch 9346282
cd /stage/9346282
$ORACLE_HOME/OPatch/opatch apply
-- Unzip the patch 9914120
cd /stage
unzip p9914120_111010_Generic.zip
rm p9914120_111010_Generic.zip
-- Apply the patch 9914120
cd /stage/9914120
$ORACLE_HOME/OPatch/opatch apply
------------------------------------------------------------------
-- Install the patches for OMS
export ORACLE_HOME=/u01/app/oracle/middleware/oms11g
-- Update the OPatch utility of OMS
mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch_bkup
cp -pR /stage/OPatch $ORACLE_HOME/OPatch
-- Unzip the patch 12620174
cd /stage
unzip p12620174_111010_Generic.zip
rm p12620174_111010_Generic.zip
-- Apply the patch 12620174
cd /stage/12620174
$ORACLE_HOME/OPatch/opatch napply
$ORACLE_HOME/bin/rcuJDBCEngine sys/oracle@even.oracle.com:1521:EMREP JDBC_SCRIPT
10154264/patch_10154264.sql $PWD $ORACLE_HOME
-- Unzip the patch 16572176
cd /stage
unzip p16572176_111010_Generic.zip
rm p16572176_111010_Generic.zip
-- Apply patch 16572176
cd /stage/16572176
$ORACLE_HOME/OPatch/opatch apply
$ORACLE_HOME/bin/rcuJDBCEngine sysman/oracle12@even.oracle.com:1521:EMREP JDBC_SCRIPT
apply.sql $PWD $ORACLE_HOME
$ORACLE_HOME/bin/emctl secure console -self_signed
-- Unzip the patch 13536618
cd /stage
unzip p13536618_111019_Generic.zip
rm p13536618_111019_Generic.zip
-- Apply the patch 13536618
cd /stage/13536618
$ORACLE_HOME/OPatch/opatch apply
------------------------------------------------------------------
-- Restart the service of agent and OMS
/u01/app/oracle/middleware/oms11g/bin/emctl start oms
第 12 页 共 14 页
ORACLE 11g OCM
/u01/app/oracle/middleware/agent11g/bin/emctl start agent
-- Delete the patches software in /stage
rm -Rf /stage/*
11. 启动/关闭 GC
Create the profiles for OMS(Oracle Management Service), Agent and Database
-- Add the following lines to the file /home/oracle/profile_oms
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/middleware/oms11g
export PATH=$ORACLE_HOME/bin:$PATH
-- Add the following lines to the file /home/oracle/profile_agent
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/middleware/agent11g
export PATH=$ORACLE_HOME/bin:$PATH
-- Add the following lines to the file /home/oracle/profile_emrep
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=EMREP
export PATH=$ORACLE_HOME/bin:$PATH
The order to stop and start all applications in the EVEN host.
-- Stop AGENT
. /home/oracle/profile_agent
emctl stop agent
-- Stop OMS
. /home/oracle/profile_oms
emctl stop oms
-- Stop DB
. /home/oracle/profile_emrep
sqlplus / as sysdba
shutdown immediate
-- Stop LISTENER
lsnrctl stop
------------------------------------------------------------------
-- Start LISTENER
. /home/oracle/profile_emrep
lsnrctl start
-- Start DB
sqlplus / as sysdba
startup
第 13 页 共 14 页
ORACLE 11g OCM
-- Start OMS
. /home/oracle/profile_oms
emctl start oms
-- Start AGENT
. /home/oracle/profile_agent
emctl start agent
12. 补充参考
-- 1. 取消开机自动启动 GC (as user root)
mv /etc/init.d/gcstartup /home/oracle/
-- 2. 修改 EM GC 管理员 SYSMAN 密码 (as user oracle)
. /home/oracle/profile_oms
emctl config oms -change_repos_pwd -change_in_db
emctl stop oms -all
emctl start oms
第 14 页 共 14 页
ORACLE 11g OCM
202 - Configure the Enterprise Manager
Repository
1. 文档(EM)
l Enterprise Manager Grid Control Advanced Installation and Configuration Guide -> 3 Installing
Enterprise Manager System -> Prerequisites
参照上一节内容
【201 - Install and Patch Enterprise Manager Grid Control Software】
第 1 页 共 1 页
ORACLE 11g OCM
203 - Create Enterprise Manager Grid
Control Users
1. 文档(EM)
l Administrator's Guide -> 2 Enterprise Manager Security
2. 建立 EM GC 用户
Home of Grid Control EM (https://even.oracle.com:7799/em) ->
-> login with user/pwd: sysman/*** (本例:oracle12) ->
-> Click Setup ->
-> Click "Administrators" ->
-> Click "Create" ->
-> Name = "OCM" ->
-> Password / Confirm Password = "***" (本例: 123)->
-> Password Profile = "DEFAULT" ->
-> E-mail Address = "ocm@oracle.com" (optional) ->
-> Select "Super Administrator" ->
-> Click next ->
-> Click "Finish"
3. 检验 EM GC 用户
-- 查看用户属性
select username, account_status, default_tablespace, profile
from dba_users
where username='OCM';
-- 用户角色(Role)
select granted_role, grantee from dba_role_privs where grantee='OCM';
第 1 页 共 2 页
ORACLE 11g OCM
4. GC 用户登录
Click "Logout" ->
-> Click Login ->
-> User name = "ocm" -> (注意:username 不分大小写,password 区分大小写)
-> Password = "***" ->
-> Click login
5. 预设用户登录身份
Click "Preferences" ->
-> Click "Preferred Credentials" ->
-> Click on "Set Credentials" icon in the row of "Database instance" ->
-> Fill all passwords for the target EMREP.oracle.com:
Username=ocm, Password=***,
SYSDBA Username=sys, SYSDBA Password=***,
Host Username=oracle, Host Password=*** ->
-> Click on "Test" for the EMREP DB ->
-> Click "Apply"
Log in EM GC as user OCM to access with predefined credentials.
Click on "Targets" - >
-> Click "Databases" - >
-> Click "EMREP.oracle.com" - >
-> Click "Performance"
(选择以 SYSDBA 登录数据库,将不再需要输入 username 和 password 验证)
第 2 页 共 2 页
ORACLE 11g OCM
204 - Use Enterprise Manager to Modify a
Database Configuration
1. 文档(EM)
l Enterprise Manager Concepts -> 6 Database Management
2. 修改 DB 参数
Click Targets ->
-> Click Databases ->
-> Click "EMREP.oracle.com" ->
-> Click "Server" ->
-> Click Database Configuration "Initialization Parameters" ->
-> Click tab "Current" to modify/add parameters in memory/spfile -> Click "Show SQL"/"Apply"
-> Click tab "SPFile" to modify/add parameters in spfile -> Click "Show SQL"/"Apply"
3. Memory Advisors(内存顾问)
Click Targets ->
-> Click Databases ->
-> Click "EMREP.oracle.com" ->
-> Click "Server" ->
-> Click Database Configuration "Memory Advisors" ->
-> Click "Advice" to check the percentage improvement curve
EM GC 联机文档查阅:
Home page -> Click "Help" (右上角) -> Click "Contents" ->
· Administering an Oracle Database
· Database Management -> Managing and Monitoring Real Application Clusters
· Database Management -> Managing Net Services
· Managing Grid Control -> Managing and Monitoring the Scheduler
· Additional Database Management Topics -> Administering and Maintaining Oracle Databases
第 1 页 共 1 页
ORACLE 11g OCM
205 - Configure Enterprise Manager to
Modify a Database Availability
本节用奇数机(ODD) PROD1 DB 做练习,须先安装 GC agent.
1. 关闭/启动数据库
Click "Targets" - >
-> Click "Databases" - >
-> Click "PROD1.oracle.com" - >
-> Click "Shutdown" - >
-> Click "OK" - >
-> Click "Advanced Options" - >
-> See by default that is turned off with the "Immediate" option - >
-> Click "OK" - >
-> Click "Yes"
Now start up the PROD1 instance.
Click "Startup" >
-> Click "OK" - >
-> Select Startup Type: by default is "Start database along with dependent resources" ->
-> Click "OK" - >
-> Click "Advanced Options"->
-> Review Startup options: : by default is "Open the database" - >
-> Click "OK" - >
-> Click "Yes"
2. Maximum Availability Architecture (MAA) Advisor
Need to login as SYS(SYSDBA) into the EM database PROD1.oracle.com
Click "Targets" - >
-> Click "Databases" - >
-> Click "PROD1.oracle.com" - >
-> Click Tab "Availability" - >
-> Click link "Maximum Availability Architecture (MAA) Advisor"
-> Click "Configure Flashback Database" - >
-> Select "Enable Flashback Database"->
-> Leave default 24-hour retention (Flashback Retention Time) - >
-> Click "Apply" - >
-> Click "Yes" - >
第 1 页 共 2 页
ORACLE 11g OCM
-> Click "OK" - >
-> Click "Yes"
第 2 页 共 2 页
ORACLE 11g OCM
206 - Create and Manage Jobs
1. 文档(EM)
l Administrator's Guide -> 6 Job System
本节用奇数机(ODD) PROD1 DB 做练习,须先安装 GC agent.
2. Job(作业)设置
l Jobs in EM GC
l Jobs in EM DC:Targets -> Database -> Server -> Oracle Scheduler
3. EM GC 的 Job
Create Job ->
· Add Middleware Homes
· Block Agent
· Clone Home
· Log Rotation
· OPatch Update
· OS Command
· patch Agent
· Refresh From My Oracle Support
· Restart OPMN Component
· RMAN Script
· Security Policy Configuration
· Shutdown Database
· SQL Script
· Start OPMN Component
· Startup Database
· STATSPACK Purge
· Stop OPMN Component
· Update My Oracle Support Component
· WebLogic Control
· Multi-Task
第 1 页 共 4 页
ORACLE 11g OCM
1) "OS Command" Job
例子:Run an OS cmd on both hosts every 1 minutes.
On the EM home page, click on "Jobs" in the top tab ->
-> Click "Job Activity" - >
-> Create Job = "OS Command" ->
-> Click "Go" - >
-> Name = "Test OS Command" ->
-> Description = "Job test on EM" ->
-> Target Type = "Host" ->
-> Click "Add" ->
-> Click "Select All" ->
-> Click "Select" ->
-> Click tab "Parameters" ->
-> Command Type = "Single Operation" ->
-> Command = "date > > /tmp/job_output.tmp" ->
-> Click tab "Credentials" ->
-> Select "Override Preferred credentials" ->
-> Username = "oracle" ->
-> Password / Confirm Password = "***" ->
-> Click tab "Schedule" ->
-> Select "Repeating" ->
-> Frequency Type = "By Minutes" ->
-> Repeat Every = "1" Minutes ->
-> Time Zone = "Each target's timezone" ->
-> Repeat Until = "Indefinite" ->
-> Click tab "Access" (leave the options by default) ->
-> Click "Submit"
Check the result of Job Activity:
Click tab "Job Activity" ->
-> Status = "All" ->
-> Click "Go" ->
-> Select "TEST_OS_COMMAND" (anyone have execution status = "Succeeded") ->
-> Click "View Results" ->
-> Click "Show" ("Details" column) in both Targets
Check job's output file "/tmp/job_output.tmp"
ls -l /tmp/job_output.tmp
cat /tmp/job_output.tmp
Remove the job:
Click "Job Activity" - >
-> Status = "Scheduled" - >
第 2 页 共 4 页
ORACLE 11g OCM
-> Click "Go" - >
-> Select "TEST OS COMMAND" ->
-> Click "Delete" - >
-> Select "Delete all runs of job" ->
-> Click "OK"
2) "Block Agent" Job
例子:Block the agent of host ODD.
Click "Jobs" - >
-> Click "Job Activity" - >
-> Create Job = "Block Agent" - >
-> Click "Go" - >
-> Name = "TestBlockAgent" - >
-> Description "Testing the Block Agent Job '->
-> Click "Add" - >
-> Select "odd.oracle.com:3872″ - >"
-> Click "Select" - >
-> Click Schedule (leave the values by default) - >
-> Click "Submit"
Wait a few minutes to check the job result and unblock the agent:
Click "Targets" - >
-> Click "All Targets" - >
-> Click Agent "odd.oracle.com:3872" - >
-> Check out a banner of "Error" indicating that that the agent is Blocked - >
-> Click "Unblock"
3) "Multi-Task" Job
Multi-Task job allows to create chains of nested jobs that are executed based on the status of
success or failure of a prior job.
Click "Jobs" - >
-> Create Job = "Multi-Task" - >
-> Click "Go" - >
-> Name = "MULTI_TASK_TEST" - >
-> Description = "test work Multi-Task" ->
-> Target = "Different targets for different tasks" ->
-> Click tab "Tasks" - >
-> Type = "SQL Script"->
-> Click "Add" - >
-> Name = "EVEN_SQL_SCRIPT" - >
第 3 页 共 4 页
ORACLE 11g OCM
-> Click "Add" in the Target section - >
-> Select "EMREP.oracle.com" - >
-> Click "Select" - >
-> Click tab "Parameters" - >
-> Insert the following text in SQL Script
WHENEVER SQLERROR EXIT SQL.SQLCODE
select column_does_not_exist from dual;
-> Click "Credentials" - >
-> Select "Override Preferred Credentials" ->
-> Host Username = "oracle" - >
-> Password / Confirm Password = "***" ->
-> Database Username = "sys" - >
-> Password / Confirm Password = "***" ->
-> Click "Continue" - >
-> Type = "OS Command" ->
-> Click "Add" ->
-> Name = "ODD_OS_SCRIPT" - >
-> Condition = "On Failure" - >
-> Depends On = "EVEN_SQL_SCRIPT" - >
-> Click "Add" in the Target section - >
-> Select "odd.oracle.com" - >
-> Click "Select" - >
-> Click tab "Parameters" - >
-> Command = "date >> /tmp/job_output.tmp" ->
-> Click "Credentials" - >
-> Select "Override Preferred Credentials"->
-> Username = "oracle" - >
-> Password / Confirm Password = "***"->
-> Click "Continue" - >
-> Click "Submit"
Check the job's result on "Job Activity" page:
the Job (MULTI_TASK_TEST) Status = "Succeeded".
Click into the Job:
1st Task (Task: EVEN_SQL_SCRIPT) is Failed
2nd task (Task: ODD_OS_SCRIPT) is Succeeded.
第 4 页 共 4 页
ORACLE 11g OCM
207 - Create And Monitor Alerts
1. 文档(EM)
l Administrator's Guide - > 1 Monitoring
l Administrator's Guide - > 4 User-Defined Metrics
2. Alerts(警告)和 Metrics(量度)
Home of OEM - >
-> Click "Targets" - >
-> Click "Databases" - >
-> Click "Search List" - >
-> Click "EMREP.oracle.com"
In the "Related Links" section, there are various links of alerts and metrics.
l Metric Collection Errors -> errors found by the agent when evaluating metrics
l All Metrics -> performance metrics available for the Target
l Baseline Metric Thresholds -> metrics based on Baselines (allows us to configure alerts for
OLTP and DW)
l Metric and Policy Settings -> configuration of the different metric thresholds
l Alert History -> chronological history of alerts
l Metric Baselines -> configuration of the Baseline active
l User-Defined Metrics -> user-defined metrics management
3. Metric and Policy Settings
Modify the threshold of "Failed Login Count"
Click "Metric and Policy Settings" ->
-> Edit "Failed Login Count" Warning Threshold = 3 ->
-> Click "Every 30 Minutes" in "Failed Login Count" ->
-> Repeat Every = 5 Minutes ->
-> Click "Continue" ->
-> Click "OK" ->
-> Click "OK"
-- Log in as user system with the error password for more than 3 times
sqlplus system/error@prod1
第 1 页 共 3 页
ORACLE 11g OCM
-- After 5 minutes we will see the alerts of Failed Login Count (severity => Warning).
Reset the original settings.
Click "Metric and Policy Settings" ->
-> Edit "Failed Login Count" Warning Threshold = 150 ->
-> Click "Every 5 Minutes" in "Failed Login Count" ->
-> Repeat Every = 30 Minutes ->
-> Click "Continue" ->
-> Click "OK" ->
-> Click "OK"
4. User-defined Metrics
Click "User-Defined Metrics" ->
-> Click "Create" ->
-> Metric Name = "Cursor Usage" ->
-> Metric Type = "Number" ->
-> SQL Query Output = "Single Value" ->
-> SQL Query =
SELECT MAX(A.VALUE) "MAXCURSORS"
FROM V$SESSTAT A, V$STATNAME B
WHERE A.STATISTIC# = B.STATISTIC#
AND B.NAME='opened cursors current'
ORDER BY A.VALUE;
-> User Name = "DBSNMP" ->
-> Password = "***" ->
-> Comparison Operator = ">" ->
-> Warning = "150" - >
-> Critical = "200" - >
-> Alert Message = "Maximum Cursor Usage (value = %value%)" ->
-> Repeat every "5" Minutes - >
-> Click "Test" - >
-> Click "OK"
Delete user-defined metrics:
Click "User-Defined Metrics"->
-> Select our alert "Cursor Usage" - >
-> Click "Delete" - >
-> Click "Yes"
第 2 页 共 3 页
ORACLE 11g OCM
5. Baseline Metric Thresholds
Set thresholds for BASELINE metrics.
For example: Define the threshold for a metric of "Number of Transactions (per second)".
Home of database EMREP - >
-> Click "Baseline Metric Thresholds" ->
-> View = "Basic Metrics" - >
-> Click "Number of Transactions (per second)" ->
-> Critical = "Very High (0.99)" - >
-> Warning = "High (0.95)" - >
-> Occurrences = 1 - >
-> Click "Preview" (see the thresholds on the chart) - >
-> Click "Apply Thresholds"
第 3 页 共 3 页
ORACLE 11g OCM
208 - Create Notifications
1. 文档(EM)
l Administrator's Guide - > 3 Notifications
2. 设置 Email SMTP Server
Click "Setup" - >
-> Click "Notification Methods" - >
-> Outgoing Mail (SMTP) Server = "smtp.qq.com:465" ->
-> User Name = "myemail@qq.com" - >
-> Password / Confirm Password = "******"->
-> Identify Sender As = "OCM Notifications"->
-> Sender's E-mail Address = "myemail@qq.com" ->
-> Use Secure Connection = "SSL" ->
-> Click "Apply" ->
-> Click "Test Mail Servers"->
-> Click "OK"
3. Email 接收通知
Click "Preferences" - >
-> Check "Add Another Row" in the "E-mail Addresses" section:
Add and select your email address (e.g. myemail@qq.com) to receive the notifications ->
-> Select the Message Format = "Long Format" - >
-> Click "Apply"
4. Email 通知类型
Click "Preferences" - >
-> Click "Rules" - >
-> Click "Subscribe (Send E-mail)" in "Agent Upload Problems"->
-> Click "Subscribe (Send E-mail)" in "Agents Unreachable" - >
-> Click "Subscribe (Send E-mail)" in "Database Availability and Critical States"->
-> Click "Subscribe (Send E-mail)" in "Host Availability and Critical States"->
第 1 页 共 4 页
ORACLE 11g OCM
-> Click "Subscribe (Send E-mail)" in "Listener Availability" - >
-> Click "Apply"
可以关闭 PROD1 instance 测试接收 Email 通知。
5. 通知规则管理
Click "Preferences" - >
-> Click "Rules" - >
-> Select "Database Availability and Critical States" ->
-> Click "View" to view the metrics included in this rule.
-> Click "Edit" to add new metrics or delete the current metrics
-> Click "Create"/"Create Like" to create a new rule with specific metrics.
6. Email 通知格式
Click "Setup" ->
-> Click "E-mail Customization" ->
-> Select Alert Type = "Metric Alert" ->
-> Click "Edit"
7. 其他通知方式
Setup a notification by an OS command.
Create a command file "/tmp/testoscommand.sh" with the oracle user on the EVEN host,
and output the log file "/tmp/testoscommand.log".
vi /tmp/testoscommand.sh
-- Add the following lines
#!/bin/sh
LOG_FILE=/tmp/testoscommand.log
echo "Alert logged:" >> $LOG_FILE
echo "" >> $LOG_FILE
echo "target name is " $TARGET_NAME >> $LOG_FILE
echo "target type is " $TARGET_TYPE >> $LOG_FILE
echo "target is on host " $HOST >> $LOG_FILE
echo "metric in alert is " $METRIC >> $LOG_FILE
echo "metric index is " $KEY_VALUE >> $LOG_FILE
echo "timestamp is " $TIMESTAMP >> $LOG_FILE
第 2 页 共 4 页
ORACLE 11g OCM
echo "severity is " $SEVERITY >> $LOG_FILE
echo "message is " $MESSAGE >> $LOG_FILE
echo "notification rule is " $RULE_NAME >> $LOG_FILE
echo "rule owner is " $RULE_OWNER >> $LOG_FILE
--Set execute permissions
chmod u+x /tmp/testoscommand.sh
Configure the notification in a Grid Control.
Click "Setup" - >
-> Click "Notification Methods" - >
-> Add = "OS Command"->
-> Click "Go" - >
-> Name = "Test OS Command"->
-> OS Command = "/tmp/testoscommand.sh" - >
-> Click "Test OS Command"->
-> Click "OK" - >
-> Click "OK"
Assign the new notification method to the rules.
Click "Preferences" - >
-> Click "Rules" - >
-> Click "Assign Methods to Multiple Rules"->
-> View = "By Method" - >
-> Expand view "Test OS Command (OS Command: No)"->
-> Click "Assign Method to Rule" in "Agent Upload Problems" - >
-> Click "Assign Method to Rule" in "Agents Unreachable" - >
-> Click "Assign Method to Rule" in "Database Availability and Critical States"->
-> Click "Assign Method to Rule" in "Host Availability and Critical States"->
-> Click "Assign Method to Rule" in "Listener Availability" - >
-> Click "OK"
Check the result:
Shutdown the PROD1 instance. You should get the log file /tmp/testoscommand.log
cat /tmp/testoscommand.log
...
...
Alert logged:
target name is PROD1
target type is Database Instance
target is on host odd.oracle.com
metric in alert is Status
metric index is
第 3 页 共 4 页
ORACLE 11g OCM
timestamp is Mar 3, 2015 2:55:24 PM CET
severity is Critical
message is Failed to connect to database instance: ORA-01034: ORACLE not available.
notification rule is Database Availability and Critical States
rule owner is SYSMAN
第 4 页 共 4 页
ORACLE 11g OCM
209 - Implement Grid Control and Database
Control
注意两者的区别:
l Oracle Enterprise Manager Grid Control
l Oracle Enterprise Manager Database Control
OEM Database Control 可参考:
【118 - Use Enterprise Manager Configuration Assistant (EMCA) Utility 】
对 Database 的相关操作在两者中都可使用,若 EM GC 出问题,可以切换到 EM DC 使用。反之亦然。
第 1 页 共 1 页
ORACLE 11g OCM
210 - Choose the Appropriate Tablespace
Type for the Intended Use
1. 相关内容
参照考点:
l 103 - Create and manage temporary, permanent, and undo tablespaces
l 107 - Create and manage bigfile tablespaces
2. 文档(DB)
Administrator's Guide -> 14 Managing Tablespaces -> Guidelines for Managing Tablespaces
3. 表空间使用指引
l Separate user data from data dictionary data to reduce I/O contention.
l Separate data between different applications to prevent multiple applications from being
affected if a tablespace must be taken offline.
l Use different datafiles on different disks to reduce I/O contention.
l Use different tablespaces for data and indexes
l Allocate specific tablespaces for specific activities (high update activity, read-only
activity, or temporary segment storage...)
l Use one or two large data files with autoextension enabled, rather than creating many small
data files.
l In general, always use type ASSM tablespaces
l Only using MSSM Tablespaces when we are sure that the performance is better than ASSM
l Take individual tablespaces offline while others remain online, providing better overall
availability.
第 1 页 共 2 页
ORACLE 11g OCM
4. 压缩表空间
-- All tables created in the tablespace will use the default compression, unless otherwise specified:
-- 注意:compress for query/archive only for exadata storage
CREATE TABLESPACE test_compress
datafile '/u01/app/oracle/oradata/PROD1/test_compress.dbf' size 100m
DEFAULT COMPRESS FOR OLTP;
-- Create compress table
create table test_cmp_01 tablespace test_compress
as select * from dba_objects;
create table test_cmp_02 tablespace test_compress compress for oltp
as select * from dba_objects;
create table test_cmp_03 tablespace test_compress compress basic
as select * from dba_objects;
create table test_cmp_04 tablespace test_compress compress
as select * from dba_objects;
-- Check the tables
SELECT table_name, compression, compress_for FROM user_tables
where table_name like 'TEST_CMP_%';
-- Drop TBS
drop tablespace test_compress including contents and datafiles;
第 2 页 共 2 页
ORACLE 11g OCM
211 - Create Scheduler Jobs
1. 文档(DB)
l Administrator's Guide -> 29 Scheduling Jobs with Oracle Scheduler -> Creating, Running, and
Managing Jobs
注意:Job 默认是 Enabled
2. PL/SQL Job
Gather stats of the DB PROD1's HR schema on 25th of each month.
Click "Targets" ->
-> Click "Databases" ->
-> Click "PROD1.oracle.com" ->
-> Click "Server" ->
-> Click Oracle Scheduler "Jobs" - >
-> Click "Create" ->
-> Name = "GATHER_STATS_HR" ->
-> PL/SQL =
BEGIN
DBMS_STATS.GATHER_SCHEMA_STATS(
OWNNAME=>'HR',
METHOD_OPT=>'FOR ALL INDEXED COLUMNS SIZE AUTO',
DEGREE=>2,
CASCADE=>TRUE,
NO_INVALIDATE=>FALSE);
END;
-> Click "Schedule" - >
-> Time Zone = "(UTC+01:00) Madrid"->
-> Repeat = "By month" - >
-> Select the day "25″ - >"
-> Time = "12 00 00 AM" - >
-> Click "OK"
Run the Job:
Select "GATHER_STATS_HR" - >
-> Click "Run Now"
第 1 页 共 2 页
ORACLE 11g OCM
Delete the Job.
Select "GATHER_STATS_JOBS" - >
-> Click "Delete" - >
-> Select "Drop the job and stop any running instance." ->
-> Click "Yes"
3. Executable Job
-- Create an executable script on the ODD host
vi /tmp/test_exec.sh
-- Add the following lines
#!/bin/bash
date >>/tmp/test_exec.out
-- Set execute permissions
chmod u+x /tmp/test_exec.sh
On the page of PROD1 DB - >
-> Click "Server" - >
-> Click Oracle Scheduler "Jobs" - >
-> Click "Create" - >
-> Name = "TEST_EXEC" - >
-> Click "Change Command Type"->
-> Select "Executable" - >
-> Click "OK" - >
-> Executable Name = "/tmp/test_exec.sh" - >
-> Click "OK" - >
-> Execute in ODD host "cat /tmp/test_exec.out" to check it worked.
第 2 页 共 2 页
ORACLE 11g OCM
212 - Create Schedules
1. 文档(DB)
l Administrator's Guide -> 29 Scheduling Jobs with Oracle Scheduler -> Creating and Managing
Schedules to Define Jobs
2. Scheduling Jobs
1) Create a schedule
Click "Targets" ->
-> Click "Databases" ->
-> Click "PROD1.oracle.com" ->
-> Click "Server" ->
-> Click Oracle Scheduler "Schedules" ->
-> Click "Create" ->
-> Name = "MONTHLY_STATS_HR" ->
-> Time Zone = "(UTC+08:00) Shanghai" ->
-> Click "Schedule Attributes" ->
-> Repeat = "By months" ->
-> Select the day "25" ->
-> Time = "12 00 00 AM" ->
-> Click "OK"
2) Create a Job associated to the schedule
Click "Targets" ->
-> Click "Databases" ->
-> Click "PROD1.oracle.com" ->
-> Click "Server" ->
-> Click Oracle Scheduler "Jobs" ->
-> Click "Create" ->
-> Name = "GATHER_STATS_HR" ->
-> PL/SQL =
BEGIN
DBMS_STATS.GATHER_SCHEMA_STATS(
OWNNAME=>'HR',
METHOD_OPT=>'FOR ALL INDEXED COLUMNS SIZE AUTO',
DEGREE=>2,
CASCADE=>TRUE,
第 1 页 共 2 页
ORACLE 11g OCM
NO_INVALIDATE=>FALSE);
END;
-> Click "Schedule" ->
-> Schedule Type = "User Pre-defined Schedule" ->
-> Click flashlight icon ->
-> Select MONTHLY_STATS_HR ->
-> Click "OK"
3) Run the Job:
Select "GATHER_STATS_HR" ->
-> Click "Run Now"
4) Delete the Job and the Schedule.
Click "Jobs" ->
-> Select "GATHER_STATS_JOBS" ->
-> Click "Delete" ->
-> Select "Drop the job and stop any running instance." ->
-> Click "Yes"
Click "Schedules" ->
-> Select "MONTHLY_STATS_HR" ->
-> Click "Delete" ->
-> Select "Drop the schedule and all the dependent objects will be disabled." ->
-> Click "Yes"
第 2 页 共 2 页
ORACLE 11g OCM
213 - Assign Jobs to Windows
1. 关联 Job 到 Window
Create the Job to gather the HR schema statistics, and assign it to the Windows Group of
Maintenance "MAINTENANCE_WINDOW_GROUP".
Click "Targets" - >
-> Click "Databases" - >
-> Click "PROD1.oracle.com" - >
-> Click "Server" - >
-> Click Oracle Scheduler "Jobs" - >
-> Click "Create" - >
-> Name = "GATHER_STATS_HR" - >
-> PL/SQL =
BEGIN
DBMS_STATS.GATHER_SCHEMA_STATS(
OWNNAME=>'HR',
METHOD_OPT=>'FOR ALL INDEXED COLUMNS SIZE AUTO',
DEGREE=>2,
CASCADE=>TRUE,
NO_INVALIDATE=>FALSE);
END;
-> Click "Schedule" - >
-> Schedule Type = "User Pre-defined Windows"->
-> Click flashlight icon ->
-> Select "MAINTENANCE_WINDOW_GROUP " - >
-> Click "Select" - >
-> Select "Stop on Window Close"->
-> Click "OK"
After the maintaince windows open or until the next day, the Job will be run to gather the
HR schema statistics
-- Check the statistics of the HR schema are gathered
alter session set nls_date_format='yyyy/mm/dd hh24:mi:ss';
SELECT owner,tablespace_name,table_name,status,LAST_ANALYZED FROM DBA_TABLES WHERE OWNER='HR';
第 1 页 共 2 页
ORACLE 11g OCM
2. 删除 Job
Click "Jobs" - >
-> Select "GATHER_STATS_JOBS" - >
-> Click "Delete" - >
-> Select "Drop the job and stop any running instance."->
-> Click "Yes"
第 2 页 共 2 页
ORACLE 11g OCM
214 - Create Programs
1. Job 调用 Program
vi /tmp/test_program.sh
-- Add the following lines
#!/bin/bash
date >> /tmp/test_program.out
-- Assign the execute permissions
-- By default, the external script will be executed by the user and group "others"
chmod 777 /tmp/test_program.sh
Create the Program:
Click "Targets" - >
-> Click "Databases" - >
-> Click "PROD1.oracle.com" - >
-> Click "Server" - >
-> Click Oracle Scheduler "Programs" - >
-> Click "Create" - >
-> Name = "PROGRAM_TEST" - >
-> Enabled = "Yes" - > 注意:Enabled 默认是"No"
-> Type = "Executable" - >
-> Executable Name = "/tmp/test_program.sh" - >
-> Click "OK"
Create the Job:
Click "Targets" - >
-> Click "Databases" - >
-> Click "PROD1.oracle.com" - >
-> Click "Server" - >
-> Click Oracle Scheduler "Jobs" - >
-> Click "Create" - >
-> Name = "JOB_TEST" - >
-> Click "Change Command Type"->
-> Select "Program Name" - >
-> Program Name = "SYS"."PROGRAM_TEST" - >
-> Click "OK" - >
-> Click "OK"
Check the program output on the ODD host:
第 1 页 共 2 页
ORACLE 11g OCM
cat /tmp/test_program.out
2. 删除 Program 及 Job
Select "JOB_TEST" - >
-> Click "Delete" - >
-> Select "Drop the job and stop any running instance."->
-> Click "Yes"
In the Programs window - >
-> Select "PROGRAM_TEST" - >
-> Click "Delete" - >
-> Click "Yes"
第 2 页 共 2 页
ORACLE 11g OCM
215 - Create Job Classes
1. Job Class
l Job Class 是对具有某些相同属性的 Job 进行分组;
l 同一个 Job Class 中的 Job 可设置优先等级,令同一时间内,高级的 Job 优先执行;
l 所有的 Job 都有其归属的 Job Class,默认是属于 DEFAULT_JOB_CLASS.
2. 建立 Job Class
Click "Targets" - >
-> Click "Databases" - >
-> Click "PROD1.oracle.com" - >
-> Click "Server" - >
-> Click Oracle Scheduler "Job Classes" - >
-> Click "Create" - >
-> Name = "JOB_CLASS_TEST" - >
-> Service Name = "PROD1" - >
-> Click "OK"
3. Job 关联 Job Class
Gather the HR schema statistics, and assign the highest priority.
Click "Targets" - >
-> Click "Databases" - >
-> Click "PROD1.oracle.com" - >
-> Click "Server" - >
-> Click Oracle Scheduler "Jobs" - >
-> Click "Create" - >
-> Name = "GATHER_STATS_HR" - >
-> Job Class = "JOB_CLASS_TEST" - >
-> PL/SQL =
BEGIN
DBMS_STATS.GATHER_SCHEMA_STATS(
OWNNAME=>'HR',
第 1 页 共 2 页
ORACLE 11g OCM
METHOD_OPT=>'FOR ALL INDEXED COLUMNS SIZE AUTO',
DEGREE=>2,
CASCADE=>TRUE,
NO_INVALIDATE=>FALSE);
END;
-> Click "Options" - >
-> Priority = "Very High" - >
-> Click "OK"
4. 删除 Job 及 Job Class
Click "Jobs" - >
-> Select "GATHER_STATS_HR" - >
-> Click "Delete" - >
-> Select "Drop the job and stop any running instance."->
-> Click "Yes"
Click "Job Classes" - >
-> Select "JOB_CLASS_TEST" - >
-> Click "Delete" - >
-> Select "Drop the class and all the dependent objects will be disabled."->
-> Click "Yes"
第 2 页 共 2 页
ORACLE 11g OCM
216 - Install the Enterprise Manager Grid
Control Infrastructure
Grid Control Infrastructure(GC 架构)包括:
l Agents
l Management Servers (OMS)
l Database
以下考点已经包含相关学习内容:
【201 - Install and Patch Enterprise Manager Grid Control software 】
【202 - Configure the Enterprise Manager repository 】
【217 - Deploy Enterprise Manager Grid Control Agents 】
第 1 页 共 1 页
ORACLE 11g OCM
217 - Deploy Enterprise Manager Grid
Control Agents
1. 文档(EM)
l Advanced Installation and Configuration Guide -> Part III Installing Oracle Management Agent
l Advanced Installation and Configuration Guide -> Part VIII Deinstalling Oracle Management
Agent
2. EM 安装 GC Agent
Login the Enterprise Manager from the client host.
Open the url - https://even.oracle.com:7799/em/
Login user/pwd: sysman/*** (本例:oracle12)
Click "Deployments" - >
-> Click Agent Installation "Install Agent" - >
-> Click "Fresh Install" - >
-> Source Shiphome Directory = "Default, from Management Server location."->
-> Version = "11.1.0.1.0" - > "
-> Platform = "Linux x86" - >"
-> Provide Host List = "odd.oracle.com" - >
-> Username = oracle - >
-> Password = **** ->
-> Deselect "Run root.sh" (待完成后手工执行) ->
-> Installation Base Directory = "/u01/app/oracle/middleware" -> 注:安装时将自动建立此目录
-> Port = 3872 - >
-> Management Server Registration Password = **** -> (本例:oracle12)
-> Confirm Password = **** ->
-> Click "Continue" - >
-> Deselect "I wish to receive security updates via My Oracle Support."->
-> Click "Submit" - >
-> Click "Yes" ->
-> wait for installation completed -> Click "Done"
-- Run the root.sh file as root user
/u01/app/oracle/middleware/agent11g/root.sh
-- Create the profile for GC agent
vi $HOME/profile_agent
第 1 页 共 4 页
ORACLE 11g OCM
-- Add the following lines
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/middleware/agent11g
export PATH=$ORACLE_HOME/bin:$PATH
-- Check the agent status
. $HOME/profile_agent
emctl status agent
Configure to access the PROD1 DB from EM.
-- Start the DB instance and Listener first.
-- If the user dbsnmp is unlocked, unlock the user and create password for it.
alter user dbsnmp identified by oracle account unlock;
Click "Targets" - >
-> Click "Databases" - >
-> Select "PROD1.oracle.com" - >
-> Click "Configure" - >
-> Monitor Password = "****" -> (本例:oracle)
-> Click "Test Connection" -> Ensure the connection test was Success
-> Click "Next" ->
-> Click "Submit" ->
-> Click "OK"
3. 命令行安装 GC Agent
-- Download the agent install script from the client host (as oracle)
cd /stage
wget --no-check-certificate
ttps://even.oracle.com:7799/agent_download/11.1.0.1.0/linux/agentDownload.linux
-- or Copy the install script from the OMS host (EVEN) directly.
scp
even:/u01/app/oracle/middleware/oms11g/sysman/agent_download/11.1.0.1.0/linux/agentDownlo
ad.linux /stage/
-- Set execute permissions to the script
chmod u+x agentDownload.linux
-- Install the GC Agent, enter the Registration Password (本例:oracle12)
./agentDownload.linux -b /u01/app/oracle/middleware -y
-- Execute the following script as root user
/u01/app/oracle/middleware/agent11g/root.sh
第 2 页 共 4 页
ORACLE 11g OCM
-- Create the profile for the agent
vi $HOME/profile_agent
-- Add the following lines
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/middleware/agent11g
export PATH=$ORACLE_HOME/bin:$PATH
-- Check the Agent
. $HOME/profile_agent
emctl status agent
emctl upload
Configure to access the PROD1 DB from EM.
-- Start the client DB and Listener first.
-- If the user dbsnmp is unlocked, unlock the user and create password for it.
alter user dbsnmp identified by "oracle" account unlock;
Click "Targets" - >
-> Click "Databases" - >
-> Select "PROD1.oracle.com" - >
-> Click "Configure" - >
-> Monitor Password = "****" -> (本例:oracle)
-> Click "Test Connection" -> Ensure the connection test was Success
-> Click "Next" ->
-> Click "Submit" ->
-> Click "OK"
4. 卸载 GC Agent
1) Shutdown the local agent on the client host:
export AGENT_HOME=/u01/app/oracle/middleware/agent11g
$AGENT_HOME/bin/emctl stop agent
2) Delete all the related targets of the client from Grid Control Enterprise Manager.
GC EM Home page -> Targets -> All Targets ->
-> 按以下 Target Type 次序(不按次序将有错误提示),逐个 remove client 相关的全部 target。
l Listener
l Database Instance
l +ASM, High Availability Service(HAS)
l Host
l Agent
第 3 页 共 4 页
ORACLE 11g OCM
3) Run the deinstaller
$AGENT_HOME/oui/bin/runInstaller -removeallfiles
-> Click "Deinstall Products..."
-> Select "agent11g1" -> Click "Remove" -> Click "Yes"
-> Click "Close" -> Click "Cancel" to exit the program
4) Clean the agent environment
-- Check and remove the agent entry in file /etc/oratab
grep agent11g /etc/oratab
-- Remove installation directory of the agent
rm -Rf $AGENT_HOME
218 - Configure Grid Control for Business
Requirements
本节要求综合使用前面各考点的知识,请参看前述的各考点内容。