您的位置:首页 > 数据库 > Oracle

ORACLE 10G 数据库静默安装

2013-11-16 17:36 411 查看
 
最近整理了一下 oracle 静默安装的操作步骤。 虽然安装的活越来越简单,但是有时候受环境限制,还是需要进行一些静默的操作。 不是很难,但是熟悉一下, 还是很有必要。特别是遇到大批量安装的情况。
 

1. 环境准备

1.1. 软件信息

虚拟机:VirtualBox 4.2
操作系统:Oracle Linux Server release 5.9
数据库:ORACLE 10.2.0.1 X86_64 Linux
 

1.2. 新建用户、组

[root@ocmrac1 ~]# groupadd oinstall
[root@ocmrac1 ~]# groupadd dba
[root@ocmrac1 ~]# useradd oracle -g oinstall -G dba -d /home/oracle -p oracle
 

1.3. 创建安装目录

[root@ocmrac1 ~]# mkdir /u01
[root@ocmrac1 ~]# chown -R oracle:oinstall /u01
 

1.4. 配置环境变量

[oracle@ocmrac1 ~]$ vi .bash_profile
# .bash_profile
# User specific environment and startup programs
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin:/sbin:/usr/sbin:
alias oh='cd $ORACLE_HOME'
alias sql='sqlplus / as sysdba'
 
使环境变量生效
[oracle@ocmrac1 ~]$ . .bash_profile
 
前面这些操作都属于常规操作,不管是图形还是静默都需要处理。
 

2. 安装数据库软件

2.1. 配置oraInst.loc文件

[oracle@ocmrac1 ~]$ su - root
Password:
[root@ocmrac1 ~]# cd /etc
[root@ocmrac1 etc]# vi oraInst.loc
inventory_loc=/u01/app/oracle/oraInventory
inst_group=oinstall
 
备注:inventory_loc=$ORACLE_BASE/oraInventory
[root@ocmrac1 etc]# chown oracle:oinstall oraInst.loc
[root@ocmrac1 etc]# chmod 664 oraInst.loc
 

2.2. 配置响应文件

2.2.1. 响应文件的类型 响应文件存放在数据库软件安装介质的 database/response 目录下。
[oracle@ocmrac1 ~]$ cd database/
[oracle@ocmrac1 database]$ ls
doc  install  response  runInstaller  stage  welcome.html
[oracle@ocmrac1 database]$ cd response/
[oracle@ocmrac1 response]$ ls
custom.rsp  dbca.rsp  emca.rsp  enterprise.rsp  netca.rsp  standard.rsp
 
2.2.2. 拷贝、编辑响应文件 [oracle@ocmrac1 response]$ cp enterprise.rsp ~
[oracle@ocmrac1 response]$ vi ~/enterprise.rsp
修改FROM_LOCATION参数,指定正确的products.xml文件位置:
[oracle@ocmrac1 ~]$ ls -la ./database/stage/products.xml
-rwxr-xr-x 1 oracle oinstall 797289 Jul  3  2005 ./database/stage/products.xml
FROM_LOCATION="/home/oracle//database/stage/products.xml"
  2.2.3. 通过OUI创建响应文件 [oracle@ocmrac1 ~]$ ./runInstaller -record -destinationFile /home/oracle/install10g.rep

 

2.3. 静默模式下运行Oracle Universal Installer

[oracle@ocmrac1 database]$ ./runInstaller -silent -noconfig -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
                                      Passed
All installer requirements met.
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-11-12_08-14-46PM. Please wait ...[oracle@ocmrac1 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/installActions2013-11-12_08-14-46PM.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,asianux-1,asianux-2
Actual Result: redhat-4
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.79; found make-1:3.81-3.el5.        Passed
Checking for binutils-2.14; found binutils-2.17.50.0.6-12.el5.  Passed
Checking for gcc-3.2; found gcc-4.1.2-46.el5.   Passed
Checking for libaio-0.3.96; found libaio-0.3.106-3.2.   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=142.      Passed
Checking for shmmax=536870912; found shmmax=4294967295. Passed
Checking for shmmni=4096; found shmmni=4096.    Passed
Checking for shmall=2097152; found shmall=1073741824.   Passed
Checking for file-max=65536; found file-max=327679.     Passed
Checking for VERSION=2.6.9; found VERSION=2.6.18-164.el5.       Passed
Checking for ip_local_port_range=1024 - 65000; found ip_local_port_range=1024 - 65000.  Passed
Checking for rmem_default=262144; found rmem_default=262144.    Passed
Checking for rmem_max=262144; found rmem_max=4194304.   Passed
Checking for wmem_default=262144; found wmem_default=262144.    Passed
Checking for wmem_max=262144; found wmem_max=262144.    Passed
Check complete. The overall result of this check is: Passed
Check complete: Passed
=======================================================================
Performing check for GLIBC
Checking Recommended glibc version
Expected result: ATLEAST=2.3.2-95.27
Actual Result: 2.5-42
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: 2968MB
Check complete. The overall result of this check is: Passed
Check complete: Passed
=======================================================================
Performing check for SwapSpace
Checking available swap space requirements ...
Expected result: 2968MB
Actual Result: 4959MB
Check complete. The overall result of this check is: Passed
Check complete: Passed
=======================================================================
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/db_1 (OraDbHome1)
    Installation Type: Enterprise Edition
Product Languages
   Simplified Chinese
   English
Space Requirements
   / Required 1.38GB (includes 108MB temporary) : Available 10.73GB
New Installations (107 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
   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
   Precompiler Common Files 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
   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
   Secure Socket Layer 10.2.0.1.0
   Oracle ODBC Driver 10.2.0.1.0
   Required Support Files 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
   Oracle Globalization Support 10.2.0.1.0
   Character Set Migration Utility 10.2.0.1.0
   LDAP Required Support Files 10.2.0.1.0
   Oracle Help for the  Web 1.1.10.0.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 Notification Service 10.1.0.3.0
   Oracle Code Editor 1.2.1.0.0I
   Perl Interpreter 5.8.3.0.2
   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 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
   Oracle Display Fonts 9.0.2.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
   SSL Required Support Files for InstantClient 10.2.0.1.0
   regexp 2.1.9.0.0
   Bali Share 1.1.18.0.0
   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.8.0
   Sun JDK 1.4.2.0.8
   Sun JDK extensions 10.1.2.0.0
-----------------------------------------------------------------------------
Installation in progress (Tue Nov 12 20:14:57 CST 2013)
...............................................................  18% Done.
...............................................................  36% Done.
...............................................................  54% Done.
...............................................................  72% Done.
................                                                 76% Done.
Install successful
Linking in progress (Tue Nov 12 20:16:01 CST 2013)
Link successful
Setup in progress (Tue Nov 12 20:16:19 CST 2013)
..............                                                  100% Done.
Setup successful
End of install phases.(Tue Nov 12 20:16:20 CST 2013)
WARNING:The following configuration scripts
/u01/app/oracle/product/10.2.0/db_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/silentInstall2013-11-12_08-14-46PM.log' for more details.

 

2.4. 使用root用户执行root.sh脚本

[root@ocmrac1 ~]# /u01/app/oracle/product/10.2.0/db_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/db_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.

 

3. 使用响应文件运行NetCa

[oracle@ocmrac1 response]$ pwd
/home/oracle/database/response
[oracle@ocmrac1 response]$ cp netca.rsp ~
[oracle@ocmrac1 response]$ cd
[oracle@ocmrac1 ~]$ netca /silent /responsefile /home/oracle/netca.rsp
Parsing command line arguments:
    Parameter "silent" = true
    Parameter "responsefile" = /home/oracle/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Listener started at port:1521
Oracle Net Listener Startup:
    Running Listener Control:
      /u01/app/oracle/product/10.2.0/db_1/bin/lsnrctl start LISTENER
    Listener Control complete.
    Listener started successfully.
Listener configuration complete.
Default local naming configuration complete.
Oracle Net Services configuration successful. The exit code is 0
[oracle@ocmrac1 ~]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 12-NOV-2013 20:49:59
Copyright (c) 1991, 2005, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                12-NOV-2013 20:49:05
Uptime                    0 days 0 hr. 0 min. 54 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocmrac1)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@ocmrac1 ~]$ cd $ORACLE_HOME/network/admin
[oracle@ocmrac1 admin]$ more listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
  )
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = ocmrac1)(PORT = 1521))
    )
  )

 

4. 使用响应文件运行dbca

4.0.1. 复制建库模版 [oracle@ocmrac1 templates]$ cd $ORACLE_HOME/assistants/dbca/templates
[oracle@ocmrac1 templates]$ ls
Data_Warehouse.dbc  example.dmp          New_Database.dbt   Seed_Database.dfb
example01.dfb       General_Purpose.dbc  Seed_Database.ctl  Transaction_Processing.dbc
[oracle@ocmrac1 templates]$ cp General_Purpose.dbc ~
  4.0.2. 复制响应文件 [oracle@ocmrac1 ~]$ cd database/response/
[oracle@ocmrac1 response]$ ls
custom.rsp  dbca.rsp  emca.rsp  enterprise.rsp  netca.rsp  standard.rsp
[oracle@ocmrac1 response]$ cp dbca.rsp ~
修改建库模版:
TEMPLATENAME = "General_Purpose.dbc"
  4.0.3. 静默运行dbca [oracle@ocmrac1 ~]$ dbca -silent -createdatabase -responseFile dbca.rsp
Copying database files
1% complete
3% complete
11% complete
18% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/dbca/acct/acct.log" for further details.

 

5. 卸载数据库软件

5.0.1. 卸载安装软件 [oracle@ocmrac1 database]$ ./runInstaller -silent -deinstall -removeallfiles -removeAllPatches -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
                                      Passed
All installer requirements met.
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-11-12_08-27-44PM. Please wait ...[oracle@ocmrac1 database]$ Oracle Universal Installer, Version 10.2.0.1.0 Production
Copyright (C) 1999, 2005, Oracle. All rights reserved.
Starting deinstall
Deinstall in progress (Tue Nov 12 20:27:48 CST 2013)
Configuration assistant "Oracle Database Configuration Assistant" succeeded
Configuration assistant "Oracle Net Configuration Assistant - Deinstall Script" failed
........................................................................................................... 100% Done.
Deinstall successful
End of install phases.(Tue Nov 12 20:28:02 CST 2013)
End of deinstallations
Please check '/u01/app/oracle/oraInventory/logs/silentInstall2013-11-12_08-27-44PM.log' for more details.
  5.0.2. 清除安装目录 [oracle@ocmrac1 u01]$ cd /u01
[oracle@ocmrac1 u01]$ rm -rf  *
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息