oracle亲手安装过程
修改tmpfs大小:
vim /etc/fstab
在default后加size=10G
重新挂载
mount -o remount /dev/shm
(2)swap空间
dd if=/dev/zero of=/home/swapfile bs=1024 count=1G
mkdir -p /home/swapfile
mkswap /home/swapfile
swapon /home/swapfile
free -m 查看
oracle.install.option=INSTALL_DB_SWONLY // 安装类型 ORACLE_HOSTNAME=db // 主机名称(hostname查询) UNIX_GROUP_NAME=oinstall // 安装组 INVENTORY_LOCATION=/usr/oracle/oraInventory //INVENTORY目录(不填就是默认值) SELECTED_LANGUAGES=en,zh_CN,zh_TW // 选择语言 ORACLE_HOME=/usr/oracle/product/11.2.0/db_1 // oracle_home ORACLE_BASE=/usr/oracle // oracle_base oracle.install.db.InstallEdition=EE // oracle版本 oracle.install.db.isCustomInstall=false //自定义安装,否,使用默认组件 oracle.install.db.DBA_GROUP=dba // dba用户组 oracle.install.db.OPER_GROUP=oinstall // oper用户组 oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //数据库类型 oracle.install.db.config.starterdb.globalDBName=orcl //globalDBName oracle.install.db.config.starterdb.SID=orcl //SID oracle.install.db.config.starterdb.memoryLimit=81920 //自动管理内存的内存(M) oracle.install.db.config.starterdb.password.ALL=oracle //设定所有数据库用户使用同一个密码 SECURITY_UPDATES_VIA_MYORACLESUPPORT=false(手动写了false) DECLINE_SECURITY_UPDATES=true //设置安全更新
或用以下脚本:
file="db_install.rsp"
for i in file
do
cd /usr/local/database/response/
sed -i 's#oracle.install.option=#oracle.install.option=INSTALL_DB_SWONLY#g' ${file}
sed -i 's#ORACLE_HOSTNAME=#ORACLE_HOSTNAME=db#g' ${file}
sed -i 's#UNIX_GROUP_NAME=#UNIX_GROUP_NAME=oinstall#g' ${file}
sed -i 's#INVENTORY_LOCATION=##g' ${file}
sed -i 's#INVENTORY_LOCATION=#INVENTORY_LOCATION=/usr/local/oracle/oraInventory#g' ${file}
sed -i 's#SELECTED_LANGUAGES=#SELECTED_LANGUAGES=en,zh_CN,zh_TW#g' ${file}
sed -i 's#ORACLE_HOME=#ORACLE_HOME=/usr/local/oracle/product/11.2.0/db_1#g' ${file}
sed -i 's#ORACLE_BASE=#ORACLE_BASE=/usr/local/oracle#g' ${file}
sed -i 's#oracle.install.db.InstallEdition=#oracle.install.db.InstallEdition=EE#g' ${file}
#sed -i 's#oracle.install.db.isCustomInstall=#oracle.install.db.isCustomInstall=false#g' ${file}
sed -i 's#oracle.install.db.DBA_GROUP=#oracle.install.db.DBA_GROUP=dba#g' ${file}
sed -i 's#oracle.install.db.OPER_GROUP=#oracle.install.db.OPER_GROUP=oinstall#g' ${file}
sed -i 's#oracle.install.db.config.starterdb.type=#oracle.install.db.config.starterdb.type=GENERAL_PURPOSE#g' ${file}
sed -i 's#oracle.install.db.config.starterdb.globalDBName=#oracle.install.db.config.starterdb.globalDBName=orcl#g' ${file}
sed -i 's#oracle.install.db.config.starterdb.SID=#oracle.install.db.config.starterdb.SID=orcl#g' ${file}
sed -i 's#oracle.install.db.config.starterdb.memoryLimit#oracle.install.db.config.starterdb.memoryLimit=600#g' ${file}
sed -i 's#oracle.install.db.config.starterdb.password.ALL=#oracle.install.db.config.starterdb.password.ALL=oracle#g' ${file}
sed -i 's#SECURITY_UPDATES_VIA_MYORACLESUPPORT=#SECURITY_UPDATES_VIA_MYORACLESUPPORT=false#g' ${file}
sed -i 's#DECLINE_SECURITY_UPDATES=#DECLINE_SECURITY_UPDATES=true#g' ${file}
done
10、设置oracle环境变量:
su oracle
vim ~/.bash_profile
添加:
11、运行安装脚本:
首先要切换oracle用户才能执行:
./runInstaller -silent -responseFile /home/oracle/db_install.rsp 指定db_install.rsp文件位置
通过/usr/local/oracle/oraInventory/logs/ 查看安装进度
12、安装完毕后,oracle会让你执行命令:
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export LIBPATH=${CLASSPATH}:$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib
export ORACLE_OWNER=oracle
export SPFILE_PATH=$ORACLE_HOME/dbs
export ORA_NLS10=$ORACLE_HOME/nls/data
/usr/local/oracle/admin/orcl/adump
/usr/local/oracle/flash_recovery_area
/usr/local/oracle
sed -i 's#GDBNAME = "orcl11g.us.oracle.com"#GDBNAME = "orcl"#g' /home/oracle/dbca.rsp
sed -i 's#SID = "orcl11g"#SID = "orcl"#g' /home/oracle/dbca.rsp
sed -i 's$#CHARACTERSET = "US7ASCII"$CHARACTERSET = "AL32UTF8"$g' /home/oracle/dbca.rsp
sed -i 's$#NATIONALCHARACTERSET= "UTF8"$NATIONALCHARACTERSET= "UTF8"$g' /home/oracle/dbca.rsp
sed -i 's$##SYSPASSWORD = "password"$SYSPASSWORD = "oracle"$g' /home/oracle/dbca.rsp
sed -i 's$##SYSTEMPASSWORD = "password"$SYSTEMPASSWORD = "oracle"$g' /home/oracle/dbca.rsp
password设置
后执行:
./dbca -silent -responseFile /home/oracle/dbca.rsp 开始静默建库
SQL> shutdown immediate; #正常关闭数据库
SQL> startup mount; #开启实例并挂载数据库(如果提示控制文件未找到,那么可能是静默建库没有成功,重新建库。将/etc下oratab删除)
SQL> alter database archivelog; #进入归档模式
SQL> alter database open; #启动数据库