oracle单机部署

2019/05/22 18:01
阅读数 19


chown -R oracle:oinstall /opt/database
chmod -R 755 /opt/database

su - oracle <<!
/opt/database/runInstaller -silent -responseFile /home/oracle/enterprise01.rsp \
UNIX_GROUP_NAME="oinstall" ORACLE_NAME="/uyun-app/oracle/product/10.2.0/db_1" \
ORACLE_HOME_NAME="OraDb10g_home1" s_nameForDBAGrp="dba" s_nameForOPERGrp="dba" n_configurationOption=3
expect "The installation of Oracle Database 10g was successful.*"
send "exit"
!
echo 'runInstaller success'

echo $ORACLE_HOME
export ORACLE_HOME=/uyun-app/oracle/product/10.2.0/db_1
echo $ORACLE_SID
export ORACLE_SID=TSH1

su - oracle <<!
/opt/database/runInstaller -silent -ignoreSysPrereqs -force -ignorePrereq -responseFile /home/oracle/enterprise01.rsp \
UNIX_GROUP_NAME="oinstall" ORACLE_NAME="/uyun-app/oracle/product/10.2.0/db_1" \
ORACLE_HOME_NAME="OraDb10g_home1" s_nameForDBAGrp="dba" s_nameForOPERGrp="dba" n_configurationOption=3 -force
echo 'runInstaller success'
!

su - oracle <<!
/opt/database/runInstaller -silent -responseFile /home/oracle/enterprise01.rsp \
UNIX_GROUP_NAME="oinstall" ORACLE_NAME="/uyun-app/oracle/product/10.2.0/db_1" \
ORACLE_HOME_NAME="OraDb10g_home1" s_nameForDBAGrp="dba" s_nameForOPERGrp="dba" n_configurationOption=3
echo 'runInstaller success'
!

su - oracle <<!
pwd
echo -e '\n' > /opt/database/runInstaller -silent -responseFile /home/oracle/enterprise01.rsp
echo 'runInstaller success'
!

 

echo -e '\n' > sh /uyun-app/oracle/oraInventory/orainstRoot.sh 1> file1 2> file2
echo 'orainstRoot.sh success'

rm -rf /usr/local/bin/dbhome
rm -rf /usr/local/bin/oraenv
rm -rf /usr/local/bin/coraenv
echo -e '\n' > sh /uyun-app/oracle/product/10.2.0/db_1/root.sh 1> file1 2> file2
echo 'root.sh success'

ln -s /uyun-app/oracle/product/10.2.0/db_1/bin/sqlplus /usr/bin
echo 'link success'

su - oracle -c "echo $ORACLE_HOME"
su - oracle -c "export ORACLE_HOME=/uyun-app/oracle/product/10.2.0/db_1"
su - oracle -c "echo $ORACLE_SID"
su - oracle -c "export ORACLE_SID=TSH1"

systemctl start firewalld.service

#echo $ORACLE_HOME
#export ORACLE_HOME=/uyun-app/oracle/product/10.2.0/db_1
#echo $ORACLE_SID
#export ORACLE_SID=TSH1

cd /opt/database;echo -e '\r' > ./runInstaller -silent -responseFile /home/oracle/enterprise01.rsp ORACLE_HOME='/uyun-app/oracle/product/10.2.0/db_1'


安装数据库
unzip -o /opt/p13390677_112040_Linux-x86-64_1of7.zip -d /opt unzip -o /opt/p13390677_112040_Linux-x86-64_2of7.zip -d /opt echo 'get cpio file success' chmod 777 /opt/database cd /home/oracle;cat > enterprise01.rsp << EOF oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=node01 UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory SELECTED_LANGUAGES=en ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.EEOptionsSelection=false oracle.install.db.optionalComponents= oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oper oracle.install.db.CLUSTER_NODES=node01,node02 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= oracle.install.db.config.starterdb.memoryOption=false 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= 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= oracle.install.db.config.starterdb.fileSystemStorage.dataLocation= oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation= oracle.install.db.config.asm.diskGroup= oracle.install.db.config.asm.ASMSNMPPassword= MYORACLESUPPORT_USERNAME= MYORACLESUPPORT_PASSWORD= SECURITY_UPDATES_VIA_MYORACLESUPPORT=false DECLINE_SECURITY_UPDATES=true 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= EOF echo 'bash_profile edit success' rm -rf /usr/local/bin/dbhome rm -rf /usr/local/bin/oraenv rm -rf /usr/local/bin/coraenv runStr=" cd /opt/database nohup ./runInstaller -silent -force -ignoreSysPrereqs -responseFile /home/oracle/enterprise01.rsp " su - oracle -c "$runStr" while true do echo -n "." sleep 3s grep "The installation of Oracle Database 11g was successful" /opt/database/nohup.out >> /dev/null if [ $? -eq 0 ]; then sh /uyun-app/oracle/oraInventory/orainstRoot.sh break fi done echo 'runInstaller & orainstRoot.sh success' echo -e '\n' > sh /uyun-app/oracle/product/11.2.0/db_1/root.sh sleep 10s echo "ORACLE_BASE=/uyun-app/oracle; export ORACLE_BASE">>/etc/profile echo "ORACLE_HOME=/uyun-app/oracle/product/11.2.0/db_1; export ORACLE_HOME">>/etc/profile echo "ORACLE_SID=TSH1; export ORACLE_SID">>/etc/profile source /etc/profile echo $ORACLE_BASE echo $ORACLE_HOME echo $ORACLE_SID rm -rf /usr/bin/sqlplus ln -s /uyun-app/oracle/product/11.2.0/db_1/bin/sqlplus /usr/bin echo 'install oracle success!' #start to add ora mkdir -p /uyun-app/oracle/admin/TSH1/{a,b,u}dump mkdir -p /uyun-app/oracle/oradata/TSH1 chown -R oracle.oinstall /uyun-app chmod 775 /uyun-app cp /uyun-app/oracle/product/11.2.0/db_1/assistants/dbca/templates/Seed_Database.ctl /uyun-app/oracle/oradata/TSH1 chmod 777 /uyun-app/oracle/oradata/TSH1 chmod 777 /uyun-app/oracle/oradata/TSH1/Seed_Database.ctl # add pfile cat > /uyun-app/oracle/product/11.2.0.4/db_1/dbs/initTSH1.ora << EOF *.db_name=SEEDDATA control_files='/uyun-app/oracle/oradata/TSH1/Seed_Database.ctl' compatible=11.2.0.4.0 EOF chmod 777 /uyun-app/oracle/product/11.2.0.4/db_1/dbs/initTSH1.ora more /proc/sys/vm/hugetlb_shm_group grpid=`cat /etc/group |grep dba|cut -d : -f 3` echo $grpid > /proc/sys/vm/hugetlb_shm_group sysctl -p
磁盘分区
fdisk /dev/sdb <<EOF
n
p
1


w
EOF

  

检测分区
print user,group
_run_cmd('/usr/sbin/oracleasm configure -g {} -u {} -s y -b'.format(group,user), wait=True)
_run_cmd('/etc/init.d/oracleasm enable', wait=True)
time.sleep(10)
_run_cmd('/etc/init.d/oracleasm enable', wait=True)

path=None
if not disk_name_path:
    for i in ['a','b','c','d']:
        res = _get_output('export LANG=en_US;fdisk -l /dev/sd{}|grep "Disk identifier:"')
        if 'Disk identifier: 0x00000000' in ''.join(res):
            path='/dev/sd{}'.format(i)
            break
    print path
    #/usr/sbin/oracleasm createdisk DATA1 /dev/sda1
    _run_cmd('/usr/sbin/oracleasm createdisk DATA1 {}1'.format(path), wait=True)
    _run_cmd('/usr/sbin/oracleasm createdisk DATA2 {}2'.format(path), wait=True)
    _run_cmd('/usr/sbin/oracleasm createdisk DATA3 {}3'.format(path), wait=True)
else:
    disk_name_path=json.loads(disk_name_path)
    for k,v in disk_name_path.items():
        if not path:
            path=v
        _run_cmd('/usr/sbin/oracleasm createdisk {} {}'.format(k,v), wait=True)
	
print _get_output('/usr/sbin/oracleasm listdisks')

  

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部