服务器运维LinuxOracle
2025-04-03 15:04阅读:102评论:0
CentOS 7 安装oracle19
vmw虚拟机 CentOS 7 安装oracle 参考:<http://blog.itpub.net/69975956/viewspace-2706044/> wget <https://yum.oracle.com/repo/OracleLinux/OL7/latest/x8664/getPack
_PROTECTED0_
> 参考:
- wget 64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x8664.rpm>
- wget 64.rpm?AuthParam=1618661520b733840488b27a21d9d23454d0c20a20>
PROTECTED1__
- 编辑/etc/selinux/config 文件
SELINUX=disabled
#### 配置系统参数
shell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 编辑/etc/pam.d/login 添加如下内容: vi /etc/pam.d/login session required pam_limits.so # 编辑vi /etc/profile添加如下内容: #系统环境变量if [ /$USER = "oracle" ] ; then if [ /$SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536else ulimit -u 16384 -n 65536fi umask 022fi # 编辑/etc/security/limits.conf 添加如下内容:vi /etc/security/limits.conf oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536 - yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86\__PROTECTED_1__64.rpm
#### 配置oracle环境
- 配置文件___PROTECTED_2__0__
1
2
3
4
5
6
7
8
9
10
11
12
export ORACLE\_VERSION=19c export ORACLE\_SID=ORCLCDB export TEMPLATE\_NAME=General\_Purpose.dbc export CHARSET=AL32UTF8 export PDB\_NAME=ORCLPDB1 export LISTENER\_NAME=LISTENER export NUMBER\_OF\_PDBS=1 # true 表示创建容器数据库,若果是容器数据库,创建用户的时候普通用户要使用 c## 作为前缀 export CREATE\_AS\_CDB=true # 改为 export CREATE\_AS\_CDB=false - root 用户执行命令:
- /etc/init.d/oracledb\_ORCLCDB-19c configure # 执行后先玩一盘王者等待
1
2
3
4
# 执行完显示如下Database configuration completed successfully. The passwords were auto generated, you must change them by connecting to the database using 'sqlplus / as sysdba' as the oracle user. - 配置oracle 环境
1
2
3
4
5
export ORACLE\_BASE=/opt/oracle export ORACLE\_HOME=/opt/oracle/product/19c/dbhome\_1 export PATH=`$ORACLE_HOME/bin:$`PATH export ORACLE\_SID=ORCLCDB - vim \~/.bash\__PROTECTED_1__profile
1
2
3
4
5
6
7
8
9
The install cannot proceed because ORACLE_BASE directory (/opt/oracle) is not owned by "oracle" user. You must change the ownership of ORACLE_BASE directory to "oracle" user and retry the installation. The install cannot proceed because ORACLE_BASE directory (/opt/oracle) is not owned by "oinstall" group. You must change the ownership of ORACLE_BASE directory to "oinstall" group and retry the installation. - 这两个错误意思是oracle用户没有操作___PROTECTED_7__0___PROTECTED_8__4___PROTECTED_9__1___PROTECTED_10__5___PROTECTED_11__2___PROTECTED_12__6___PROTECTED_13__3__启动oracle
#### 启动oracle 报错
1
2
could not open parameter file '/opt/oracle/product/10.2/db_1/dbs/initorcl.ora - 将 /opt/oracle/product/10.2/db\__PROTECTED_3____PROTECTED_4__0___PROTECTED_5__2___PROTECTED_6__1__
#### 链接错误
1
2
状态: 失败 -测试失败: IO 错误: The Network Adapter could not establish the connection (CONNECTION_ID=4sqFYx9UTb6zL1+u056jGg==) - 可能是防火墙拦截端口导致无法链接
- 尝试关闭防火墙
1
2
3
4
5
6
7
# 临时关闭防火墙systemctl stop firewalld# 查看防火墙状态systemctl status firewalld# 永久关闭防火墙(先关闭防火墙在执行命令禁用防火墙)systemctl disable firewalld - 如果还是这个错误,oracle用户下查看监听器是否启动
#### 重置system密码
- 执行 ___PROTECTED_5__0___PROTECTED_6__3___PROTECTED_7__1___PROTECTED_8__4___PROTECTED_9__2__
1
2
passwd oracle _PROTECTED0__
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 创建表空间CREATE TABLESPACE bdc_yc datafile '/u01/app/oracle/my_db/DDATA.dbf' size 500M autoextend on next 5M maxsize unlimited; # 创建临时表空间CREATE temporary TABLESPACE bdc_yc_tmp tempfile '/opt/oracle/my_db/DDATA_TMP.dbf' size 300M autoextend on next 5M maxsize unlimited; # 创建用户并指定表空间以及临时表空间create user bdc_yc identified by "123456" default tablespace bdc_yc temporary tablespace bdc_yc_tmp; # 授予用户使用表空间的权限alter user bdc_yc quota unlimited on bdc_yc; # 授权(如果不是授权,则账号无法链接数据库)grant create session to bdc_yc;grant create table to bdc_yc;grant create tablespace to bdc_yc;grant create view to bdc_yc;