OS | DB | HostName | DB Name | IP |
---|---|---|---|---|
oracle linux 7.7 | Oracle 19C | STUDY | win | 192.168.2.98 |
[root@STUDY /]# echo '192.168.2.98 STUDY' >> /etc/hosts
[root@STUDY etc]# systemctl stop firewalld.service
[root@STUDY etc]# systemctl disable firewalld.service
[root@STUDY etc]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
[root@STUDY etc]# vi /etc/sysctl.conf
添加如下内容:
kernel.shmmni=4096
kernel.sem=250 32000 100 128
fs.file-max=6815744
fs.aio-max-nr=1048576
net.ipv4.ip_local_port_range=9000 65500
net.core.rmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048576
kernel.shmmax=53687091200
kernel.shmall=52780232
[root@STUDY etc]# vi /etc/pam.d/login
添加如下内容:
session required /lib64/security/pam_limits.so
session required pam_limits.so
[root@STUDY etc]# vi /etc/security/limits.conf
添加如下内容:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
说明:
生产环境注意这两个参数,需要根据服务器的内存大小调整
kernel.shmmax:内核共享内存段最大值
kernel.shmall:所有内存(单位是页 4096)
[root@STUDY etc]#sysctl -p --使上面参数生效
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
kernel.shmmax = 53687091200
kernel.shmall = 52780232
[root@STUDY etc]# groupadd oinstall
[root@STUDY etc]# groupadd dba
[root@STUDY etc]# groupadd oper
[root@STUDY etc]# useradd -g oinstall -G dba,oper oracle
[root@STUDY etc]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: The password fails the dictionary check - it is too simplistic/systematic
Retype new password:
passwd: all authentication tokens updated successfully.
[root@STUDY etc]# id oracle
uid=1000(oracle) gid=1000(oinstall) groups=1000(oinstall),1001(dba),1002(oper)
[root@STUDY etc]# mkdir -p /u01/app/oracle/product/19.3/dbhome_1
[root@STUDY etc]# chown -R oracle:oinstall /u01/app
[root@STUDY etc]# chmod -R 775 /u01/app
[root@STUDY etc]# cd /etc/yum.repos.d
[root@STUDY etc]# vi local-oraclelinux.repo
[root@STUDY etc]# su – oracle
[oraclet@STUDY ~]$ vi /home/oracle/.bash_profile
添加如下内容:
umask 022
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19.3/dbhome_1
ORACLE_SID=win
PATH= P A T H : PATH: PATH:HOME/.local/bin: H O M E / b i n : HOME/bin: HOME/bin:ORACLE_HOME/bin
export PATH ORACLE_BASE ORACLE_HOME ORACLE_SID
[oracle@STUDY ~]$ source /home/oracle/.bash_profile
#yum -y install tigervnc-server-1.8.0-17.el7.x86_64.rpm
# vi /etc/sysconfig/vncservers
添加:
VNCSERVERS=“1:root”
VNCSERVERARGS[2]=“-geometry 800x600 -nolisten tcp -localhost”
[root@STUDY sysconfig]# vncserver --启动vnc服务
You will require a password to access your desktops.
Password:
Verify:
Would you like to enter a view-only password (y/n)? y
Password:
Verify:
xauth: file /root/.Xauthority does not exist
New 'STUDY:1 (root)' desktop is STUDY:1
Creating default startup script /root/.vnc/xstartup
Creating default config /root/.vnc/config
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/STUDY:1.log
[root@STUDY sysconfig]# service vncserver status --查看服务开启状态
Redirecting to /bin/systemctl status vncserver.service
Unit vncserver.service could not be found.
# vi /root/.vnc/xstartup --修改配置文件,激活图形界面
注释掉倒数三行,并在末尾 增加:
gnome-session &
[root@STUDY sysconfig]# xhost +
xhost: unable to open display ""
[root@STUDY sysconfig]# export DISPLAY=192.168.2.98:1.0
[root@STUDY sysconfig]# xhost +
access control disabled, clients can connect from any host
[root@STUDY dbhome_1]# su - oracle
[oracle@STUDY dbhome_1]$ export LANG=en_US --避免安装界面是中文时出现乱码
[root@STUDY etc]# mkdir /u01/app/soft
--已将数据库软件上传到/u01/app/soft
[root@STUDY etc]# chown oracle:oinstall /u01/app/soft/LINUX.X64_193000_db_home.zip
[root@STUDY etc]$ su - oracle
[oracle@STUDY ~]$ cd /u01/app/soft
[oracle@STUDY soft]$ unzip LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3/dbhome_1 --解压到$ORACLE_HOME目录
[oracle@STUDY dbhome_1]$ ./runInstaller
安装过程记录如下:
[root@STUDY soft]# yum -y install libaio-devel-0.3.109-13.el7.x86_64.rpm
[root@STUDY soft]# yum -y install smartmontools-7.0-1.el7.x86_64.rpm
[root@STUDY soft]# yum -y install ksh-20120801-139.0.1.el7.x86_64.rpm
ksh包可以忽略
[oracle@STUDY dbhome_1]$ ps -ef|grep smon
oracle 109287 1 0 18:18 ? 00:00:00 ora_smon_win
oracle 110364 105048 0 18:29 pts/0 00:00:00 grep --color=auto smon
[oracle@STUDY dbhome_1]$ ps -ef|grep ora
root 105047 104986 0 17:51 pts/0 00:00:00 su - oracle
oracle 105048 105047 0 17:51 pts/0 00:00:00 -bash
root 105804 105786 0 18:00 pts/1 00:00:00 su - oracle
oracle 105805 105804 0 18:00 pts/1 00:00:00 -bash
oracle 105826 105805 0 18:00 pts/1 00:00:00 sqlplus as sysdba
oracle 105827 105826 0 18:00 ? 00:00:00 oraclewin (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 109242 1 0 18:18 ? 00:00:00 ora_pmon_win
oracle 109244 1 0 18:18 ? 00:00:00 ora_clmn_win
oracle 109246 1 0 18:18 ? 00:00:00 ora_psp0_win
oracle 109249 1 1 18:18 ? 00:00:07 ora_vktm_win
oracle 109253 1 0 18:18 ? 00:00:00 ora_gen0_win
oracle 109255 1 0 18:18 ? 00:00:03 ora_mman_win
oracle 109259 1 0 18:18 ? 00:00:00 ora_gen1_win
oracle 109262 1 0 18:18 ? 00:00:00 ora_diag_win
oracle 109264 1 0 18:18 ? 00:00:00 ora_ofsd_win
oracle 109267 1 0 18:18 ? 00:00:01 ora_dbrm_win
oracle 109269 1 0 18:18 ? 00:00:00 ora_vkrm_win
oracle 109271 1 0 18:18 ? 00:00:00 ora_svcb_win
oracle 109273 1 0 18:18 ? 00:00:00 ora_pman_win
oracle 109275 1 0 18:18 ? 00:00:01 ora_dia0_win
oracle 109277 1 0 18:18 ? 00:00:00 ora_dbw0_win
oracle 109279 1 0 18:18 ? 00:00:00 ora_dbw1_win
oracle 109281 1 0 18:18 ? 00:00:00 ora_lgwr_win
oracle 109283 1 0 18:18 ? 00:00:00 ora_ckpt_win
oracle 109285 1 0 18:18 ? 00:00:00 ora_lg00_win
oracle 109287 1 0 18:18 ? 00:00:00 ora_smon_win
oracle 109289 1 0 18:18 ? 00:00:00 ora_lg01_win
oracle 109291 1 0 18:18 ? 00:00:00 ora_smco_win
oracle 109293 1 0 18:18 ? 00:00:00 ora_reco_win
oracle 109295 1 0 18:18 ? 00:00:00 ora_w000_win
oracle 109297 1 0 18:18 ? 00:00:00 ora_lreg_win
oracle 109299 1 0 18:18 ? 00:00:00 ora_w001_win
oracle 109301 1 0 18:18 ? 00:00:00 ora_pxmn_win
oracle 109305 1 0 18:18 ? 00:00:01 ora_mmon_win
oracle 109307 1 0 18:18 ? 00:00:00 ora_mmnl_win
oracle 109310 1 0 18:18 ? 00:00:00 ora_d000_win
oracle 109312 1 0 18:18 ? 00:00:00 ora_s000_win
oracle 109314 1 0 18:18 ? 00:00:00 ora_tmon_win
oracle 109319 1 0 18:18 ? 00:00:00 ora_m000_win
oracle 109321 1 0 18:18 ? 00:00:02 ora_m001_win
oracle 109327 1 0 18:18 ? 00:00:00 ora_tt00_win
oracle 109329 1 0 18:18 ? 00:00:00 ora_tt01_win
oracle 109331 1 0 18:18 ? 00:00:00 ora_tt02_win
oracle 109336 1 0 18:18 ? 00:00:00 ora_aqpc_win
oracle 109340 1 0 18:18 ? 00:00:00 ora_p000_win
oracle 109342 1 0 18:18 ? 00:00:00 ora_p001_win
oracle 109344 1 0 18:18 ? 00:00:00 ora_p002_win
oracle 109346 1 0 18:18 ? 00:00:00 ora_p003_win
oracle 109348 1 0 18:18 ? 00:00:00 ora_p004_win
oracle 109350 1 0 18:18 ? 00:00:00 ora_p005_win
oracle 109352 1 0 18:18 ? 00:00:00 ora_p006_win
oracle 109354 1 0 18:18 ? 00:00:00 ora_p007_win
oracle 109356 1 0 18:18 ? 00:00:00 ora_p008_win
oracle 109358 1 0 18:18 ? 00:00:00 ora_p009_win
oracle 109360 1 0 18:18 ? 00:00:00 ora_p00a_win
oracle 109362 1 0 18:18 ? 00:00:00 ora_p00b_win
oracle 109364 1 0 18:18 ? 00:00:00 ora_p00c_win
oracle 109366 1 0 18:18 ? 00:00:00 ora_p00d_win
oracle 109368 1 0 18:18 ? 00:00:00 ora_p00e_win
oracle 109370 1 0 18:18 ? 00:00:00 ora_p00f_win
oracle 109372 1 0 18:18 ? 00:00:00 ora_p00g_win
oracle 109374 1 0 18:18 ? 00:00:00 ora_p00h_win
oracle 109376 1 0 18:18 ? 00:00:00 ora_p00i_win
oracle 109378 1 0 18:18 ? 00:00:00 ora_w002_win
oracle 109380 1 0 18:18 ? 00:00:00 ora_p00j_win
oracle 109382 1 0 18:18 ? 00:00:02 ora_cjq0_win
oracle 109384 1 0 18:18 ? 00:00:00 ora_p00k_win
oracle 109388 1 0 18:18 ? 00:00:00 ora_p00l_win
oracle 109390 1 0 18:18 ? 00:00:00 ora_p00m_win
oracle 109392 1 0 18:18 ? 00:00:00 ora_p00n_win
oracle 109394 1 0 18:18 ? 00:00:00 ora_p00o_win
oracle 109396 1 0 18:18 ? 00:00:00 ora_p00p_win
oracle 109398 1 0 18:18 ? 00:00:00 ora_p00q_win
oracle 109400 1 0 18:18 ? 00:00:00 ora_p00r_win
oracle 109402 1 0 18:18 ? 00:00:00 ora_p00s_win
oracle 109404 1 0 18:18 ? 00:00:00 ora_p00t_win
oracle 109406 1 0 18:18 ? 00:00:00 ora_p00u_win
oracle 109408 1 0 18:18 ? 00:00:00 ora_p00v_win
oracle 109638 1 0 18:18 ? 00:00:00 ora_m002_win
oracle 109662 1 0 18:18 ? 00:00:00 ora_w003_win
oracle 109695 1 0 18:18 ? 00:00:00 ora_w004_win
oracle 109697 1 0 18:18 ? 00:00:00 ora_qm02_win
oracle 109701 1 0 18:18 ? 00:00:00 ora_q002_win
oracle 109703 1 0 18:18 ? 00:00:00 ora_q003_win
oracle 109771 1 0 18:19 ? 00:00:00 ora_w005_win
oracle 109797 1 0 18:19 ? 00:00:00 ora_w006_win
oracle 109908 1 0 18:21 ? 00:00:00 ora_m003_win
oracle 110277 1 0 18:28 ? 00:00:00 ora_m004_win
oracle 110283 1 0 18:28 ? 00:00:00 ora_w007_win
oracle 110287 1 0 18:28 ? 00:00:00 ora_w008_win
oracle 110292 1 0 18:29 ? 00:00:00 ora_w009_win
oracle 110299 1 0 18:29 ? 00:00:00 ora_w00a_win
oracle 110304 1 0 18:29 ? 00:00:00 ora_w00b_win
oracle 110308 1 0 18:29 ? 00:00:00 ora_w00c_win
oracle 110313 1 0 18:29 ? 00:00:00 ora_w00d_win
oracle 110317 1 0 18:29 ? 00:00:00 ora_w00e_win
oracle 110321 1 0 18:29 ? 00:00:00 ora_w00f_win
oracle 110326 1 0 18:29 ? 00:00:00 ora_w00g_win
oracle 110330 1 0 18:29 ? 00:00:00 ora_w00h_win
oracle 110335 1 0 18:29 ? 00:00:00 ora_w00i_win
oracle 110339 1 0 18:29 ? 00:00:00 ora_w00j_win
oracle 110344 1 0 18:29 ? 00:00:00 ora_w00k_win
oracle 110348 1 0 18:29 ? 00:00:00 ora_w00l_win
oracle 110353 1 0 18:29 ? 00:00:00 ora_w00m_win
oracle 110357 1 0 18:29 ? 00:00:00 ora_w00n_win
oracle 110362 1 0 18:29 ? 00:00:00 ora_w00o_win
oracle 110368 1 0 18:29 ? 00:00:00 ora_w00p_win
oracle 110372 1 0 18:29 ? 00:00:00 ora_w00q_win
oracle 110376 105048 0 18:29 pts/0 00:00:00 ps -ef
oracle 110377 105048 0 18:29 pts/0 00:00:00 grep --color=auto ora
[oracle@STUDY dbhome_1]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jul 27 18:30:09 2022
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 OCP READ WRITE NO
SQL> select name,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
WIN READ WRITE
SQL> show user
USER is "SYS"
SQL> SELECT SYS_CONTEXT('USERENV','CON_NAME') FROM dual;
SYS_CONTEXT('USERENV','CON_NAME')
--------------------------------------------------------------------------------
CDB$ROOT
SQL> alter session set container=ocp;
Session altered.
SQL> SELECT SYS_CONTEXT('USERENV','CON_NAME') FROM dual;
SYS_CONTEXT('USERENV','CON_NAME')
--------------------------------------------------------------------------------
OCP
SQL> alter session set container=CDB$ROOT;
Session altered.
SQL> SELECT SYS_CONTEXT('USERENV','CON_NAME') FROM dual;
SYS_CONTEXT('USERENV','CON_NAME')
--------------------------------------------------------------------------------
CDB$ROOT
--新建用户
SQL> alter session set container=ocp;
Session altered.
SQL> create user rui identified by rui;
User created.
SQL> grant dba to rui;
Grant succeeded.
–查看当前数据库
SQL> select name,open_mode from v$database;
–查看PDB信息
col pdb_name format a20
col status format a20
select pdb_id,pdb_name,dbid,status,creation_scn from dba_pdbs;
或者 show pdbs
–查看当前环境
SELECT SYS_CONTEXT(‘USERENV’,‘CON_NAME’) FROM dual;
–容器切换
alter session set container=weisipdb;
alter session set container=CDB$ROOT;
–完全卸载oracle
rm -f /etc/oratab
rm -f /etc/oraInst.loc
rm -rf $ORACLE_BASE
rm -rf /u01/app/oraInventory
参考视频:
https://www.bilibili.com/video/BV17r4y1m7fh/?spm_id_from=333.788&vd_source=7136aeca6f3fea14755a76ed47e74308
相关文章:《Oracle 19c 单实例 19.3.0 升级到19.11.0 详细教程》