分类: Oracle
2015-04-03 05:22:00
oracle 11g R4 silent installation
1. set hostname && /etc/hosts
[root@silent1 /]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.239.221 silent1
[root@silent1 /]#
2. Edit the /etc/sysctl.conf and add following lines:
# added for Oracle 11.2.0.3
kernel.shmall = 2097152
kernel.shmmax = 1050470400
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
Now execute sysctl -p command to apply the new settings:
3. Edit the /etc/pam.d/login file and add following line:
# added for Oracle 11.2.0.3
session required pam_limits.so
4. Edit /etc/security/limits.conf file:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 10240
oracle hard nofile 65536
oracle soft stack 10240
5. Edit /etc/selinux/config && stop firewall
SELINUX=disabled
[root@silent1 /]# chkconfig --list iptables
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@silent1 /]# chkconfig iptables off
[root@silent1 /]# chkconfig --list iptables
iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@silent1 /]# service iptables status
6. install rpms
rpm -ivh compat-libstdc++-33-3.2.3-69.el6.*.rpm \
elfutils-devel-0.148-1.el6.x86_64.rpm \
elfutils-libelf-devel-0.148-1.el6.x86_64.rpm \
gcc-c++-4.4.4-13.el6.x86_64.rpm \
glibc-2.12-1.7.el6.i686.rpm \
glibc-devel-2.12-1.7.el6.i686.rpm \
libaio-devel-0.3.107-10.el6.x86_64.rpm \
libaio-0.3.107-10.el6.i686.rpm \
libgcc-4.4.4-13.el6.i686.rpm \
libstdc++-devel-4.4.4-13.el6.x86_64.rpm \
libtool-ltdl-2.2.6-15.5.el6.i686.rpm \
nss-softokn-freebl-3.12.7-1.1.el6.i686.rpm \
readline-6.0-3.el6.i686.rpm \
ncurses-libs-5.7-3.20090208.el6.i686.rpm \
libcap-2.16-5.2.el6.i686.rpm \
libattr-2.4.44-4.el6.i686.rpm \
compat-libcap1-1.10-1.*.rpm
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' \binutils compat-libstdc++ unixODBC-devel unixODBC elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make numactl-devel sysstat
[root@silent1 Packages]# rpm -ivh unixODBC-2.2.14-14.el6.x86_64.rpm
warning: unixODBC-2.2.14-14.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
package unixODBC-2.2.14-14.el6.x86_64 is already installed
[root@silent1 Packages]# rpm -ivh unixODBC-devel-2.2.14-14.el6.x86_64.rpm
warning: unixODBC-devel-2.2.14-14.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
package unixODBC-devel-2.2.14-14.el6.x86_64 is already installed
[root@silent1 Packages]#
7. create user /groups and path
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
mkdir -p /u01/app/oracle/oradata
mkdir -p /u01/app/oraInventory
mkdir -p /u01/app/oracle/oradata_back
chown -R oracle:oinstall /u01/app
chmod 775 /u01/app
oracle user profile :
TMP=/tmp;export TMP
TMPDIR=$TMP;export TMPDIR
ORACLE_BASE=/u01/app/oracle;export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4;export ORACLE_HOME
ORACLE_SID=prod;export ORACLE_SID
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:/usr/lib:/usr/local/lib:/usr/lib64
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
umask 022
[root@silent1 stage]# cp ../response/db_install.rsp /etc/dbsoft_install.rsp
[root@silent1 stage]#
./runInstaller -silent -responseFile /etc/dbsoft_install.rsp
./runInstaller -silent -force -responseFile $HOME/db.rsp
Starting Oracle Universal Installer...
[oracle@silent1 database]$ ./runInstaller -silent -responseFile /etc/dbsoft_install.rsp
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 30781 MB Passed
Checking swap space: must be greater than 150 MB. Actual 6143 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-04-04_07-53-16AM. Please wait ...[oracle@silent1 database]$ [WARNING] - My Oracle Support Username/Email Address Not Specified
A log of this session is currently saved as: /tmp/OraInstall2015-04-04_07-53-16AM/installActions2015-04-04_07-53-16AM.log. Oracle recommends that if you want to keep this log, you should move it from the temporary location to a more permanent location.
[oracle@silent1 database]$
其中DECLINE_SECURITY_UPDATES一定要设置成true,否则在安装的时候会出现以下的告警:
[WARNING] - My Oracle Support Username/Email Address Not Specified
[SEVERE] - Provide the My Oracle Support password.
无法继续安装。 但是经过测试 , 即便设置为 true 还是报错
--- http://blog.itpub.net/4227/viewspace-688497/
--- master yangtingkun found :
最后检查了一下metalink,发现oracle还居然在专门的文档ID 883714.1描述了这个问题,错误原因是:
'My Oracle Support' Account user name and password were not specified in the response file.
而解决方法居然就是:
Specify the My Oracle Support Account User name and password in your response file
不过从Oracle对于metalink帐号要求越来越严格,也可以看出Oracle策略的趋势。
[WARNING] [INS-32055] The Central Inventory is located in the Oracle base. ### INVENTORY_LOCATION 不要放到 ORACLE_BASE 目录下,否则会有警告。
### 最终使用命令行的方式安装完成:
./runInstaller -silent \ ### ./runInstaller -silent -debug -force \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/u01/app/oracle/oraInventory \
ORACLE_HOME=/u01/app/oracle/product/11.2.0.4 \
ORACLE_BASE=/u01/app/oracle \
oracle.install.db.InstallEdition=EE \
oracle.install.db.isCustomInstall=false \
oracle.install.db.DBA_GROUP=dba \
oracle.install.db.OPER_GROUP=oinstall \
DECLINE_SECURITY_UPDATES=true
11.2.0.4 差不多有以下参数, 如果仅仅是安装数据库软件, db 相关参数直接忽视 :
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_BASE=/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0
oracle.install.db.DBA_GROUP=oinstall
oracle.install.db.OPER_GROUP=dba
oracle.install.db.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=false
oracle.install.db.racOneServiceName=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=
oracle.install.db.config.starterdb.SID=
oracle.install.db.config.starterdb.characterSet=ZHS16GBK
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=yourpasswd
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/oracle/oradata
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/oracle/oraInventory
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=false
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
PROXY_REALM=
COLLECTOR_SUPPORTHUB_URL=
oracle.installer.autoupdates.option=SKIP_UPDATES
oracle.installer.autoupdates.downloadUpdatesLoc=
AUTOUPDATES_MYORACLESUPPORT_USERNAME=
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
manual database creations , Below are the main steps:
1. Specify an Instance Identifier (SID)
2. Ensure Required Environment Variables Are Set.
3. Choose a Database Administrator Authentication Method.
4. Create the Initialization Parameter File.
5. Connect to the Instance & Create a Server Parameter File.
6. Start the Instance.
7. Issue the CREATE DATABASE Statement.
8. Create Additional Tablespaces.
9. Run Scripts to Build Data Dictionary Views.
10. (Optional) Run Scripts to Install Additional Options.
3. orapwd file=$ORACLE_HOME/dbs/orapwprod entries=20
4. create pfile
these dirs not needed any more in 11g , they are deprerated . and replaced by para diagnostic_dest .
mkdir -p /u01/app/oracle/diag/rdbms/prod/trace --background_dump_dest && user_dump_dest
mkdir -p /u01/app/oracle/diag/rdbms/prod/cdump --core_dump_dest
mkdir -p /u01/app/oracle/diag/rdbms/prod/adump --audit_file_dest
[oracle@silent1 dbs]$ cd $ORACLE_HOME/dbs
[oracle@silent1 dbs]$ touch initprod.ora
[oracle@silent1 dbs]$ vi initprod.ora
db_name=prod
memory_target=1G
sga_target=471859200
processes = 150
audit_file_dest='/u01/app/oracle/diag/rdbms/prod/adump'
audit_trail ='db'
db_block_size=8192
db_domain='test.com'
diagnostic_dest='/u01/app/oracle/diag/rdbms'
background_dump_dest='/u01/app/oracle/diag/rdbms/prod/trace'
user_dump_dest='/u01/app/oracle/diag/rdbms/prod/trace'
core_dump_dest='/u01/app/oracle/diag/rdbms/prod/cdump'
dispatchers='(PROTOCOL=TCP) (SERVICE=prodXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = ('/u01/app/oracle/oradata/prod/control1.ctl', '/u01/app/oracle/oradata/prod/control2.ctl')
compatible='11.2.0.0.0'
参考以下案例 :
[root@prod ~]# cat /tmp/pfile.ora
prod.__db_cache_size=251658240
prod.__java_pool_size=4194304
prod.__large_pool_size=4194304
prod.__oracle_base='/u01/app'#ORACLE_BASE set from environment
prod.__pga_aggregate_target=159383552
prod.__sga_target=473956352
prod.__shared_io_pool_size=0
prod.__shared_pool_size=201326592
prod.__streams_pool_size=4194304
*.audit_file_dest='/u01/app/admin/prod/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oradata/prod/control01.ctl','/u01/app/oradata/prod/control02.ctl'
*.db_block_size=8192
*.db_domain='ibm.com'
*.db_name='prod'
*.diagnostic_dest='/u01/app'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=prodXDB)'
*.open_cursors=300
*.pga_aggregate_target=157286400
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=471859200
*.undo_tablespace='UNDOTBS1'
[root@prod ~]#
SQL> show parameter dump
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
background_core_dump string partial
background_dump_dest string /u01/app/diag/rdbms/prod/prod/trace
core_dump_dest string /u01/app/diag/rdbms/prod/prod/cdump
max_dump_file_size string unlimited
shadow_core_dump string partial
user_dump_dest string /u01/app/diag/rdbms/prod/prod/trace
5. Create a Server Parameter File -- create spfile
[oracle@silent1 dbs]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sun Apr 5 06:46:52 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> create spfile from pfile='$ORACLE_HOME/dbs/initprod.ora';
File created.
SQL> !ls
init.ora initprod.ora orapwprod spfileprod.ora
SQL>
6. Start the Instance
[oracle@silent1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sun Apr 5 06:51:06 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 796918664 bytes
Database Buffers 264241152 bytes
Redo Buffers 5517312 bytes
SQL>
Deprecated system parameters with specified values:
background_dump_dest
user_dump_dest
7. Issue the CREATE DATABASE Statement.
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 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u01/app/oracle/oradata/prod/system01.dbf' SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
SYSAUX DATAFILE '/u01/app/oracle/oradata/prod/sysaux01.dbf' SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/prod/users01.dbf'
SIZE 10M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/app/oracle/oradata/prod/temp01.dbf'
SIZE 10M REUSE
UNDO TABLESPACE undotbs1
DATAFILE '/u01/app/oracle/oradata/prod/undotbs01.dbf'
SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
CREATE DATABASE prod
*
ERROR at line 1:
ORA-01501: CREATE DATABASE failed
ORA-00200: control file could not be created
ORA-00202: control file: '/u01/app/oracle/oradata/prod/control1.ctl' ### /u01/app/oracle/oradata/prod 因为 prod 子目录还不存在
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 1
9. Run Scripts to Build Data Dictionary Views.
find catalog.sql and catproc.sql in $ORACLE_HOME/rdbms/admin path and pupbld.sql in $ORACLE_HOME/sqlplus/admin path.
conn /as sysdba
SQL> @$ORACLE_HOME/rdbms/admin/catalog.sql
SQL> @$ORACLE_HOME/rdbms/admin/catproc.sql
conn system/manager
SQL>@$ORACLE_HOME/sqlplus/admin/pupbld.sql
configure listener and tnsnames.ora manually ( just edit 2 txt files)
[oracle@prod ~]$ cd /u01/app/product/11.2.0.4/network/admin/
[oracle@prod admin]$ ls
listener.ora samples shrept.lst tnsnames.ora
[oracle@prod admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0.4/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = prod.test.com)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4)
(SID_NAME = prod)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.239.221)(PORT = 1522))
)
ADR_BASE_LISTENER = /u01/app
[oracle@prod admin]$
[oracle@prod admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0.4/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
PROD221 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.239.221)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = prod.test.com)
)
)
[oracle@prod admin]$