1、系统配置
1.1、系统版本
[root@dbserver~]# cat /etc/redhat-release
Red HatEnterprise Linux Server release 7.6 (Maipo)
1.2、禁用SELinux
[root@dbserver~]# sed -i “s/SELINUX=enforcing/SELINUX=disabled/”/etc/selinux/config
1.3、创建用户与组
groupaddoinstall
groupadd dba
groupadd oper
useradd -goinstall -G dba,oper oracle
echo oracle_4U|passwd --stdin oracle
1.4、创建安装目录
[root@dbserver~]# mkdir -p /u01/app/oracle
[root@dbserver~]# mkdir -p /u01/app/oraInventory
[root@dbserver~]# mkdir -p /u01/app/oracle/oradata
[root@dbserver~]# mkdir -p /u01/app/oracle/fast_recovery_area
[root@dbserver~]# chown -R oracle:oinstall /u01/app/
[root@dbserver~]# chmod -R 755 /u01/app/
1.5、修改内核参数
cat <>/etc/sysctl.conf
kernel.shmmax =277495689510912
kernel.shmmni = 4096
kernel.sem = 250 32000100 128
net.core.rmem_default =262144
net.core.rmem_max =4194304
net.core.wmem_default =262144
net.core.wmem_max = 1048586
fs.file-max = 6815744
kernel.shmall =4294967296
net.ipv4.ip_local_port_range= 9000 65500
net.ipv4.tcp_tw_reuse =1
net.core.somaxconn =262144
net.ipv4.tcp_max_orphans= 262144
net.ipv4.tcp_max_syn_backlog= 262144
net.ipv4.tcp_synack_retries= 2
net.ipv4.tcp_syn_retries= 1
net.ipv4.tcp_fin_timeout= 1
net.ipv4.tcp_keepalive_time= 30
net.ipv4.tcp_keepalive_probes= 6
net.ipv4.tcp_keepalive_intvl= 5
net.ipv4.tcp_timestamps= 0
fs.aio-max-nr= 1048576
EOF
/sbin/sysctl -p
1.6、修改系统限制
cat <>/etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
修改会话限制
cat<>/etc/pam.d/login
session required/lib64/security/pam_limits.so
EOF
1.7、修改环境变量
su - oracle
$ cat <>.bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
EOF
$ source.bash_profile
1.8、添加全局变量
[root@dbserver ~]# cat <>/etc/profile
exportPATH=$PATH:/u01/app/oracle/product/11.2.0/db_1/bin
EOF
[root@dbserver ~]# source /etc/profile
1.9、配置yum源
mount /dev/sr0 /mnt
cat<>/etc/yum.repos.d/oel7.repo
[oel7]
name=oel7
baseurl=file:///mnt
enable=1
gpgcheck=0
EOF
yum makecache
1.10、安装包
yum install -y bc binutilselfutils-libelf glibc glibc-devel ksh libaio libXrender libX11 libXau libXilibXtst libgcc libstdc++ libxcb make policycoreutils policycoreutils-pythonsmartmontools sysstat gcc libaio-devel elfutils-libelf-devel gcc-c++libstdc+±devel unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
rpm -q bc binutils elfutils-libelf glibc glibc-devel kshlibaio libXrender libX11 libXau libXi libXtst libgcc libstdc++ libxcb makepolicycoreutils policycoreutils-python smartmontools sysstat gcc libaio-develelfutils-libelf-devel gcc-c++ libstdc+±devel unixODBC unixODBC*.i686unixODBC-devel unixODBC-devel*.i686
1.11、安装包
上传安装包
[root@dbserver ~]# mkdir /soft
sftp>cd /soft
sftp>lcd F:\installmedium\11g
sftp>put p13390677_112040_Linux-x86-64_1of7.zip
sftp>put p13390677_112040_Linux-x86-64_2of7.zip
[oracle@dbserver soft]$ cd/soft
解压安装包
[oracle@dbserver soft]$ ls *.zip | xargs -n1unzip -o –q
解压后在/soft/database/response目录下有三个.rsp文件
文件作用分别是:
db_install.rsp:安装应答
dbca.rsp:创建数据库应答
netca.rsp:建立监听、本地服务名等网络设置的应答
[oracle@dbserver database]$ cd response/
[oracle@dbserver response]$ ll
total 80
-rwxr-xr-x 1 oracle oinstall 44533 Aug27 2013 dbca.rsp
-rw-r–r-- 1 oracle oinstall 25116 Aug 27 2013 db_install.rsp
-rwxr-xr-x 1 oracle oinstall 5871 Aug 27 2013 netca.rsp
1.12、修改应答文件
[oracle@dbserver response]
c
p
d
b
i
n
s
t
a
l
l
.
r
s
p
d
b
i
n
s
t
a
l
l
b
a
k
.
r
s
p
[
o
r
a
c
l
e
@
d
b
s
e
r
v
e
r
r
e
s
p
o
n
s
e
]
cp db_install.rsp db_install_bak.rsp [oracle@dbserver response]
cpdbinstall.rspdbinstallbak.rsp[oracle@dbserverresponse] vi db_install.rsp
说明:按照如下参数修改
[oracle@dbserver response]$ less/soft/database/response/db_install.rsp |grep -v “#”|grep -v"^KaTeX parse error: Double subscript at position 92: …se_schema_v11_2_̲0 oracle.instal… cd /soft/database
[oracle@dbserverdatabase]$ ./runInstaller -silent -force -responseFile/soft/database/response/db_install.rsp 说明:此处也可用 ./runInstaller-silent -ignoreSysPrereqs -showProgress -responseFile/opt/database/response/db_install.rsp
StartingOracle Universal Installer…
Checking Temp space: must be greater than 120MB. Actual 43197 MB Passed
Checking swap space: must be greater than 150MB. Actual 10238 MB Passed
Preparing to launch Oracle UniversalInstaller from /tmp/OraInstall2022-04-01_07-05-05PM. Please wait…[oracle@dbserver database]$
[oracle@dbserver database]$ [WARNING][INS-13014] Target environment do not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs fordetails./tmp/OraInstall2022-04-01_08-28-07PM/installActions2022-04-01_08-28-07PM.log
ACTION: Identify the list of failed prerequisite checks from the log:/tmp/OraInstall2022-04-01_08-28-07PM/installActions2022-04-01_08-28-07PM.log.Then either from the log file or from installation manual find the appropriateconfiguration to meet the prerequisites and fix it manually.
You can find the log of this install sessionat:
/u01/app/oralnventory/logs/installActions2022-04-01_08-28-07PM.log
The installation of Oracle Database 11g wassuccessful.
Please check’/u01/app/oralnventory/logs/silentInstall2022-04-01_08-28-07PM.log’ for moredetails.
As a root user, execute the followingscript(s):
1. /u01/app/oralnventory/orainstRoot.sh
2. /u01/app/oracle/product/11.2.0/db_1/root.sh
Successfully Setup Software.
执行脚本
[root@dbserver ~]#/u01/app/oralnventory/orainstRoot.sh
Changing permissions of/u01/app/oralnventory.
Adding read,write permissions for group.
Removing read,write,execute permissions forworld.
Changing groupname of /u01/app/oralnventoryto oinstall.
The execution of the script is complete.
[root@dbserver ~]#/u01/app/oracle/product/11.2.0/db_1/root.sh
Check /u01/app/oracle/product/11.2.0/db_1/install/root_dbserver_2022-04-01_20-34-46.logfor the output of root script
说明:安装过程可查看安装进度
[oracle@dbserver ~]$ tail -f/u01/app/oralnventory/logs/installActions2022-04-01_08-28-07PM.log
3、配置监听
[oracle@dbserverdatabase]$ KaTeX parse error: Expected 'EOF', got '#' at position 624: …root@dbserver~]#̲ vi /soft/datab… $ORACLE_HOME/bin/dbca -silent -responseFile/soft/database/response/dbca.rsp
Enter SYS user password:
Enter SYSTEM user password:
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file"/u01/app/cfgtoollogs/dbca/orcl/orcl.log" for further details.
5、数据库信息
SQL> r
1* selecttablespace_name,file_id,file_name from dba_data_files order by tablespace_name
TABLESPACE_NAME FILE_ID FILE_NAME
SYSAUX 2/u01/app/oradata/orcl/sysaux01.dbf
SYSTEM 1/u01/app/oradata/orcl/system01.dbf
UNDOTBS1 3/u01/app/oradata/orcl/undotbs01.dbf
USERS 4/u01/app/oradata/orcl/users01.dbf
SQL> r
1* select namefrom v$controlfile
NAME
/u01/app/oradata/orcl/control01.ctl
/u01/app/fast_recovery_area/orcl/control02.ctl
SQL> r
1* select * fromv$logfile
GROUP#STATUS TYPE MEMBER IS_
3 ONLINE /u01/app/oradata/orcl/redo03.log NO
2 ONLINE /u01/app/oradata/orcl/redo02.log NO
1 ONLINE /u01/app/oradata/orcl/redo01.log NO
SQL> select username,user_id,default_tablespace,account_statusfrom dba_users;
USERNAME USER_IDDEFAULT_TABLESPACE ACCOUNT_STATUS
SYS 0SYSTEM OPEN
SYSTEM 5 SYSTEM OPEN
OUTLN 9SYSTEM EXPIRED& LOCKED
MGMT_VIEW 73 SYSTEM EXPIRED & LOCKED
FLOWS_FILES 74 SYSAUX EXPIRED & LOCKED
MDSYS 57SYSAUX EXPIRED &LOCKED
ORDSYS 53 SYSAUX EXPIRED & LOCKED
EXFSYS 42 SYSAUX EXPIRED & LOCKED
DBSNMP 30 SYSAUX EXPIRED & LOCKED
WMSYS 32SYSAUX EXPIRED& LOCKED
APPQOSSYS 31 SYSAUX EXPIRED & LOCKED
USERNAME USER_ID DEFAULT_TABLESPACE ACCOUNT_STATUS
APEX_030200 77 SYSAUX EXPIRED & LOCKED
OWBSYS_AUDIT 79 SYSAUX EXPIRED & LOCKED
ORDDATA 54 SYSAUX EXPIRED & LOCKED
CTXSYS 43 SYSAUX EXPIRED & LOCKED
ANONYMOUS 46 SYSAUX EXPIRED & LOCKED
SYSMAN 71 SYSAUX EXPIRED & LOCKED
XDB 45SYSAUX EXPIRED& LOCKED
ORDPLUGINS 55 SYSAUX EXPIRED & LOCKED
OWBSYS 78 SYSAUX EXPIRED & LOCKED
SI_INFORMTN_SCHEMA 56 SYSAUX EXPIRED & LOCKED
OLAPSYS 60 SYSAUX EXPIRED & LOCKED
USERNAME USER_IDDEFAULT_TABLESPACE ACCOUNT_STATUS
SCOTT 83 USERS EXPIRED & LOCKED
ORACLE_OCM 21 USERS EXPIRED & LOCKED
XS$NULL 2147483638 USERS EXPIRED & LOCKED
MDDATA 64 USERS EXPIRED & LOCKED
DIP 14USERS EXPIRED& LOCKED
APEX_PUBLIC_USER 75 USERS EXPIRED & LOCKED
SPATIAL_CSW_ADMIN_USR 69 USERS EXPIRED & LOCKED
SPATIAL_WFS_ADMIN_USR 66 USERS EXPIRED & LOCKED
30 rows selected.