搜索此博客

2011年12月29日星期四

静默安装Linux+Oracle 10G

操作系统选择oracle linux 5.7

准备工作:


需要一个能提供ftp服务的机器,最好是个linux。

需要的软件

vitrulbox 全部操作通过虚拟机完成

Enterprise-R5-U7-Server-x86_64-dvd.iso
CentOS-5.7-x86_64-netinstall.iso (BS下oracle,竟然公然歧视大陆,反正中国的IP是没法通过oracle下载linux的
                                  网上找的种子里没有netinstall盘,找了个centos的,临时替代一下)

10201_database_linux_x86_64.cpio
p8202632_10205_Linux-x86-64.zip


1.安装源设置
把Enterprise-R5-U7-Server-x86_64-dvd.iso挂载到一个已经在运行的linxu机器上,
拷贝光盘里所有内容到 /var/ftp/pub/ora5/iso/ 目录下,拷贝完成以后目录结构如下:


[root@resource kik]# ls -l /var/ftp/pub/ora5/iso/
total 380
-rw-r--r-- 1 root root   5165 Jul 29 13:05 blafdoc.css
drwxr-xr-x 3 root root   4096 Jul 29 13:17 Cluster
drwxr-xr-x 3 root root   4096 Jul 29 13:17 ClusterStorage
-rw-r--r-- 1 root root   6830 Jul 29 13:05 EULA
-rw-r--r-- 1 root root   7041 Jul 29 13:05 eula.en_US
-rw-r--r-- 1 root root   3334 Jul 29 13:05 eula.py
-rw-r--r-- 1 root root  18390 Jul 29 13:05 GPL
drwxr-xr-x 4 root root   4096 Jul 29 13:39 images
drwxr-xr-x 2 root root   4096 Jul 29 13:25 isolinux
-rw-r--r-- 1 root root   3547 Jul 29 13:05 README-en
-rw-r--r-- 1 root root   7897 Jul 29 13:05 README-en.html
-rw-r--r-- 1 root root  33470 Jul 29 13:05 RELEASE-NOTES-en
-rw-r--r-- 1 root root  36140 Jul 29 13:05 RELEASE-NOTES-en.html
-rw-r--r-- 1 root root   1397 Jul 29 13:05 RPM-GPG-KEY
-rw-r--r-- 1 root root   1397 Jul 29 13:05 RPM-GPG-KEY-oracle
drwxr-xr-x 4 root root 212992 Jul 29 13:17 Server
-rw-r--r-- 1 root root    105 Jul 29 13:05 supportinfo
-r--r--r-- 1 root root   4436 Jul 29 13:42 TRANS.TBL
drwxr-xr-x 3 root root   4096 Jul 29 13:17 VT
[root@resource kik]#



然后打开vsftpd的匿名登录。过程就省略略,google大把大把的。

kickstart配置文件放在 /var/ftp/pub/ora5/kik/ 下:



# Kickstart file automatically generated by anaconda.

install
url --url ftp://10.101.5.100/pub/ora5/iso/
lang en_US.UTF-8
keyboard us

#xconfig --startxonboot
network --device eth0 --bootproto static --ip 10.101.5.68 --netmask 255.255.248.0 --gateway 10.101.0.1 -
-nameserver 10.101.0.19 --hostname grid
rootpw --iscrypted $1$nPKdqyiD$KkCUPHAeWXhChoQxmjXiI/

firewall --disabled
firstboot --disable
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone Asia/Shanghai
key --skip

bootloader --location=mbr --driveorder=sda --append="rhgb quiet"

clearpart --all --drives=sda
part swap --fstype swap --size=2048 --grow --maxsize=2048  --asprimary --ondisk=sda
part / --fstype ext3 --size=20480 --grow --maxsize=40960 --asprimary --ondisk=sda

reboot --eject



%packages
@admin-tools
@base
@chinese-support
@core
@system-tools
@base-x
@Administration Tools
@X Window System
sgpio
libstdc++44-devel
python-dmidecode
imake
audit
python-dmidecode
sgpio
tcp_wrappers
ksh
elfutils-libelf
elfutils-libelf-devel
gcc
gcc-c++
glibc
glibc-common
glibc-devel*
glibc-headers
libaio
libaio-devel
libgcc
libgomp
libstdc++
libstdc++-devel
make
numactl-devel
sysstat
rng-utils
compat-libstdc++-296
compat-libstdc++-33.x86_64
libXp
libXp-devel
kernel-devel
glibc-utils
rng-utils



%post
chvt 3
cd /tmp
wget ftp://10.101.5.100/pub/ora5/kik/createuser.sh
bash createuser.sh > /root/createuser.log
wget ftp://10.101.5.100/pub/ora5/kik/bash_profile
cat /tmp/bash_profile >> /home/oracle/.bash_profile
wget ftp://10.101.5.100/pub/ora5/kik/rlwrap-0.37-1.el5.x86_64.rpm
/bin/rpm -Uhv rlwrap-0.37-1.el5.x86_64.rpm
chvt 1
%end





createuser.sh

#!/bin/bash
/usr/sbin/groupadd -g 1000 oinstall;
/usr/sbin/groupadd -g 1100 dba;
/usr/sbin/groupadd -g 1200 oper;
/usr/sbin/useradd -u 1000 -g oinstall -G dba,oper oracle -p oracle;
/bin/echo "111111" | /usr/bin/passwd  --stdin oracle

/bin/echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
/bin/echo "kernel.shmmax = 2147483648" >> /etc/sysctl.conf
/bin/echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
/bin/echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
/bin/echo "net.core.rmem_default = 4194304" >> /etc/sysctl.conf
/bin/echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf
/bin/echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
/bin/echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
/bin/echo "fs.file-max = 6815744" >> /etc/sysctl.conf
/bin/echo "net.core.wmem_max = 1048576" >> /etc/sysctl.conf11/29/2011
/bin/echo "fs.aio-max-nr = 1048576"  >> /etc/sysctl.conf

/bin/echo "inventory_loc=/u01/app/oracle/oraInventory"  >> /etc/oraInst.loc
/bin/echo "inst_group=oinstall"  >> /etc/oraInst.loc

/bin/mkdir -p /u01/app/oracle/product/10.2.0/dbhome_1
/bin/mkdir -p /u01/oradata
/bin/mkdir -p /u01/flash_recovery_area
/bin/mkdir -p /u01/app/oracle/middleware
/bin/chown -R oracle:oinstall /u01;
/bin/chmod -R 775 /u01

/bin/echo "oracle soft nproc 4096"  >> /etc/security/limits.conf
/bin/echo "oracle hard nproc 16384"  >> /etc/security/limits.conf
/bin/echo "oracle soft nofile 4096"  >> /etc/security/limits.conf
/bin/echo "oracle hard nofile 65536"  >> /etc/security/limits.conf


echo "10.101.5.68  grid.mytest grid" >> /etc/hosts






bash_profile

# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=grid.mytest; export ORACLE_HOSTNAME
ORACLE_UNQNAME=mydb1; export ORACLE_UNQNAME
ORACLE_SID=mydb1; export ORACLE_SID
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/dbhome_1; export ORACLE_HOME


PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH


alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap sqlplus"


设置完以后分别用wget测试一下,过程略。


源设置好以后需要修改一下CentOS-5.7-x86_64-netinstall.iso ,用UltraISO打开编辑
isolinux.cfg,找到
label linux
  menu label ^Install or upgrade an existing system
  menu default
  kernel vmlinuz
  append initrd=initrd.img

编辑完如下:

label linux
  menu label ^Install or upgrade an existing system
  menu default
  kernel vmlinuz
  append initrd=initrd.img ks=ftp://10.101.5.100/pub/ora5/kik/ora5.cfg text

然后保存回ISO文件。

这边准备工作就做好了,下边转到虚拟机。



2.
vitrulbox里新建一个虚拟机。内存8G,硬盘40G动态扩展。启动时加载修改后的CentOS-5.7-x86_64-netinstall.iso
没有问题10来分钟以后oracle linux 5.7就安装好啦,确定重启一下就ok。




3.安装Vbox增强功能


[root@grid ~]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@grid ~]# /mnt/VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.1.8 Guest Additions for Linux.........
VirtualBox Guest Additions installer
Removing existing VirtualBox DKMS kernel modules[  OK  ]
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module[  OK  ]
Building the shared folder support module[  OK  ]
Building the OpenGL support module[FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions[  OK  ]
Installing the Window System drivers
Installing X.Org 7.1 modules[  OK  ]
Setting up the Window System to use the Guest Additions[  OK  ]
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.

Installing graphics libraries and desktop services components[  OK  ]
[root@grid ~]#

设置数据空间,设置完以后加载


[root@grid ~]# mount -t vboxsf share /mnt
[root@grid ~]# ls /mnt/
oracle10G  Oracle-5.7-x86_64-netinstall.iso  oracle_em
[root@grid ~]#




4.
安装oracle

加压缩安装文件 cpio -idvm < /mnt/oracle10G/10201_database_linux_x86_64.cpio

创建response文件


enterprise.rsp


RESPONSEFILE_VERSION=2.2.1.0.0
UNIX_GROUP_NAME="oinstall"
FROM_LOCATION="../stage/products.xml"
NEXT_SESSION_RESPONSE=<Value Unspecified>
ORACLE_HOME="/u01/app/oracle/product/10.2.0/dbhome_1"
ORACLE_HOME_NAME="OraDbHome1"
TOPLEVEL_COMPONENT={"oracle.server","10.2.0.1.0"}
DEINSTALL_LIST={"oracle.server","10.2.0.1.0"}
SHOW_SPLASH_SCREEN=false
SHOW_WELCOME_PAGE=false
SHOW_NODE_SELECTION_PAGE=false
SHOW_SUMMARY_PAGE=false
SHOW_INSTALL_PROGRESS_PAGE=false
SHOW_CONFIG_TOOL_PAGE=false
SHOW_XML_PREREQ_PAGE=false
SHOW_ROOTSH_CONFIRMATION=true
SHOW_END_SESSION_PAGE=false
SHOW_EXIT_CONFIRMATION=false
NEXT_SESSION=false
NEXT_SESSION_ON_FAIL=false
SHOW_DEINSTALL_CONFIRMATION=false
SHOW_DEINSTALL_PROGRESS=false
RESTART_SYSTEM="false"
RESTART_REMOTE_SYSTEM="false"


ORACLE_HOSTNAME="grid"
SHOW_END_OF_INSTALL_MSGS=true
COMPONENT_LANGUAGES={"en,zh_CN"}
INSTALL_TYPE="EE"
s_nameForDBAGrp="dba"
s_nameForOPERGrp="dba"
n_configurationOption=3





[oracle@grid database]$ ./runInstaller  -ignoreSysPrereqs -silent -responsefile /home/oracle/enterprise.rsp
Starting Oracle Universal Installer...

Checking installer requirements...

Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
                                      Failed <<<<


>>> Ignoring required pre-requisite failures. Continuing...

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-12-29_11-21-54AM. Please wait ...[oracle@grid database]$ Oracle Universal Installer, Version 10.2.0.1.0 Production
Copyright (C) 1999, 2005, Oracle. All rights reserved.

You can find a log of this install session at:
 /u01/app/oracle/oraInventory/logs/installActions2011-12-29_11-21-54AM.log
.................................................................................................... 100% Done.


Loading Product Information
..................................................................................................................... 100% Done.
Analyzing dependencies 
.........................................................
Starting execution of Prerequisites...
Total No of checks: 11

Performing check for CertifiedVersions
Checking operating system requirements ...
Expected result: One of redhat-3,redhat-4,SuSE-9
Actual Result: redhat-Red Hat Enterprise Linux Server release 5.7 (Tikanga)
Check complete. The overall result of this check is: Failed <<<<


Check complete: Failed <<<<
Problem: Oracle Database 10g is not certified on the current operating system.
Recommendation: Make sure you are installing the software on the correct platform.

=======================================================================
Performing check for Packages
Checking operating system package requirements ...
Check complete. The overall result of this check is: Not executed <<<<


Check complete: Not executed <<<<
OUI-18001: The operating system 'Linux Version redhat-Red Hat Enterprise Linux Server release 5.7 (Tikanga)' is not supported.
Recommendation: Install the required packages before continuing with the installation.

=======================================================================
Performing check for Kernel
Checking kernel parameters
Check complete. The overall result of this check is: Not executed <<<<


Check complete: Not executed <<<<
OUI-18001: The operating system 'Linux Version redhat-Red Hat Enterprise Linux Server release 5.7 (Tikanga)' is not supported.
Recommendation: Perform operating system specific instructions to update the kernel parameters.
=======================================================================
Performing check for GLIBC
Checking Recommended glibc version
Check complete. The overall result of this check is: Not executed <<<<


Check complete: Not executed <<<<
OUI-18001: The operating system 'Linux Version redhat-Red Hat Enterprise Linux Server release 5.7 (Tikanga)' is not supported.
Recommendation: You may actually have installed packages which have obsoleted these, in which case you can successfully continue with the install. If you have not, it is recommended that you do not continue. Refer to the readme to find out how to get the missing packages.

=======================================================================
Performing check for TotalMemory
Checking physical memory requirements ...
Expected result: 922MB
Actual Result: 3956MB
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for SwapSpace
Checking available swap space requirements ...
Expected result: 3956MB
Actual Result: 2047MB
Check complete. The overall result of this check is: Failed <<<<


Check complete: Failed <<<<
Problem: The system does not have the required swap space.
Recommendation: Make more swap space available to perform the install.
=======================================================================
Performing check for DetectIfDHCPAssignedIP
Checking Network Configuration requirements ...
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for OracleBase
Validating ORACLE_BASE location (if set) ...
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for OracleHomeSpace
Checking Oracle Home path for spaces...
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for DetectAnyInvalidASMHome
Checking for proper system clean-up....
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for CompatibilityChecks
Checking for Oracle Home incompatibilities ....
Actual Result: NEW_HOME
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
PrereqChecks complete
........................................... 100% Done.


-----------------------------------------------------------------------------
Summary
Global Settings
    Source: /home/oracle/database/stage/products.xml
    Oracle Home: /u01/app/oracle/product/10.2.0/dbhome_1 (OraDbHome1)
    Installation Type: Enterprise Edition
Product Languages
   English
Space Requirements
   / Required 1.74GB (includes 130MB temporary) : Available 32.05GB
New Installations (109 products)
   Oracle Database 10g 10.2.0.1.0 
   Enterprise Edition Options 10.2.0.1.0 
   Oracle Partitioning 10.2.0.1.0 
   Oracle Spatial 10.2.0.1.0 
   Oracle OLAP 10.2.0.1.0 
   Oracle Enterprise Manager Console DB 10.2.0.1.0 
   Oracle Net Services 10.2.0.1.0 
   Oracle Database 10g 10.2.0.1.0 
   Oracle Net Listener 10.2.0.1.0 
   HAS Files for DB 10.2.0.1.0 
   Oracle Internet Directory Client 10.2.0.1.0 
   Oracle Call Interface (OCI) 10.2.0.1.0 
   Oracle Programmer 10.2.0.1.0 
   Oracle interMedia 10.2.0.1.0 
   Enterprise Manager Agent Core 10.2.0.1.0 
   Oracle JVM 10.2.0.1.0 
   Database Configuration and Upgrade Assistants 10.2.0.1.0 
   Oracle interMedia Locator 10.2.0.1.0 
   Oracle XML Development Kit 10.2.0.1.0 
   Oracle Text 10.2.0.1.0 
   Oracle Database Utilities 10.2.0.1.0 
   Generic Connectivity Common Files 10.2.0.1.0 
   Oracle Advanced Security 10.2.0.1.0 
   Enterprise Manager Repository Core 10.2.0.1.0 
   PL/SQL 10.2.0.1.0 
   Oracle Net 10.2.0.1.0 
   Assistant Common Files 10.2.0.1.0 
   Oracle Notification Service 10.1.0.3.0 
   Enterprise Manager plugin Common Files 10.2.0.1.0 Beta
   Buildtools Common Files 10.2.0.1.0 
   Installation Common Files 10.2.0.1.0 
   Oracle LDAP administration 10.2.0.1.0 
   Oracle Java Client 10.2.0.1.0 
   Oracle Recovery Manager 10.2.0.1.0 
   SQL*Plus 10.2.0.1.0 
   iSQL*Plus 10.2.0.1.0 
   Enterprise Manager plugin Common Files 10.2.0.1.0 
   Oracle Help for the  Web 1.1.10.0.0 
   HAS Common Files 10.2.0.1.0 
   Oracle Clusterware RDBMS Files 10.2.0.1.0 
   Oracle Wallet Manager 10.2.0.1.0 
   Enterprise Manager Minimal Integration 10.2.0.1.0 
   Oracle Database User Interface 2.2.13.0.0 
   Precompiler Common Files 10.2.0.1.0 
   Secure Socket Layer 10.2.0.1.0 
   Oracle ODBC Driver 10.2.0.1.0 
   Database SQL Scripts 10.2.0.1.0 
   OLAP SQL Scripts 10.2.0.1.0 
   PL/SQL Embedded Gateway 10.2.0.1.0 
   Required Support Files 10.2.0.1.0 
   Character Set Migration Utility 10.2.0.1.0 
   LDAP Required Support Files 10.2.0.1.0 
   Oracle JDBC Thin Driver for JDK 1.4 10.2.0.1.0 
   Oracle JDBC Thin Driver for JDK 1.2 10.2.0.1.0 
   Oracle interMedia Client Option 10.2.0.1.0 
   Oracle Required Support Files 32 bit 10.2.0.0.0 
   Oracle Code Editor 1.2.1.0.0I 
   Oracle Globalization Support 10.2.0.1.0 
   JDBC Common Files 10.2.0.1.0 
   Oracle Locale Builder 10.2.0.1.0 
   Oracle Containers for Java 10.2.0.1.0 
   Database Workspace Manager 10.2.0.1.0 
   Oracle Core Required Support Files 10.2.0.1.0 
   Platform Required Support Files 10.2.0.1.0 
   Oracle interMedia Locator RDBMS Files 10.2.0.1.0 
   Oracle JDBC/OCI Instant Client 10.2.0.1.0 
   Oracle interMedia Annotator 10.2.0.1.0 
   SQLJ Runtime 10.2.0.1.0 
   Oracle interMedia Java Advanced Imaging 10.2.0.1.0 
   Oracle Database 10g interMedia Files 10.2.0.1.0 
   Oracle Data Mining RDBMS Files 10.2.0.1.0 
   Enterprise Manager Baseline 10.2.0.1.0 
   Oracle Help For Java 4.2.6.1.0 
   Oracle UIX 2.1.22.0.0 
   XML Parser for Java 10.2.0.1.0 
   Precompiler Required Support Files 10.2.0.1.0 
   XML Parser for Oracle JVM 10.2.0.1.0 
   Oracle Database 10G 32 bit 10.2.0.1.0 
   Oracle Message Gateway Common Files 10.2.0.1.0 
   Oracle Starter Database 10.2.0.1.0 
   Sample Schema Data 10.2.0.1.0 
   Parser Generator Required Support Files 10.2.0.1.0 
   Agent Required Support Files 10.2.0.1.0 
   Oracle RAC Required Support Files-HAS 10.2.0.1.0 
   RDBMS Required Support Files 10.2.0.1.0 
   RDBMS Required Support Files for Instant Client 10.2.0.1.0 
   XDK Required Support Files 10.2.0.1.0 
   Oracle OLAP API 10.2.0.1.0 
   Oracle OLAP RDBMS Files 10.2.0.1.0 
   DBJAVA Required Support Files 10.2.0.1.0 
   SQL*Plus Required Support Files 10.2.0.1.0 
   Oracle JFC Extended Windowing Toolkit 4.2.33.0.0 
   Oracle Ice Browser 5.2.3.6.0 
   regexp 2.1.9.0.0 
   Oracle Extended Windowing Toolkit 3.4.38.0.0 
   Enterprise Manager Common Files 10.2.0.1.0 
   Enterprise Manager Agent DB 10.2.0.1.0 
   Oracle Net Required Support Files 10.2.0.1.0 
   Enterprise Manager Repository DB 10.2.0.1.0 
   Oracle Display Fonts 9.0.2.0.0 
   SSL Required Support Files for InstantClient 10.2.0.1.0 
   Bali Share 1.1.18.0.0 
   Perl Interpreter 5.8.3.0.2 
   Oracle Universal Installer 10.2.0.1.0 
   Oracle One-Off Patch Installer 10.2.0.1.0 
   Installer SDK Component 10.2.0.1.0 
   Java Runtime Environment 1.4.2.0.8 
   Java 2 SDK 1.4.2.0.8 
   Sun JDK extensions 10.1.2.0.0 
-----------------------------------------------------------------------------


Installation in progress (Thu Dec 29 11:22:03 CST 2011)
...............................................................  14% Done.
...............................................................  28% Done.
...............................................................  42% Done.
...............................................................  56% Done.
...............................................................  70% Done.
................                                                 74% Done.
Install successful

Linking in progress (Thu Dec 29 11:23:06 CST 2011)
.                                                                74% Done.
Link successful

Setup in progress (Thu Dec 29 11:24:20 CST 2011)
..................                                              100% Done.
Setup successful

End of install phases.(Thu Dec 29 11:24:22 CST 2011)
WARNING:The following configuration scripts 
/u01/app/oracle/product/10.2.0/dbhome_1/root.sh
need to be executed as root for configuring the system. If you skip the execution of the configuration tools, the configuration will not be complete and the product wont function properly. In order to get the product to function properly, you will be required to execute the scripts and the configuration tools after exiting the OUI.
 
The installation of Oracle Database 10g was successful.
Please check '/u01/app/oracle/oraInventory/logs/silentInstall2011-12-29_11-21-54AM.log' for more details.
[oracle@grid database]$ 

[root@grid ~]# /u01/app/oracle/product/10.2.0/dbhome_1/root.sh
Running Oracle10 root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/10.2.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
[root@grid ~]# 


不需要单独去装监听器鸟


[oracle@grid database]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 29-DEC-2011 11:28:11

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
[oracle@grid database]$
[oracle@grid database]$
[oracle@grid database]$
[oracle@grid database]$
[oracle@grid database]$ lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 29-DEC-2011 11:28:18

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/10.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Log messages written to /u01/app/oracle/product/10.2.0/dbhome_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=grid)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                29-DEC-2011 11:28:18
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/product/10.2.0/dbhome_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=grid)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@grid database]$


4.
这次先升级,再建库。


停掉监听器,确定没有oracle进程。用ps 验证一下


[oracle@grid ~]$ ps -eaf|grep ora
root      2376  2345  0 10:46 ?        00:00:00 hald-addon-storage: polling /dev/sr0
root      6930  2475  0 10:59 ?        00:00:00 sshd: oracle [priv]
oracle    6932  6930  0 10:59 ?        00:00:00 sshd: oracle@pts/1
oracle    6933  6932  0 10:59 pts/1    00:00:00 -bash
root      7168  2475  0 11:20 ?        00:00:00 sshd: oracle [priv]
oracle    7170  7168  0 11:20 ?        00:00:00 sshd: oracle@pts/0
oracle    7171  7170  0 11:20 pts/0    00:00:00 -bash
oracle   21331  6933  0 11:30 pts/1    00:00:00 ps -eaf
oracle   21332  6933  0 11:30 pts/1    00:00:00 grep ora
[oracle@grid ~]$


加压缩升级包

[oracle@grid ~]$ unzip /mnt/oracle10G/p8202632_10205_Linux-x86-64.zip -d /home/oracle/upgrade

。。。。。。。。。。。。。。。。

从模板创建response文件,最终如下:

[oracle@grid ~]$ more patchset.rsp

RESPONSEFILE_VERSION=2.2.1.0.0
UNIX_GROUP_NAME=oinstall
FROM_LOCATION="/home/oracle/upgrade/Disk1/stage/products.xml"
NEXT_SESSION_RESPONSE=
ORACLE_HOME="/u01/app/oracle/product/10.2.0/dbhome_1"
ORACLE_HOME_NAME="OraDbHome1"
TOPLEVEL_COMPONENT={"oracle.patchset.db","10.2.0.5.0"}
SHOW_SPLASH_SCREEN=false
SHOW_WELCOME_PAGE=false
SHOW_COMPONENT_LOCATIONS_PAGE=false
SHOW_CUSTOM_TREE_PAGE=false
SHOW_SUMMARY_PAGE=false
SHOW_INSTALL_PROGRESS_PAGE=true
SHOW_REQUIRED_CONFIG_TOOL_PAGE=false
SHOW_OPTIONAL_CONFIG_TOOL_PAGE=false
SHOW_CONFIG_TOOL_PAGE=false
SHOW_XML_PREREQ_PAGE=false
SHOW_RELEASE_NOTES=false
SHOW_END_OF_INSTALL_MSGS=true
SHOW_ROOTSH_CONFIRMATION=true
SHOW_END_SESSION_PAGE=false
SHOW_EXIT_CONFIRMATION=false
NEXT_SESSION=false
NEXT_SESSION_ON_FAIL=false
SHOW_DEINSTALL_CONFIRMATION=false
SHOW_DEINSTALL_PROGRESS=false
ACCEPT_LICENSE_AGREEMENT=true
RESTART_SYSTEM=false
CLUSTER_NODES=
OUI_HOSTNAME=
REMOVE_HOMES=
COMPONENT_LANGUAGES={"en,zh_CN"}
sl_userNodeList=
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
DECLINE_SECURITY_UPDATES= true
COLLECTOR_UPGRADE=
COLLECTOR_IGNORE_CONFIGURATION=
COLLECTOR_IGNORE_FAILURES=
COLLECTOR_USE_OBFUSCATED_PASSWORDS=
COLLECTOR_RESPONSE_FILE=
COLLECTOR_SUPPORTHUB_URL=

开始升级


./runInstaller -ignoreSysPrereqs -silent -responseFile


[oracle@grid ~]$ cd upgrade/Disk1/
install/        patch_note.htm  response/       runInstaller    stage/        
[oracle@grid ~]$ cd upgrade/Disk1/
[oracle@grid Disk1]$ ./runInstaller -ignoreSysPrereqs -silent -responseFile /home/oracle/patchset.rsp



[oracle@grid Disk1]$ ./runInstaller -ignoreSysPrereqs -silent -responseFile /home/oracle/patchset.rsp
Starting Oracle Universal Installer...

Checking installer requirements...

Checking operating system version: must be redhat-3, SuSE-9, SuSE-10, redhat-4, redhat-5, redhat-6, UnitedLinux-1.0, asianux-1, asianux-2, asianux-3, enterprise-4, enterprise-5 or SuSE-11
                                      Passed


All installer requirements met.

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-12-29_02-09-14PM. Please wait ...[oracle@grid Disk1]$ Oracle Universal Installer, Version 10.2.0.5.0 Production
Copyright (C) 1999, 2010, Oracle. All rights reserved.

You can find a log of this install session at:
 /u01/app/oracle/oraInventory/logs/installActions2011-12-29_02-09-14PM.log
.................................................................................................... 100% Done.


Loading Product Information
.................................................................................................................. 100% Done.


Starting execution of Prerequisites...
Total No of checks: 8

Performing check for CertifiedVersions
Checking operating system requirements ...
Expected result: One of redhat-6,redhat-5,redhat-4,redhat-3,SuSE-11,SuSE-10,SuSE-9,asianux-3,asianux-2,asianux-1
Actual Result: redhat-5
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for Packages
Checking operating system package requirements ...
Checking for make-3.81; found make-1:3.81-3.el5.        Passed
Checking for binutils-2.17.50.0.6; found binutils-2.17.50.0.6-14.el5.   Passed
Checking for gcc-4.1.1; found gcc-4.1.2-51.el5. Passed
Checking for libaio-0.3.106; found libaio-0.3.106-5.    Passed
Checking for libstdc++-4.1.1; found libstdc++-4.1.2-51.el5.     Passed
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for Kernel
Checking kernel parameters
Checking for semmsl=250; found semmsl=250.      Passed
Checking for semmns=32000; found semmns=32000.  Passed
Checking for semopm=100; found semopm=100.      Passed
Checking for semmni=128; found semmni=128.      Passed
Checking for shmmax=1073741824; found shmmax=2147483648.        Passed
Checking for shmmni=4096; found shmmni=4096.    Passed
Checking for shmall=2097152; found shmall=2097152.      Passed
Checking for file-max=101365; found file-max=6815744.   Passed
Checking for VERSION=2.6.18; found VERSION=2.6.32-200.13.1.el5uek.      Passed
Checking for ip_local_port_range=9000 - 65500; found ip_local_port_range=9000 - 65500.  Passed
Checking for rmem_default=1048576; found rmem_default=4194304.  Passed
Checking for rmem_max=1048576; found rmem_max=4194304.  Passed
Checking for wmem_default=262144; found wmem_default=262144.    Passed
Checking for wmem_max=262144; found wmem_max=131071.    Failed <<<<
Check complete. The overall result of this check is: Failed <<<<


Check complete: Failed <<<<
Problem: The kernel parameters do not meet the minimum requirements (see above).
Recommendation: Perform operating system specific instructions to update the kernel parameters.

=======================================================================
Performing check for GLIBC
Checking Recommended glibc version
Expected result: ATLEAST=2.5-12 NOT_EQUALS=2.5-18
Actual Result: 2.5-65
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for TotalMemory
Checking physical memory requirements ...
Expected result: 922MB
Actual Result: 3956MB
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for SwapSpace
Checking available swap space requirements ...
Expected result: 3956MB
Actual Result: 2047MB
Check complete. The overall result of this check is: Failed <<<<


Check complete: Failed <<<<
Problem: The system does not have the required swap space.
Recommendation: Make more swap space available to perform the install.

=======================================================================
Performing check for checkToInstallCCR
Checking the Components installed in Oracle Home
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for CompatibilityChecks
Checking for Oracle Home incompatibilities ...
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
PrereqChecks complete


Analyzing dependencies
...................................................................................................... 100% Done.


-----------------------------------------------------------------------------
Summary
Global Settings
    Source: /home/oracle/upgrade/Disk1/stage/products.xml
    Oracle Home: /u01/app/oracle/product/10.2.0/dbhome_1 (OraDbHome1)
Product Languages
   English
Space Requirements
   / Required 1.49GB (includes 54MB temporary) : Available 29.21GB
New Installations (86 products)
   Oracle Notification Service Patch 10.2.0.5.0
   Database Configuration and Upgrade Assistants Patch 10.2.0.5.0
   Character Set Migration Utility Patch 10.2.0.5.0
   Oracle Database 10g Patch 10.2.0.5.0
   Oracle JDBC/OCI Instant Client Patch 10.2.0.5.0
   Oracle Database 10g Patch 10.2.0.5.0
   Enterprise Manager plugin Common Files Patch 10.2.0.5.0
   SQL*Plus 10.2.0.5.0
   HAS Common Files Patch 10.2.0.5.0
   HAS Files for DB Patch 10.2.0.5.0
   Oracle Java Client Patch 10.2.0.5.0
   Oracle JVM Patch 10.2.0.5.0
   Oracle Internet Directory Client Patch 10.2.0.5.0
   iSQL*Plus 10.2.0.5.0
   Oracle Advanced Security Patch 10.2.0.5.0
   Oracle Net Patch 10.2.0.5.0
   Oracle Net Listener Patch 10.2.0.5.0
   Oracle Wallet Manager Patch 10.2.0.5.0
   Precompiler Common Files Patch 10.2.0.5.0
   Secure Socket Layer Patch 10.2.0.5.0
   Oracle ODBC Driver Patch 10.2.0.5.0
   Oracle OLAP Patch 10.2.0.5.0
   Oracle OLAP API Patch 10.2.0.5.0
   OLAP SQL Scripts Patch 10.2.0.5.0
   Oracle interMedia Client Option Patch 10.2.0.5.0
   Oracle Database 10g interMedia Files Patch 10.2.0.5.0
   Oracle interMedia Patch 10.2.0.5.0
   PL/SQL Embedded Gateway Patch 10.2.0.5.0
   Oracle XML Development Kit Patch 10.2.0.5.0
   Oracle Text Patch 10.2.0.5.0
   Oracle Clusterware RDBMS Files Patch 10.2.0.5.0
   Database SQL Scripts Patch 10.2.0.5.0
   Oracle Data Mining RDBMS Files Patch 10.2.0.5.0
   Generic Connectivity Common Files Patch 10.2.0.5.0
   Oracle Net Required Support Files Patch 10.2.0.5.0
   Oracle Starter Database Patch 10.2.0.5.0
   Sample Schema Data Patch 10.2.0.5.0
   Oracle interMedia Locator RDBMS Files Patch 10.2.0.5.0
   Oracle Call Interface (OCI) Patch 10.2.0.5.0
   Oracle OLAP RDBMS Files Patch 10.2.0.5.0
   PL/SQL 10.2.0.5.0
   Oracle Recovery Manager Patch 10.2.0.5.0
   Oracle Database Utilities Patch 10.2.0.5.0
   Oracle interMedia Locator Patch 10.2.0.5.0
   XML Parser for Java Patch 10.2.0.5.0
   Assistant Common Files Patch 10.2.0.5.0
   Oracle JDBC Thin Driver for JDK 1.2 Patch 10.2.0.5.0
   Oracle JDBC Thin Driver for JDK 1.4 Patch 10.2.0.5.0
   Oracle interMedia Java Advanced Imaging Patch 10.2.0.5.0
   SQLJ Runtime Patch 10.2.0.5.0
   XML Parser for Oracle JVM Patch 10.2.0.5.0
   Enterprise Manager Agent DB 10.2.0.5.0
   Enterprise Manager Baseline 10.2.0.5.0
   Oracle Enterprise Manager Console DB 10.2.0.5.0
   XDK Required Support Files Patch 10.2.0.5.0
   Agent Required Support Files Patch 10.2.0.5.0
   DBJAVA Required Support Files Patch 10.2.0.5.0
   LDAP Required Support Files Patch 10.2.0.5.0
   Precompiler Required Support Files Patch 10.2.0.5.0
   Oracle RAC Required Support Files-HAS Patch 10.2.0.5.0
   RDBMS Required Support Files for Instant Client Patch 10.2.0.5.0
   RDBMS Required Support Files Patch 10.2.0.5.0
   SQL*Plus Required Support Files Patch 10.2.0.5.0
   SSL Required Support Files for InstantClient Patch 10.2.0.5.0
   Installation Common Files Patch 10.2.0.5.0
   Oracle Globalization Support Patch 10.2.0.5.0
   Oracle Core Required Support Files Patch 10.2.0.5.0
   Platform Required Support Files 10.2.0.5.0
   Oracle Message Gateway Common Files Patch 10.2.0.5.0
   Enterprise Manager Agent Core Patch 10.2.0.5.0a
   Enterprise Manager Common Core Patch 10.2.0.5.0a
   Enterprise Manager Repository Core patch 10.2.0.5.0a
   Oracle Containers for Java 10.2.0.5.0
   Enterprise Manager Repository DB 10.2.0.5.0
   Oracle LDAP administration patch 10.2.0.5.0
   Oracle Required Support Files 32 bit Patch 10.2.0.5.0
   JDBC Common Files 10.2.0.5.0
   Database Workspace Manager 10.2.0.5.0
   Oracle interMedia Annotator 10.2.0.5.0
   Enterprise Manager Minimal Integration 10.2.0.5.0
   Parser Generator Required Support Files 10.2.0.5.0
   Buildtools Common Files 10.2.0.5.0
   Oracle UIX 2.2.24.6.0
   Bali Share 1.1.19.0.0
   Oracle Real Application Testing 10.2.0.5.0
   Oracle Configuration Manager 10.3.2.1.0
Upgrades (5 products)
   Oracle Universal Installer 10.2.0.5.0
   Oracle One-Off Patch Installer 10.2.0.4.2
   Installer SDK Component 10.2.0.5.0
   Java Runtime Environment 1.4.2.14.0
   Sun JDK 1.4.2.14.05
Already Installed (84 products)
   Oracle Notification Service 10.1.0.3.0
   Database Configuration and Upgrade Assistants 10.2.0.1.0
   Character Set Migration Utility 10.2.0.1.0
   Oracle Database 10g 10.2.0.1.0
   Oracle JDBC/OCI Instant Client 10.2.0.1.0
   Oracle Database 10g 10.2.0.1.0
   Enterprise Manager plugin Common Files 10.2.0.1.0
   SQL*Plus 10.2.0.1.0
   HAS Common Files 10.2.0.1.0
   HAS Files for DB 10.2.0.1.0
   Oracle Java Client 10.2.0.1.0
   Oracle JVM 10.2.0.1.0
   Oracle Internet Directory Client 10.2.0.1.0
   iSQL*Plus 10.2.0.1.0
   Oracle Advanced Security 10.2.0.1.0
   Oracle Net 10.2.0.1.0
   Oracle Net Listener 10.2.0.1.0
   Oracle Wallet Manager 10.2.0.1.0
   Precompiler Common Files 10.2.0.1.0
   Secure Socket Layer 10.2.0.1.0
   Oracle ODBC Driver 10.2.0.1.0
   Oracle OLAP 10.2.0.1.0
   Oracle OLAP API 10.2.0.1.0
   OLAP SQL Scripts 10.2.0.1.0
   Oracle interMedia Client Option 10.2.0.1.0
   Oracle Database 10g interMedia Files 10.2.0.1.0
   Oracle interMedia 10.2.0.1.0
   PL/SQL Embedded Gateway 10.2.0.1.0
   Oracle XML Development Kit 10.2.0.1.0
   Oracle Text 10.2.0.1.0
   Oracle Clusterware RDBMS Files 10.2.0.1.0
   Database SQL Scripts 10.2.0.1.0
   Oracle Data Mining RDBMS Files 10.2.0.1.0
   Generic Connectivity Common Files 10.2.0.1.0
   Oracle Net Required Support Files 10.2.0.1.0
   Oracle Starter Database 10.2.0.1.0
   Sample Schema Data 10.2.0.1.0
   Oracle interMedia Locator RDBMS Files 10.2.0.1.0
   Oracle Call Interface (OCI) 10.2.0.1.0
   Oracle OLAP RDBMS Files 10.2.0.1.0
   PL/SQL 10.2.0.1.0
   Oracle Recovery Manager 10.2.0.1.0
   Oracle Database Utilities 10.2.0.1.0
   Oracle interMedia Locator 10.2.0.1.0
   XML Parser for Java 10.2.0.1.0
   Assistant Common Files 10.2.0.1.0
   Oracle JDBC Thin Driver for JDK 1.2 10.2.0.1.0
   Oracle JDBC Thin Driver for JDK 1.4 10.2.0.1.0
   Oracle interMedia Java Advanced Imaging 10.2.0.1.0
   SQLJ Runtime 10.2.0.1.0
   XML Parser for Oracle JVM 10.2.0.1.0
   Enterprise Manager Agent DB 10.2.0.1.0
   Enterprise Manager Baseline 10.2.0.1.0
   Oracle Enterprise Manager Console DB 10.2.0.1.0
   XDK Required Support Files 10.2.0.1.0
   Agent Required Support Files 10.2.0.1.0
   DBJAVA Required Support Files 10.2.0.1.0
   LDAP Required Support Files 10.2.0.1.0
   Precompiler Required Support Files 10.2.0.1.0
   Oracle RAC Required Support Files-HAS 10.2.0.1.0
   RDBMS Required Support Files for Instant Client 10.2.0.1.0
   RDBMS Required Support Files 10.2.0.1.0
   SQL*Plus Required Support Files 10.2.0.1.0
   SSL Required Support Files for InstantClient 10.2.0.1.0
   Installation Common Files 10.2.0.1.0
   Oracle Globalization Support 10.2.0.1.0
   Oracle Core Required Support Files 10.2.0.1.0
   Platform Required Support Files 10.2.0.1.0
   Oracle Message Gateway Common Files 10.2.0.1.0
   Enterprise Manager Agent Core 10.2.0.1.0
   Enterprise Manager Common Files 10.2.0.1.0
   Enterprise Manager Repository Core 10.2.0.1.0
   Oracle Containers for Java 10.2.0.1.0
   Enterprise Manager Repository DB 10.2.0.1.0
   Oracle LDAP administration 10.2.0.1.0
   Oracle Required Support Files 32 bit 10.2.0.0.0
   JDBC Common Files 10.2.0.1.0
   Database Workspace Manager 10.2.0.1.0
   Oracle interMedia Annotator 10.2.0.1.0
   Enterprise Manager Minimal Integration 10.2.0.1.0
   Parser Generator Required Support Files 10.2.0.1.0
   Buildtools Common Files 10.2.0.1.0
   Oracle UIX 2.1.22.0.0
   Bali Share 1.1.18.0.0
-----------------------------------------------------------------------------


Deinstall in progress (Thursday, December 29, 2011 2:09:24 PM CST)
...............................................................   0% Done.
...............................................................  14% Done.
...............................................................  28% Done.
...............................................................  42% Done.
...............................................................  56% Done.
...............................................................  70% Done.
...............................................................  85% Done.
...                                                             100% Done.

Deinstall successful

Installation in progress (Thursday, December 29, 2011 2:09:24 PM CST)
...............................................................  14% Done.
...............................................................  28% Done.
...............................................................  42% Done.
...............................................................  56% Done.
...............................................................  70% Done.
...............................................................  85% Done.
.............                                                    88% Done.
Install successful

Linking in progress (Thursday, December 29, 2011 2:10:38 PM CST)
...                                                              88% Done.
Link successful

Setup in progress (Thursday, December 29, 2011 2:11:02 PM CST)
...........                                                     100% Done.
Setup successful

End of install phases.(Thursday, December 29, 2011 2:11:04 PM CST)
WARNING:
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root script to run
/u01/app/oracle/product/10.2.0/dbhome_1/root.sh
To execute the configuration scripts:
    1. Open a terminal window
    2. Log in as "root"
    3. Run the scripts

The installation of Oracle Database 10g Release 2 Patch Set 4 was successful.
Please check '/u01/app/oracle/oraInventory/logs/silentInstall2011-12-29_02-09-14PM.log' for more details.

[oracle@grid Disk1]$


[root@grid Disk1]# /u01/app/oracle/product/10.2.0/dbhome_1/root.sh
Running Oracle 10g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/10.2.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
[root@grid Disk1]#



启动监听器


[oracle@grid Disk1]$ lsnrctl start

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 29-DEC-2011 14:13:17

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/10.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.5.0 - Production
Log messages written to /u01/app/oracle/product/10.2.0/dbhome_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=grid)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.5.0 - Production
Start Date                29-DEC-2011 14:13:17
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/product/10.2.0/dbhome_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=grid)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@grid Disk1]$


5.
准备建库

5.1 确认 ORACLE_SID ORACLe_BASE ORACLE_HOME 环境变量


[oracle@grid ~]$ env |grep -i oracle
ORACLE_UNQNAME=mydb1
USER=oracle
LD_LIBRARY_PATH=/u01/app/oracle/product/10.2.0/dbhome_1/lib:/lib:/usr/lib
ORACLE_SID=mydb1
ORACLE_BASE=/u01/app/oracle
MAIL=/var/spool/mail/oracle
PATH=/u01/app/oracle/product/10.2.0/dbhome_1/bin:/usr/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin
PWD=/home/oracle
HOME=/home/oracle
LOGNAME=oracle
CLASSPATH=/u01/app/oracle/product/10.2.0/dbhome_1/jlib:/u01/app/oracle/product/10.2.0/dbhome_1/rdbms/jlib
ORACLE_HOME=/u01/app/oracle/product/10.2.0/dbhome_1
OLDPWD=/home/oracle/upgrade/Disk1
[oracle@grid ~]$



5.2 创建密码文件


[oracle@grid ~]$ cd $ORACLE_HOME/dbs
[oracle@grid dbs]$ pwd
/u01/app/oracle/product/10.2.0/dbhome_1/dbs
[oracle@grid dbs]$ ls
initdw.ora  init.ora
[oracle@grid dbs]$ orapwd
Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n>

  where
    file - name of password file (required),
    password - password for SYS will be prompted if not specified at command line,
    entries - maximum number of distinct DBA (optional),
    force - whether to overwrite existing file (optional),
    ignorecase - passwords are case-insensitive (optional),
    nosysdba - whether to shut out the SYSDBA logon (optional Database Vault only).
   
  There must be no spaces around the equal-to (=) character.
[oracle@grid dbs]$ orapwd file=orapwmydb1 entries=20

Enter password for SYS:
[oracle@grid dbs]$

5.3 创建pfile


mkdir -p /u01/app/oracle/admin/mydb1/adump
mkdir -p /u01/app/oracle/admin/mydb1/bdump
mkdir -p /u01/app/oracle/admin/mydb1/cdump
mkdir -p /u01/oradata/mydb1/



[oracle@grid dbs]$ ls
initdw.ora  init.ora  orapwmydb1
[oracle@grid dbs]$ cp init.ora initmydb1.ora
[oracle@grid dbs]$


最终如下:



db_files = 800                                                         # SMALL
db_block_size = 8192
db_files = 1000
#shared_pool_size = 3500000                                            # SMALL
log_checkpoint_interval = 10000
processes = 500                                                        # SMALL
open_cursors=500
#parallel_max_servers = 5                                              # SMALL
log_buffer = 32768                                                    # SMALL
max_dump_file_size = 10240      # limit trace file size to 5 Meg each
db_recovery_file_dest='/u01/flash_recovery_area'
db_recovery_file_dest_size=2G
pga_aggregate_target = 200M #SMALL
sga_target = 1024M
db_name = "mydb1"
control_files = (/u01/oradata/mydb1/control01.ctl, /u01/oradata/mydb1/control02.ctl)
undo_management = auto
undo_tablespace='UNDOTBS1'
audit_file_dest='/u01/app/oracle/admin/mydb1/adump'
db_recovery_file_dest='/u01/flash_recovery_area'
db_recovery_file_dest_size=2G
remote_login_passwordfile='EXCLUSIVE'

创建相关目录

mkdir -p /u01/app/oracle/admin/mydb1/adump
mkdir -p /u01/app/oracle/admin/mydb1/bdump
mkdir -p /u01/app/oracle/admin/mydb1/cdump
mkdir -p /u01/oradata/mydb1/
chmod -R 775 /u01/app/oracle/admin







5.4 连接到实例并创建spfile

[oracle@grid dbs]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.5.0 - Production on Thu Dec 29 14:42:23 2011

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn / as sysdba
Connected to an idle instance.
SQL> show user;
USER is "SYS"
SQL> 
SQL> create spfile from pfile;

File created.

SQL>
关闭实例以spfile启动到nomount模式


SQL> startup nomount
ORACLE instance started.

Total System Global Area 1073741824 bytes
Fixed Size                  2101768 bytes
Variable Size             264244728 bytes
Database Buffers          805306368 bytes
Redo Buffers                2088960 bytes
SQL> 

这时候查看后台进程

[oracle@grid dbs]$ ps -eaf|grep oracle
oracle    1343     1  0 14:13 ?        00:00:00 /u01/app/oracle/product/10.2.0/dbhome_1/bin/tnslsnr LISTENER -inheri                                                             t
oracle    1453  7171  0 14:42 pts/0    00:00:00 rlwrap sqlplus /nolog
oracle    1454  1453  0 14:42 pts/2    00:00:00 sqlplus
oracle    1472     1  0 14:46 ?        00:00:00 ora_pmon_mydb1
oracle    1474     1  0 14:46 ?        00:00:00 ora_psp0_mydb1
oracle    1476     1  0 14:46 ?        00:00:00 ora_mman_mydb1
oracle    1478     1  0 14:46 ?        00:00:00 ora_dbw0_mydb1
oracle    1480     1  0 14:46 ?        00:00:00 ora_lgwr_mydb1
oracle    1482     1  0 14:46 ?        00:00:00 ora_ckpt_mydb1
oracle    1484     1  0 14:46 ?        00:00:00 ora_smon_mydb1
oracle    1486     1  0 14:46 ?        00:00:00 ora_reco_mydb1
oracle    1488     1  0 14:46 ?        00:00:00 ora_mmon_mydb1
oracle    1490     1  0 14:46 ?        00:00:00 ora_mmnl_mydb1
oracle    1491  1454  0 14:46 ?        00:00:00 oraclemydb1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle    1495  6933  0 14:47 pts/1    00:00:00 ps -eaf
oracle    1496  6933  0 14:47 pts/1    00:00:00 grep oracle
root      6930  2475  0 10:59 ?        00:00:00 sshd: oracle [priv]
oracle    6932  6930  0 10:59 ?        00:00:00 sshd: oracle@pts/1
oracle    6933  6932  0 10:59 pts/1    00:00:00 -bash
root      7168  2475  0 11:20 ?        00:00:00 sshd: oracle [priv]
oracle    7170  7168  0 11:20 ?        00:00:00 sshd: oracle@pts/0
oracle    7171  7170  0 11:20 pts/0    00:00:00 -bash
[oracle@grid dbs]$

可以看到相关的进程都已经起来啦


建库

CREATE DATABASE "mydb1"
MAXINSTANCES 8
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
DATAFILE '/u01/oradata/mydb1/system01.dbf' SIZE 700M REUSE AUTOEXTEND ON NEXT  10240K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/oradata/mydb1/sysaux01.dbf' SIZE 600M REUSE AUTOEXTEND ON NEXT  10240K MAXSIZE UNLIMITED
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/oradata/mydb1/temp01.dbf' SIZE 20M REUSE AUTOEXTEND ON NEXT  640K MAXSIZE UNLIMITED
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/u01/oradata/mydb1/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON NEXT  5120K MAXSIZE 5G
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
LOGFILE 
GROUP 1 ('/u01/oradata/mydb1/redo01a.log') SIZE 400M,
GROUP 2 ('/u01/oradata/mydb1/redo02a.log') SIZE 400M,
GROUP 3 ('/u01/oradata/mydb1/redo03a.log') SIZE 400M
USER SYS IDENTIFIED BY "234561" USER SYSTEM IDENTIFIED BY "234561";


SQL> set timing on
SQL> 
SQL> CREATE DATABASE "mydb1"
  2  MAXINSTANCES 8
  3  MAXLOGHISTORY 1
  4  MAXLOGFILES 16
  5  MAXLOGMEMBERS 3
  6  MAXDATAFILES 100
  7  DATAFILE '/u01/oradata/mydb1/system01.dbf' SIZE 700M REUSE AUTOEXTEND ON NEXT  10240K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL
  8  SYSAUX DATAFILE '/u01/oradata/mydb1/sysaux01.dbf' SIZE 600M REUSE AUTOEXTEND ON NEXT  10240K MAXSIZE UNLIMITED
  9  SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/oradata/mydb1/temp01.dbf' SIZE 20M REUSE AUTOEXTEND ON NEXT  640K MAXSIZE UNLIMITED
 10  SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/u01/oradata/mydb1/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON NEXT  5120K MAXSIZE 5G
 11  CHARACTER SET ZHS16GBK
 12  NATIONAL CHARACTER SET AL16UTF16
 13  LOGFILE 
 14  GROUP 1 ('/u01/oradata/mydb1/redo01a.log') SIZE 400M,
 15  GROUP 2 ('/u01/oradata/mydb1/redo02a.log') SIZE 400M,
 16  GROUP 3 ('/u01/oradata/mydb1/redo03a.log') SIZE 400M
 17  USER SYS IDENTIFIED BY "234561" USER SYSTEM IDENTIFIED BY "234561";


Database created.

Elapsed: 00:01:20.71
SQL> 

运行脚本构造数据字典视图

@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/sqlplus/admin/pupbld.sql
@?/rdbms/admin/catalog.sql         
@?/rdbms/admin/catproc.sql          
@?/rdbms/admin/catblock.sql      
@?/rdbms/admin/dbmspool.sql    



SQL> select open_mode from v$database;

OPEN_MODE
----------
READ WRITE

1 row selected.

Elapsed: 00:00:00.00
SQL> 

查看有没有失效对象

SQL> select distinct status from dba_objects;

STATUS
-------
INVALID
VALID

2 rows selected.

Elapsed: 00:00:00.01
SQL> 

编译失效对象

SQL> @?/rdbms/admin/utlrp.sql

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN  2011-12-29 16:14:51

1 row selected.

Elapsed: 00:00:00.01
DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC>   objects in the database. Recompilation time is proportional to the
DOC>   number of invalid objects in the database, so this command may take
DOC>   a long time to execute on a database with a large number of invalid
DOC>   objects.
DOC>
DOC>   Use the following queries to track recompilation progress:
DOC>
DOC>   1. Query returning the number of invalid objects remaining. This
DOC>      number should decrease with time.
DOC>         SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC>   2. Query returning the number of objects compiled so far. This number
DOC>      should increase with time.
DOC>         SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC>   This script automatically chooses serial or parallel recompilation
DOC>   based on the number of CPUs available (parameter cpu_count) multiplied
DOC>   by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC>   On RAC, this number is added across all RAC nodes.
DOC>
DOC>   UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC>   recompilation. Jobs are created without instance affinity so that they
DOC>   can migrate across RAC nodes. Use the following queries to verify
DOC>   whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC>   1. Query showing jobs created by UTL_RECOMP
DOC>         SELECT job_name FROM dba_scheduler_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC>   2. Query showing UTL_RECOMP jobs that are running
DOC>         SELECT job_name FROM dba_scheduler_running_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.91

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END  2011-12-29 16:14:52

1 row selected.

Elapsed: 00:00:00.00

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.00
DOC> The following query reports the number of objects that have compiled
DOC> with errors (objects that compile with errors have status set to 3 in
DOC> obj$). If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#

OBJECTS WITH ERRORS
-------------------
                  0

1 row selected.

Elapsed: 00:00:00.01
DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#

ERRORS DURING RECOMPILATION
---------------------------
                          0

1 row selected.

Elapsed: 00:00:00.00

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.01


SQL> select distinct status from dba_objects;

STATUS
-------
VALID

1 row selected.

Elapsed: 00:00:00.01
SQL> 

SQL> select USERNAME,DEFAULT_TABLESPACE,to_char(CREATED,'yyyy-mm-dd hh24:mi:ss') time,ACCOUNT_STATUS from dba_users order by time;

USERNAME                       DEFAULT_TABLESPACE             TIME                ACCOUNT_STATUS
------------------------------ ------------------------------ ------------------- --------------------------------
SYS                            SYSTEM                         2011-12-29 15:52:45 OPEN
SYSTEM                         SYSTEM                         2011-12-29 15:52:45 OPEN
OUTLN                          SYSTEM                         2011-12-29 15:52:47 OPEN
DIP                            SYSTEM                         2011-12-29 15:55:18 EXPIRED & LOCKED
TSMSYS                         SYSTEM                         2011-12-29 15:56:44 EXPIRED & LOCKED
DBSNMP                         SYSAUX                         2011-12-29 15:57:12 EXPIRED & LOCKED
ORACLE_OCM                     SYSTEM                         2011-12-29 15:57:14 EXPIRED & LOCKED

7 rows selected.

Elapsed: 00:00:00.01
SQL> 




SQL> select USERNAME,DEFAULT_TABLESPACE dt,to_char(CREATED,'yyyy-mm-dd hh24:mi:ss') time,ACCOUNT_STATUS from dba_users order by time;

USERNAME   DT         TIME                ACCOUNT_STATUS
---------- ---------- ------------------- --------------------------------
SYS        SYSTEM     2011-12-29 15:52:45 OPEN
SYSTEM     SYSTEM     2011-12-29 15:52:45 OPEN
OUTLN      SYSTEM     2011-12-29 15:52:47 OPEN
DIP        SYSTEM     2011-12-29 15:55:18 EXPIRED & LOCKED
TSMSYS     SYSTEM     2011-12-29 15:56:44 EXPIRED & LOCKED
DBSNMP     SYSAUX     2011-12-29 15:57:12 EXPIRED & LOCKED
ORACLE_OCM SYSTEM     2011-12-29 15:57:14 EXPIRED & LOCKED

7 rows selected.

Elapsed: 00:00:00.00
SQL> 

做个全备,预防安装EM 12c中间又出错。

CONFIGURE RETENTION POLICY TO recovery window of 3 days;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE CONTROLFILE AUTOBACKUP ON;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/rmanbk/cf-%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE to compressed backupset;
CONFIGURE channel 1 device type disk format '/u01/rmanbk/DB-%U';
CONFIGURE channel 2 device type disk format '/u01/rmanbk/DB-%U';



RMAN> show all;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 3 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/rmanbk/cf-%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT   '/u01/rmanbk/DB-%U';
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT   '/u01/rmanbk/DB-%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/dbhome_1/dbs/snapcf_mydb1.f'; # default

RMAN> list backup;


RMAN> backup database include current controlfile tag "Before-full-bk";

数据库是非归档模式,重启到mount模式下备份全库。
backup database include current controlfile tag "Before-full-bk";



RMAN> backup database include current controlfile tag "Before-full-bk";

Starting backup at 29-DEC-11
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00003 name=/u01/oradata/mydb1/sysaux01.dbf
input datafile fno=00002 name=/u01/oradata/mydb1/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 29-DEC-11
channel ORA_DISK_2: starting compressed full datafile backupset
channel ORA_DISK_2: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/oradata/mydb1/system01.dbf
channel ORA_DISK_2: starting piece 1 at 29-DEC-11
channel ORA_DISK_2: finished piece 1 at 29-DEC-11
piece handle=/u01/rmanbk/DB-05mvehja_1_1 tag=BEFORE-FULL-BK comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_2: starting compressed full datafile backupset
channel ORA_DISK_2: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_2: starting piece 1 at 29-DEC-11
channel ORA_DISK_2: finished piece 1 at 29-DEC-11
piece handle=/u01/rmanbk/DB-06mvehjh_1_1 tag=BEFORE-FULL-BK comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_1: finished piece 1 at 29-DEC-11
piece handle=/u01/rmanbk/DB-04mvehja_1_1 tag=BEFORE-FULL-BK comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:10
Finished backup at 29-DEC-11

Starting Control File and SPFILE Autobackup at 29-DEC-11
piece handle=/u01/rmanbk/cf-c-3845730394-20111229-00 comment=NONE
Finished Control File and SPFILE Autobackup at 29-DEC-11

RMAN>


RMAN> crosscheck backup;

using channel ORA_DISK_1
using channel ORA_DISK_2
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/rmanbk/DB-05mvehja_1_1 recid=2 stamp=771180138
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/rmanbk/DB-06mvehjh_1_1 recid=3 stamp=771180146
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/rmanbk/DB-04mvehja_1_1 recid=4 stamp=771180138
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/rmanbk/cf-c-3845730394-20111229-00 recid=5 stamp=771180148
Crosschecked 4 objects


RMAN>

RMAN> report need backup;

RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 3 days
Report of files that must be backed up to satisfy 3 days recovery window
File Days  Name
---- ----- -----------------------------------------------------

RMAN>

RMAN> alter database open;

database opened

RMAN>






---------------------------------------------------------------------

THE END......




没有评论:

发表评论