静默方式安装10g数据库软件+升级patch+手工建库

Posted gavanwanggw

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了静默方式安装10g数据库软件+升级patch+手工建库相关的知识,希望对你有一定的参考价值。

通常我们安装Oracle数据库软件。都是用OUI图形界面来完毕的,但有些Unix/Linux系统中并未安装图形系统,也就无法使用图形界面来安装Oracle的产品了。对于这样的场景,就仅仅能採用静默方式来安装了。Oracle提供了这样的silent方式,主要是通过配置响应文件rsp来完毕的。


一、静默安装10.2.0.1数据库软件


--解压安装包
[[email protected] u01]$ unzip 10201_database_linux32.zip
[[email protected] u01]$ cd database/
[[email protected] database]$ ll
total 28
drwxr-xr-x 9 oracle oinstall 4096 Jul  3  2005 doc
drwxr-xr-x 5 oracle oinstall 4096 Jul  3  2005 install
drwxr-xr-x 2 oracle oinstall 4096 Jul  3  2005 response
-rwxr-xr-x 1 oracle oinstall 1327 Jul  3  2005 runInstaller
drwxr-xr-x 9 oracle oinstall 4096 Jul  3  2005 stage
-rwxr-xr-x 1 oracle oinstall 5213 Jul  3  2005 welcome.html
[[email protected] database]$ cd response/
[[email protected] response]$ ll
total 244
-rwxr-xr-x 1 oracle oinstall 25278 Jul  3  2005 custom.rsp
-rwxr-xr-x 1 oracle oinstall 44600 Jul  3  2005 dbca.rsp
-rwxr-xr-x 1 oracle oinstall  8476 Jul  3  2005 emca.rsp
-rwxr-xr-x 1 oracle oinstall 71113 Jul  3  2005 enterprise.rsp
-rwxr-xr-x 1 oracle oinstall  5742 Jul  3  2005 netca.rsp
-rwxr-xr-x 1 oracle oinstall 71113 Jul  3  2005 standard.rsp
[[email protected] response]$ vi enterprise.rsp


--改动对应文件enterprise.rsp内容
把下面几项參数的<Value Required><Value Unspecified>替换成相应的值:


UNIX_GROUP_NAME=oinstall
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
ORACLE_HOME_NAME=OraDb10g_Home1
ORACLE_HOSTNAME=prod
s_nameForDBAGrp=dba
n_configurationOption=3
#              1 - Create a Database
#              2 - Configure an ASM instance
#              3 - Install Software Only--仅安装软件

s_ASMSYSPassword="oracle"
s_ASMSYSPasswordAgain="oracle"

n_dbType=1 --DBCA时才须要。能够不配置
#              1 - General Purpose Starter Database
#              2 - Transaction Processing Starter Database
#              3 - Data Warehouse Starter Database
#              4 - Advanced Configuration

s_globalDBName=prod
s_dbSid=prod
s_dbRetChar="WE8ISO8859P1" -> s_dbRetChar="ZHS16GBK"
b_loadExampleSchemas=false -> b_loadExampleSchemas=true


n_dbStorageType=1    --DBCA才须要,能够不配置
#              1 - Place the data files on a file system--採用本地文件系统路径
#              2 - Use Automatic Storage Management (ASM)
#              3 - Place the datafiles on raw partitions


--開始运行静默安装Oracle软件
[[email protected] database]$ ./runInstaller -ignoreSysPrereqs -silent -responseFile /u01/database/response/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/OraInstall2014-08-29_02-39-21PM. Please wait ...[[email protected] 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/installActions2014-08-29_02-39-21PM.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-3
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-9.el5.   Passed
Checking for gcc-3.2; found gcc-4.1.2-44.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=128.      Passed
Checking for shmmax=536870912; found shmmax=2147483648. Passed
Checking for shmmni=4096; found shmmni=4096.    Passed
Checking for shmall=2097152; found shmall=2097152.      Passed
Checking for file-max=65536; found file-max=65536.      Passed
Checking for VERSION=2.4.21; found VERSION=2.6.18-128.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=262144.    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-34
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: 1008MB
Check complete. The overall result of this check is: Passed




Check complete: Passed
=======================================================================
Performing check for SwapSpace
Checking available swap space requirements ...
Expected result: 1512MB
Actual Result: 2047MB
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: /u01/database/stage/products.xml
    Oracle Home: /u01/app/oracle/product/10.2.0/db_1 (OraDb10g_Home1)
    Installation Type: Enterprise Edition
product Languages
   English
Space Requirements
   / Required 1.36GB (includes 108MB temporary) : Available 1.46GB
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 (Fri Aug 29 14:40:10 CST 2014)
...............................................................  18% Done.
...............................................................  36% Done.
...............................................................  54% Done.
...............................................................  73% Done.
............                                                     76% Done.
Install successful


Linking in progress (Fri Aug 29 14:46:38 CST 2014)  --注意。这里须要link一段时间,耐心等待直到完毕
Link successful


Setup in progress (Fri Aug 29 14:52:26 CST 2014)
..............                                                  100% Done.
Setup successful


End of install phases.(Fri Aug 29 14:52:36 CST 2014)
WARNING:A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.
To register the new inventory please run the script ‘/u01/app/oracle/oraInventory/orainstRoot.sh‘ with root privileges. 
If you do not register the inventory, you may not be able to update or patch the products you installed.



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/silentInstall2014-08-29_02-39-21PM.log‘ for more details.


--另外开启一个session。分别运行orainstRoot.sh和root.sh脚本
[[email protected] oracle]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory to 770.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete
[[email protected] oracle]# /u01/app/oracle/product/10.2.0/db_1/root.sh
略……


二、静默安装10.2.0.5.0 Patch Set Release(PSR)


--解压安装包
[[email protected] /u01]$ unzip p8202632_10205_LINUX.zip
[[email protected] /u01]$ cd /Disk1/response
[[email protected] response]# ll
total 28
-rwxr-xr-x 1 root root 27919 Oct 20  2009 patchset.rsp


--改动响应文件patchset.rsp
[[email protected] response]# vi patchset.rsp
改动下面内容:
UNIX_GROUP_NAME=oinstall
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
ORACLE_HOME_NAME=OraDb10g_Home1
OUI_HOSTNAME=prod --注意,刚才静默安装数据库软件时,相应的參数名为ORALCE_HOSTNAME,注意差别!




能够发现。PSR的參数要比OARACLE软件的參数少很多


假设忘记ORACLE_HOME_NAME的名字,能够查看$ORACLE_BASE/oraInventory/ContentsXML/inventory.xml文件的内容:


[[email protected] ~]$ cd $ORACLE_BASE/oraInventory/ContentsXML
[[email protected] ContentsXML]$ ll
total 12
-rw-rw---- 1 oracle oinstall 264 Aug 29 14:52 comps.xml
-rw-rw---- 1 oracle oinstall 415 Aug 29 14:52 inventory.xml
-rw-rw---- 1 oracle oinstall 274 Aug 29 14:52 libs.xml
[[email protected] ContentsXML]$ cat inventory.xml 
<?

xml version="1.0" standalone="yes" ?

>
<!-- Copyright (c) 2005 Oracle Corporation. All rights Reserved -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>10.2.0.1.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="OraDb10g_Home1" LOC="/u01/app/oracle/product/10.2.0/db_1" TYPE="O" IDX="1"/>
</HOME_LIST>
</INVENTORY>
[[email protected] ContentsXML]$ 


--開始静默安装patch
[[email protected] response]$ cd ..
[[email protected] Disk1]$ ./runInstaller -silent -responseFile ./response/patchset.rsp
...
OUI-10203:The specified response file ‘./response/patchset.rsp‘ is not found. Make sure that the response file specified exists and you have read privileges to this file.


这里必须指定绝对路径,否则会提示找不到rsp文件


[[email protected] Disk1]$ ./runInstaller -silent -responseFile /u01/Disk1/response/patchset.rsp
...
SEVERE:OUI-10029:You have specified a non-empty directory to install this product. It is recommended to specify either an empty or a non-existent directory. You may, however, choose to ignore this message if the directory contains Operating System generated files or subdirectories like lost+found.


因为和之前ORACLE_HOME路径同样。会报OUI-10029,加上-force參数能够忽略这个问题


[[email protected] Disk1]$ ./runInstaller -silent -responseFile /u01/Disk1/response/patchset.rsp -force


然后会提示没有设置MOS账号,静默安装终止


SEVERE:Values for the following variables could not be obtained from the command line or response file(s): 
  MYORACLESUPPORT_USERNAME(MyOracleSupportUsername) 
Silent install cannot continue.


--再次改动patchset.rsp
MYORACLESUPPORT_USERNAME=[email protected]  --填写一个不存在的账号,欺骗安装程序
DECLINE_SECURITY_UPDATES=ture

[[email protected] Disk1]$ ./runInstaller -silent -responseFile /u01/Disk1/response/patchset.rsp -force


SEVERE:Unable to establish a network connection to Oracle. If your systems require a proxy server for outbound internet connections, enter the proxy server details. If network connectivity to Oracle is not possible,set ‘DECLINE_SECURITY_UPDATES‘ to ‘true‘.


此时事实上已经设置了DECLINE_SECURITY_UPDATES=ture,但不知为何安装程序识别不到,必须在命令行中带上这2个參数才行!


[[email protected] Disk1]$ ./runInstaller -silent -responseFile /zlm/Disk1/response/patchset.rsp [email protected] DECLINE_SECURITY_UPDATES=true -force


最终開始执行了。整个安装过程和装10.2.0.1软件时大同小异。略……


除了软件安装能够用配置rsp响应文件来静默安装,相同地。dbca,netca等也都能够通过配置各自的rsp响应文件来完毕静默安装,这里就不演示了。


--运行root.sh脚本(假设之前已经运行过orainstRoot.sh脚本,就无需再运行一次了,否则必须先运行一次)
[[email protected] oracle]# /u01/app/oracle/product/10.2.0/db_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/db_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.


至此,软件安装完成


三、手动建库


--改动环境变量:
[[email protected] ~]$ cd ~
[[email protected] ~]$ vi .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=prod
export EDITOR=vi

[[email protected] ~]$ source .bash_profile
[[email protected] ~]$ env|grep -i sid
ORACLE_SID=prod    


--建立相关文件夹:
[[email protected] ~]$ cd $ORACLE_BASE
[[email protected] oracle]$ mkdir -p admin/prod/{a,b,c,u}dump
[[email protected] oracle]$ mkdir -p oradata/prod


--改动/etc/oratab文件

[[email protected] oracle]$ cat >> /etc/oratab <<EOF
prod:/u01/app/oracle/product/10.2.0/db_1:N 

EOF

 

--建立初始化參数文件initprod.ora
[[email protected] ~]$ cd $ORACLE_HOME/dbs
[[email protected] dbs]$ cat init.ora|grep -v ^#|grep -v ^$>initprod.ora   --去掉凝视内容

[[email protected] dbs]$ vi initprod.ora


改动为例如以下内容:
db_name = prod
db_files = 80
db_file_multiblock_read_count = 8
db_block_buffers = 100

shared_pool_size = 150M

db_chache_size = 250M

log_checkpoint_interval = 10000
processes = 150
parallel_max_servers = 5
log_buffer = 1024000
max_dump_file_size = 10240000
global_names = false
control_files              = (/u01/app/oracle/oradata/prod/control01.ctl,
                              /u01/app/oracle/oradata/prod/control02.ctl,
                              /u01/app/oracle/oradata/prod/control03.ctl)
log_archive_dest_1         = "LOCATION=/u01/archivelog"
log_archive_dest_state_1   = enable
db_block_size              = 8192
undo_management            = AUTO
undo_tablespace            = undotbs
compatible                 = 10.2.0
sga_target                 = 500M
sga_max_size               = 500M



--建立归档文件夹
[[email protected] ~]$ mkdir /u01/archivelog


--创建password文件orapwprod
[[email protected] dbs]$ orapwd file=orapwprod password=oracle entries=5


--启动SQLPLUS
[[email protected] dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - production on Tue Mar 6 16:08:29 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to an idle instance.
 
--创建SPFILE
SQL> create spfile from pfile;
File created.


--启动到nomount
SQL> startup nomount
ORA-00824: cannot set sga_target due to existing internal settings, see alert log for more information
SQL> exit
Disconnected
[[email protected] dbs]$ ll
total 44
-rw-r----- 1 oracle oinstall   207 Aug 29 21:23 alert_prod.log
-rw-r--r-- 1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r----- 1 oracle oinstall  8385 Sep 11  1998 init.ora
-rw-r--r-- 1 oracle oinstall   776 Aug 29 21:19 initprod.ora
-rw-r----- 1 oracle oinstall  2048 Aug 29 21:17 orapwprod
-rw-r----- 1 oracle oinstall  2560 Aug 29 21:20 spfileprod.ora
[[email protected] dbs]$ cat alert_prod.log 
The value of parameter db_block_buffers is below
the required minimum
The new value is ((4MB * the number of cpus)/db_block_size)
Fri Aug 29 21:23:08 CST 2014
Cannot set sga_target with db_block_buffers set


原来是db_block_buffers = 100设置得太小了,依据公式应该=512000,但重新启动后依旧无效。


查阅官方资料得知。SGA_TARGET > 0 不能与db_block_buffer这个过时的參数共存,否则就会出现ORA-00824错误。那么如今把该參数去掉后又一次创建spfile,并启动到nomount就可以


SQL> create spfile from pfile;


File created.


SQL> startup nomount
ORACLE instance started.


Total System Global Area  524288000 bytes
Fixed Size                  1274668 bytes
Variable Size             146803924 bytes
Database Buffers          373293056 bytes
Redo Buffers                2916352 bytes
SQL> 


--编辑创建数据库语句
[[email protected] scripts]$ touch createprod.sql
[[email protected] scripts]$ vi createprod.sql
   CREATE DATABASE prod
   USER SYS IDENTIFIED BY oracle
   USER SYSTEM IDENTIFIED BY oracle
   LOGFILE GROUP 1 (‘/u01/app/oracle/oradata/prod/redo01a.log‘,‘/u01/app/oracle/oradata/prod/redo01b.log‘) SIZE 50M,
           GROUP 2 (‘/u01/app/oracle/oradata/prod/redo02a.log‘,‘/u01/app/oracle/oradata/prod/redo02b.log‘) SIZE 50M,
           GROUP 3 (‘/u01/app/oracle/oradata/prod/redo03a.log‘,‘/u01/app/oracle/oradata/prod/redo03b.log‘) SIZE 50M
   MAXLOGFILES 200
   MAXLOGMEMBERS 5
   MAXLOGHISTORY 200
   MAXDATAFILES 100
   MAXINSTANCES 2

   CHARACTER SET AL32UTF8
   NATIONAL CHARACTER SET AL16UTF16
   DATAFILE ‘/u01/app/oracle/oradata/prod/system01.dbf‘ SIZE 300M REUSE
   ‘/u01/app/oracle/oradata/prod/user01.dbf‘ SIZE 100M REUSE
   ‘/u01/app/oracle/oradata/prod/example01.dbf‘ SIZE 100M REUSE
   EXTENT MANAGEMENT LOCAL
   SYSAUX DATAFILE ‘/u01/app/oracle/oradata/prod/sysaux01.dbf‘ SIZE 300M REUSE
   DEFAULT TEMPORARY TABLESPACE temp
   TEMPFILE ‘/u01/app/oracle/oradata/prod/temp01.dbf‘ SIZE 100M REUSE
   UNDO TABLESPACE undotbs 
   DATAFILE ‘/u01/app/oracle/oradata/prod/undotbs01.dbf‘ SIZE 100M REUSE AUTOEXTEND ON MAXSIZE 2G;


--运行语句创建脚本
[[email protected] ~]$ sqlplus / as sysdba


SQL*Plus: Release 10.2.0.5.0 - Production on Fri Aug 29 21:56:55 2014


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




Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> @createprod.sql
CREATE DATABASE prod
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced

建库脚本遭遇错误,实例被终止了


SQL> exit
[[email protected] ~]$ sqlplus / as sysdba


SQL*Plus: Release 10.2.0.5.0 - Production on Fri Aug 29 22:01:06 2014


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


Connected to an idle instance.


SQL> startup
ORACLE instance started.


Total System Global Area  524288000 bytes
Fixed Size                  1274668 bytes
Variable Size             146803924 bytes
Database Buffers          373293056 bytes
Redo Buffers                2916352 bytes
ORA-01079: ORACLE database was not properly created, operation aborted


SQL> !oerr ora 1079
01079, 00000, "ORACLE database was not properly created, operation aborted"
// *Cause:  There was an error when the database or control file was created.
// *Action:  Check what error was signaled when the database was first
//           created or when the control file was recreated. Take appropriate
//           actions to recreate the database or a new control file.


SQL> 


提示须要重建数据库或控制文件,假设要重建控制文件,也没办法用备份控制文件到trace的方法来获得创建脚本。仅仅能手动加入控制文件须要的内容。由于如今还是在nomount状态下


--查看$ORACLE_BASE/oradata/prod中新创建的数据文件
[[email protected] prod]# ll
total 948624
-rw-r----- 1 oracle oinstall   8863744 Aug 29 21:58 control01.ctl
-rw-r----- 1 oracle oinstall   8863744 Aug 29 21:58 control02.ctl
-rw-r----- 1 oracle oinstall   8863744 Aug 29 21:58 control03.ctl
-rw-r----- 1 oracle oinstall 104865792 Aug 29 21:57 example01.dbf
-rw-r----- 1 oracle oinstall  52429312 Aug 29 21:58 redo01a.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 21:58 redo01b.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 21:57 redo02a.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 21:57 redo02b.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 21:57 redo03a.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 21:57 redo03b.log
-rw-r----- 1 oracle oinstall 314580992 Aug 29 21:58 system01.dbf
-rw-r----- 1 oracle oinstall 104865792 Aug 29 21:58 undotbs01.dbf
-rw-r----- 1 oracle oinstall 104865792 Aug 29 21:57 user01.dbf


控制文件也已经生成了,为何还会报错呢,难道是脚本有问题?细致观察后发现,sysaux01.dbf和temp01.dbf并未创建成功,由于实例遭遇故障,实例终止了


--删除控制文件
[[email protected] prod]# rm -rf control*
[[email protected] prod]# ll
total 922608
-rw-r----- 1 oracle oinstall 104865792 Aug 29 22:27 example01.dbf
-rw-r----- 1 oracle oinstall  52429312 Aug 29 22:27 redo01a.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 22:27 redo01b.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 22:26 redo02a.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 22:26 redo02b.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 22:26 redo03a.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 22:26 redo03b.log
-rw-r----- 1 oracle oinstall 314580992 Aug 29 22:26 system01.dbf
-rw-r----- 1 oracle oinstall 104865792 Aug 29 22:27 undotbs01.dbf
-rw-r----- 1 oracle oinstall 104865792 Aug 29 22:27 user01.dbf


--依据控制文件模板创建一个符合自己数据库的控制文件
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "PROD" NORESETLOGS 
   MAXLOGFILES 200
   MAXLOGMEMBERS 5
   MAXLOGHISTORY 200
   MAXDATAFILES 100
   MAXINSTANCES 2
LOGFILE 
GROUP 1 (‘/u01/app/oracle/oradata/prod/redo01a.log‘,‘/u01/app/oracle/oradata/prod/redo01b.log‘) SIZE 50M,
GROUP 2 (‘/u01/app/oracle/oradata/prod/redo02a.log‘,‘/u01/app/oracle/oradata/prod/redo02b.log‘) SIZE 50M,
GROUP 3 (‘/u01/app/oracle/oradata/prod/redo03a.log‘,‘/u01/app/oracle/oradata/prod/redo03b.log‘) SIZE 50M
DATAFILE
‘/u01/app/oracle/oradata/prod/system01.dbf‘,
‘/u01/app/oracle/oradata/prod/example01.dbf‘,
‘/u01/app/oracle/oradata/prod/user01.dbf‘,
‘/u01/app/oracle/oradata/prod/undotbs01.dbf‘
CHARACTER SET AL32UTF8
;


重建控制文件后,open数据库时会报数据文件system01.dbf须要恢复。无法打开数据库。用resetlogs也不行


--把之前创建的文件所有删除后,再次尝试运行脚本
SQL> @createprod.sql
CREATE DATABASE prod
*
ERROR at line 1:
ORA-01501: CREATE DATABASE failed
ORA-19502: write error on file "/u01/app/oracle/oradata/prod/redo03a.log",
blockno 172033 (blocksize=512)
ORA-27072: File I/O error
Linux Error: 9: Bad file descriptor

Additional information: 4
Additional information: 172033
Additional information: 1003008


SQL> !
[[email protected] ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      5.7G  5.0G  486M  92% /
/dev/sda1              99M   12M   82M  13% /boot
tmpfs                 506M     0  506M   0% /dev/shm
/dev/sdb1             7.9G  2.3G  5.3G  31% /zlm


刚才的问题。初步怀疑是空间分配得太小,无法创建所有的数据库文件所致,可用空间仅仅剩486M了。/dev/sdb1是我另外挂载的一个8G磁盘,用来放安装文件,也是由于可用空间太小的缘故


--删除不必要的文件后,再次查看磁盘空间
[[email protected] ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      5.7G  4.2G  1.3G  77% /
/dev/sda1              99M   12M   82M  13% /boot
tmpfs                 506M     0  506M   0% /dev/shm
/dev/sdb1             7.9G  2.3G  5.3G  31% /zlm


--如今有1.3G可用空间。再又一次创建一次数据库
[[email protected] ~]$ sqlplus / as sysdba


SQL*Plus: Release 10.2.0.5.0 - Production on Fri Aug 29 23:48:13 2014


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


Connected to an idle instance.


SQL> startup nomount
ORACLE instance started.


Total System Global Area  524288000 bytes
Fixed Size                  1274668 bytes
Variable Size             146803924 bytes
Database Buffers          373293056 bytes
Redo Buffers                2916352 bytes
SQL> @createprod.sql


Database created.


SQL> 


--再次查看创建的文件
[[email protected] prod]$ ll
total 1256212
-rw-r----- 1 oracle oinstall   8863744 Aug 29 23:52 control01.ctl
-rw-r----- 1 oracle oinstall   8863744 Aug 29 23:52 control02.ctl
-rw-r----- 1 oracle oinstall   8863744 Aug 29 23:52 control03.ctl
-rw-r----- 1 oracle oinstall 104865792 Aug 29 23:49 example01.dbf
-rw-r----- 1 oracle oinstall  52429312 Aug 29 23:50 redo01a.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 23:50 redo01b.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 23:48 redo02a.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 23:48 redo02b.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 23:48 redo03a.log
-rw-r----- 1 oracle oinstall  52429312 Aug 29 23:48 redo03b.log
-rw-r----- 1 oracle oinstall 314580992 Aug 29 23:49 sysaux01.dbf
-rw-r----- 1 oracle oinstall 314580992 Aug 29 23:49 system01.dbf
-rw-r----- 1 oracle oinstall 104865792 Aug 29 23:49 temp01.dbf
-rw-r----- 1 oracle oinstall 104865792 Aug 29 23:49 undotbs01.dbf
-rw-r----- 1 oracle oinstall 104865792 Aug 29 23:49 user01.dbf


这次,在创建数据库脚本中指定的数据文件。都正确地被创建成功了,包含之前没有的sysaux01.dbftemp01.dbf


--再来看看如今还剩多少剩余空间
[[email protected] prod]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      5.7G  5.4G   77M  99% /
/dev/sda1              99M   12M   82M  13% /boot
tmpfs                 506M     0  506M   0% /dev/shm
/dev/sdb1             7.9G  2.3G  5.3G  31% /zlm


从1.3G到77M。一个数据库实例用掉了将近1G的磁盘空间。第一次建库失败。就是由于在/u01下放了一个大于77M的文件。由于没有剩余空间造成建库失败!


至此。完毕了手工建库的所有过程


总结:


通过silent方式安装数据库软件,升级patch。然后手工建库,都是在没有图形界面支持下完毕的。当中装软件要注意安装前參数的配置。尤其是升级patch的时候,必须在命令后面加上2个參数而且使用-force才干完毕安装。手工建库的难点是配置init.ora初始化參数创建数据库的脚本。如平时注意收集整理。准备好对应的脚本,那么实际操作起来就能得心应手了,能够非常快的完毕批量建库的任务,众所周知,OUI的DBCA,常常会卡在86%非常久。而用silent命令行方式。能够大大加快这一步骤,前提是你能熟悉运用命令和參数设置。









以上是关于静默方式安装10g数据库软件+升级patch+手工建库的主要内容,如果未能解决你的问题,请参考以下文章

WebSphere V8.5 静默安装升级-使用响应文件静默安装软件包(生成相应文件,不安装)以及managesdk管理SDK

如何app自动升级 静默安装 android

SVN软件中patch的的运用以及patch介绍

记一次linux静默安装oracle加手工建库

oracle linux 6.5 安装 oracle 12cR2数据库-手工静默建CDB库

如何实现android静默安装