【11g 單庫解除安裝、靜默安裝】實驗
11g資料庫安裝我們一般在linux圖形化介面,有時候在現場就沒有這個環境(就是不帶圖形化介面的系統) 怎麼弄,幹唄。到此為止,目前遇到的問題是,沒有圖形化怎麼保證庫裝的沒有問題(以後使用中)那麼下面開始我們怎麼操作吧。
一、安裝資料庫軟體
1、找到對應資料庫版本(作業系統和資料庫版本對應很重要,主要涉及到安裝庫所需要的包及引數設定)
本次測試系統:CentOS Linux release 7.7.1908 (Core)
資料庫版本:Oracle 11.2.0.4 for x64
2、配置系統引數
建立使用者和組 組:oinstall dba 使用者:oracle
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle 並設定密碼
3、建立目錄、賦予許可權
mkdir –p /u01/app/oracle /u01/app/oracle/product/11.2.0/dbhome_1 /oradata /archivelog /flash_recovery
chmod 775 /u01
/oradata /archivelog
/flash_recovery -R
chown oracle:oinstall /u01 /oradata /archivelog /flash_recovery -R
4、安裝依賴包
[root@db1 ~]# yum install binutils compat-libstdc++-33 gcc gcc-c++ glibc glibc.i686 glibc-devel ksh libgcc.i686 libstdc++-devel libaio libaio.i686 libaio-devel libaio-devel.i686 libXext libXext.i686 libXtst libXtst.i686 libX11 libX11.i686 libXau libXau.i686 libxcb libxcb.i686 libXi libXi.i686 make sysstat unixODBC unixODBC-devel zlib-devel zlib-devel.i686 compat-libcap1 ksh -y
5、修改系統配置引數
核心引數
cat >> /etc/sysctl.conf <<EOF
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
EOF
# echo 使上面編輯的引數生效
# /sbin/sysctl –p
# echo編輯系統引數檔案/etc/security/limits.conf,新增下面的內容:(使用者許可權)
cat >> /etc/security/limits.conf <<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
EOF
使用者登入限制:
cat >> /etc/pam.d/login <<EOF
session required pam_limits.so
EOF
6、修改系統環境變數
編輯oracle使用者環境變數:
# vi .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_BASE/bin:$ORACLE_HOME/bin:$PATH:$HOME/bin
# echo 使修改的 .bash_profile 立刻生效
# source .bash_profile
編輯/etc/profile使用者模板最後新增如下
[root@db01 /]# vi /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
[root@db01 /]# source /etc/profile 使生效
7、編輯應答檔案(靜默安裝)安裝包中db_install.rsp檔案
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=db1
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oracle/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.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
DECLINE_SECURITY_UPDATES=true
#The value for this variable should be true if you don't want to configure
# Security Updates, false otherwise.
9、執行軟體安裝
[oracle@db1 database]$ ./runInstaller -force -silent -noconfig -ignorePrereq -ignoreSysPreReqs -responseFile /stage/database/response/db_install.rsp
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 77886 MB Passed
Checking swap space: must be greater than 150 MB. Actual 16383 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2022-01-19_10-45-34AM. Please wait ...[oracle@db1 database]$ [WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
CAUSE: The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
You can find the log of this install session at:
/u01/app/oracle/oraInventory/logs/installActions2022-01-19_10-45-34AM.log
The installation of Oracle Database 11g was successful.
Please check '/u01/app/oracle/oraInventory/logs/silentInstall2022-01-19_10-45-34AM.log' for more details.
As a root user, execute the following script(s):
1. /u01/app/oracle/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Successfully Setup Software.
10、root下執行指令碼(記得具體位置哦)
二、建庫(手工建庫)
1、編輯預設init.ora檔案(啟動例項具體名稱initORACLE_SID.ora)
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation to help you start by providing
# a starting point to customize your RDBMS installation for your site.
#
# NOTE: The values that are used in this file are only intended to be used
# as a starting point. You may want to adjust/tune those values to your
# specific hardware and needs. You may also consider using Database
# Configuration Assistant tool (DBCA) to create INIT file and to size your
# initial set of tablespaces based on the user input.
###############################################################################
# Change '/u01/app/oracle' to point to the oracle base (the one you specify at
# install time)
db_name='orcl'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/flash_recovery_area'
db_recovery_file_dest_size=10G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (/oradata/orcl/control01.ctl,/oradata/orcl/control02.ctl)
compatible ='11.2.0'
建立目錄:
[oracle@db1 dbs]$ mkdir -p /u01/app/oracle/admin/orcl/adump /oradata/orcl
[oracle@db1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 19 11:38:01 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 671089544 bytes
Database Buffers 390070272 bytes
Redo Buffers 5517312 bytes
2、編輯建庫指令碼、建立庫
[oracle@db1 ~]$ cat 1.sql
CREATE DATABASE orcl
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/oradata/orcl/redo01a.log','/oradata/orcl/redo01b.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/oradata/orcl/redo02a.log','/oradata/orcl/redo02b.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/oradata/orcl/redo03a.log','/oradata/orcl/redo03b.log') SIZE 100M BLOCKSIZE 512
MAXLOGFILES 32
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/oradata/orcl/system01.dbf' SIZE 325M REUSE
SYSAUX DATAFILE '/oradata/orcl/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE '/oradata/orcl/users01.dbf'
SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/oradata/orcl/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs1
DATAFILE '/oradata/orcl/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
[oracle@db1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 19 13:30:48 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @1.sql
執行指令碼: @?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql @?/rdbms/admin/utlrp.sql
In SQL*Plus, connect to your Oracle Database instance as
SYSTEM
user:
@?/sqlplus/admin/pupbld.sql
三、配置listener.ora tnsnames.ora sqlnet.ora
[oracle@db1 admin]$ cat listener.ora
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.0.2.100)(PORT = 1521))
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(ORACLE_DBNAME = orcl)
(SID_NAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
)
)
[oracle@db1 admin]$ cat tnsnames.ora
orcl =
(description =
(ADDRESS = (PROTOCOL = TCP)(HOST =192.0.2.100)(PORT = 1521))
(CONNECT_DATA =
(SERVER=DEDICATED)
(SERVICE_NAME=orcl)
)
)
[oracle@db1 admin]$ cat sqlnet.ora
NAMES.DIRECTORY_PATH=(TNSNAMES,EZCONNECT)
建立密碼檔案:[oracle@db1 dbs]$ orapwd file=orapworcl password=oracle entries=10
(備註:密碼檔名稱 orapwORACLE_SID,注意不要寫錯了)
測試連線:
[oracle@db1 dbs]$ sqlplus sys/oracle@orcl as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 19 13:35:35 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select name,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
ORCL READ WRITE
四、刪庫
[oracle@db1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 19 13:38:43 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount exclusive;
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 671089544 bytes
Database Buffers 390070272 bytes
Redo Buffers 5517312 bytes
Database mounted.
SQL> alter system enable restricted session;
System altered.
SQL> drop database ;
Database dropped.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
檢查:進入資料庫資料檔案儲存位置/oradata/orcl發現下面檔案全部刪除
五、解除安裝軟體
listener監聽關閉 [oracle@db1 orcl]$ lsnrctl stop
執行解除安裝軟體指令碼:
[oracle@db1 ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/deinstall/
[oracle@db1 deinstall]$ ./deinstall
Checking for required files and bootstrapping ...
Please wait ...
####################### CLEAN OPERATION SUMMARY #######################
Successfully de-configured the following database instances : /u01/app/oracle/product/11.2.0/dbhome_1
Following Single Instance listener(s) were de-configured successfully: LISTENER
Cleaning the config for CCR
As CCR is not configured, so skipping the cleaning of CCR configuration
CCR clean is finished
Successfully detached Oracle home '/u01/app/oracle/product/11.2.0/dbhome_1' from the central inventory on the local node.
Successfully deleted directory '/u01/app/oracle/product/11.2.0/dbhome_1' on the local node.
Successfully deleted directory '/u01/app/oracle/oraInventory' on the local node.
Oracle Universal Installer cleanup was successful.
Run 'rm -rf /etc/oraInst.loc' as root on node(s) 'db1' at the end of the session.
Run 'rm -rf /opt/ORCLfmap' as root on node(s) 'db1' at the end of the session.
Run 'rm -rf /etc/oratab' as root on node(s) 'db1' at the end of the session.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################
############# ORACLE DEINSTALL & DECONFIG TOOL END #############
(刪除上面提到的檔案 /etc/oraInst.loc /opt/ORCLfmap rm -rf /etc/oratab)
小結:透過資料庫的靜默安裝,解除安裝過程,可以看出建庫過程不難,難就難在這個庫是否符合業務應用的需要,如字符集、
庫記憶體大小(memory_target sga_target pga等),同時安裝庫前系統缺少的包也需要裝上哦,防止異常報錯,否則前面
的工作白做了。
Yicheng16
22.01.19
-- The End --
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69963467/viewspace-2853004/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 靜默安裝Oracle資料庫11gOracle資料庫
- CentOS 7.5靜默安裝Oracle 11gCentOSOracle
- 靜默方式安裝oracle 11g 完整攻略Oracle
- 靜默安裝and手動建庫
- rac靜默安裝
- Oracle靜默安裝Oracle
- 應用黑名單以及靜默安裝的實現
- 19c(19.3) 單機資料庫靜默安裝資料庫
- Linux下靜默安裝OraceLinux
- Windows 7平臺靜默安裝11.2.0.4軟體及靜默建庫Windows
- 靜默安裝Oracle11g資料庫Oracle資料庫
- oracle 19C 靜默安裝Oracle
- 靜默安裝oracle時報錯Oracle
- AnolisOS 7.9 靜默安裝Oacle 11.2.0.4
- centos 7.4靜默安裝oracle 19.3CentOSOracle
- 【配置安裝】靜默安裝Oracle資料庫軟體12c&19cOracle資料庫
- 靜默方式安裝、升級oracle(一): 安裝oracle軟體Oracle
- 【靜默】在RHEL 6.5上靜默安裝Oracle 18cOracle
- 靜默方式安裝11gR2
- Oracle Linux 7.1 靜默安裝Weblogic 12.2.1.3OracleLinuxWeb
- 靜默方式安裝、升級oracle(二): 建立資料庫Oracle資料庫
- Oracle 19C的下載和安裝部署(圖形安裝和靜默安裝)Oracle
- RedHat上靜默安裝Oracle11gRedhatOracle
- CentOS 7.2靜默安裝Oracle11gCentOSOracle
- redhat7.2靜默安裝Oracle11.2.0.4RedhatOracle
- 靜默安裝Oracle建庫時報Template General Purpose does not existOracle
- 【配置安裝】Oracle靜默建庫for 12c&19c CDBOracle
- 安裝npm 解除安裝npm 安裝apidocNPMAPI
- 達夢8資料庫安裝和解除安裝資料庫
- Linux安裝解除安裝MySQLLinuxMySql
- Ubuntu解除安裝和安裝Ubuntu
- cocoapods安裝/解除安裝/使用
- JDK安裝和解除安裝JDK
- docker安裝及解除安裝Docker
- Oracle 11G資料庫單例項安裝Oracle資料庫單例
- oracle11g客戶端靜默安裝Oracle客戶端
- 靜默安裝19C RAC的指令碼指令碼
- 【配置上線】靜默安裝資料庫Oracle 11gR2資料庫Oracle