Red Hat Enterprise Linux 7.6+Oracle 11g安装教程

2023年 9月 12日 72.1k 0

  本文档旨在提供在Linux 7操作系统上安装Oracle 11g数据库的详细步骤。通过正确的安装和配置,您将能够在Linux环境下搭建一个稳定、可靠的Oracle数据库系统。在安装开始之前,请确保您已经阅读并理解了Oracle 11g数据库的相关文档,并且具备一定的Linux系统管理经验。通过本文档提供的步骤和指导,您将了解如何在Linux 7上安装Oracle 11g数据库,并提供实用的技巧和注意事项,祝您顺利完成Linux 7上Oracle 11g数据库的安装!

1、环境规划

OS:Red Hat Enterprise Linux 7.6
HOSTNAME:hellodba
IP:192.168.0.55
CPU:4C
Memory:16G
DISK:
/:80G
/oracle:50G
/oradata:300G
/backup:200G
/archive:100G
/swap:16G
DB_Version:Oracle Database 11g 11.2.0.4.0
DB_NAME:hellodb
DB_BLOCK_SIZE:8192
DB_Character:ZHS16GBK

2、Linux系统参数设置

 2.1、hosts文件配置

[root@hellodba ~]# echo "192.168.0.55 hellodb" >> /etc/hosts

 2.2、配置语言环境

[root@hellodba ~]# echo "export LANG=en_US" >> ~/.bash_profile
[root@hellodba ~]# source ~/.bash_profile

 2.3、修改 /dev/shm大小

[root@hellodba ~]# echo "none /dev/shm tmpfs defaults,size=16384m 0 0" >> /etc/fstab
[root@hellodba ~]# mount -o remount /dev/shm
[root@hellodba ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 64G 4.2G 60G 7% /
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 7.8G 13M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
tmpfs 1.6G 12K 1.6G 1% /run/user/42
tmpfs 1.6G 0 1.6G 0% /run/user/0
/dev/mapper/oraclevg-oraclelv 49G 33M 49G 1% /oracle
/dev/mapper/oradatavg-oradatalv 293G 33M 293G 1% /oradata
/dev/mapper/backupvg-backuplv 20G 33M 20G 1% /backup
/dev/mapper/archivevg-archivelv 98G 33M 98G 1% /archive

//关于/dev/shm
  在Linux系统中,"/dev/shm"目录是一个特殊的目录,用于实现共享内存,默认是系统内存的50%。它是一个临时文件系统,通常位于RAM(内存)中,而不是硬盘上,并且在系统重启时会被清空。因此,"/dev/shm"目录只适合用于短期存储和进程间通信,不能用于长期存储数据。"/dev/shm"大小应该大于SGA+PGA的总内存大小,在Linux系统上,如果操作系统 "/dev/shm"装载大小对于Oracle系统全局区域(SGA)和程序全局区域(PGA)来说太小,则会导致ORA-00845错误。

 2.4、创建数据库用户组和系统用户

[root@hellodba ~]# /usr/sbin/groupadd -g 60001 oinstall
[root@hellodba ~]# /usr/sbin/groupadd -g 60002 dba
[root@hellodba ~]# /usr/sbin/groupadd -g 60003 oper
[root@hellodba ~]# useradd -u 61001 -g oinstall -G dba,oper oracle
[root@hellodba ~]# echo "oracle" | passwd --stdin oracle

 2.5、创建数据库安装目录并授权

[root@hellodba ~]# mkdir -p /oracle
[root@hellodba ~]# mkdir -p /oracle/app/oracle/product/11.2.0
[root@hellodba ~]# mkdir -p /oracle/app/oraInventory
[root@hellodba ~]# chown -R oracle:oinstall /oracle
[root@hellodba ~]# chown -R oracle:oinstall /oradata
[root@hellodba ~]# chown -R oracle:oinstall /backup
[root@hellodba ~]# chown -R oracle:oinstall /archive
[root@hellodba ~]# chmod -R 775 /oracle
[root@hellodba ~]# chmod -R 775 /oradata
[root@hellodba ~]# chmod -R 775 /backup
[root@hellodba ~]# chmod -R 775 /archive

 2.6、配置YUM源

//挂载光驱
[root@hellodba ~]# mount /dev/cdrom /mnt

//配置YUM源
[root@hellodba ~]# cd /etc/yum.repos.d
[root@hellodba yum.repos.d]# mkdir bak
[root@hellodba yum.repos.d]# mv *.repo bak
[root@hellodba yum.repos.d]# echo "[EL]" >> hellodba.repo
[root@hellodba yum.repos.d]# echo "name=Linux 7.6 DVD" >> hellodba.repo
[root@hellodba yum.repos.d]# echo "baseurl=file:///mnt" >> hellodba.repo
[root@hellodba yum.repos.d]# echo "gpgcheck=0" >> hellodba.repo
[root@hellodba yum.repos.d]# echo "enabled=1" >> hellodba.repo

 2.7、安装Oracle数据库所需软件包

[root@hellodba ~]#
yum -y install autoconf
yum -y install automake
yum -y install binutils
yum -y install binutils-devel
yum -y install bison
yum -y install cpp
yum -y install dos2unix
yum -y install gcc
yum -y install gcc-c++
yum -y install lrzsz
yum -y install python-devel
yum -y install compat-db*
yum -y install compat-gcc-34
yum -y install compat-gcc-34-c++
yum -y install compat-libcap1
yum -y install compat-libstdc++-33
yum -y install compat-libstdc++-33.i686
yum -y install glibc-*
yum -y install glibc-*.i686
yum -y install libXpm-*.i686
yum -y install libXp.so.6
yum -y install libXt.so.6
yum -y install libXtst.so.6
yum -y install libXext
yum -y install libXext.i686
yum -y install libXtst
yum -y install libXtst.i686
yum -y install libX11
yum -y install libX11.i686
yum -y install libXau
yum -y install libXau.i686
yum -y install libxcb
yum -y install libxcb.i686
yum -y install libXi
yum -y install libXi.i686
yum -y install libXtst
yum -y install libstdc++-docs
yum -y install libgcc_s.so.1
yum -y install libgcc-*
yum -y install libstdc++.i686
yum -y install libstdc++-devel
yum -y install libstdc++-devel.i686
yum -y install libaio
yum -y install libaio.i686
yum -y install libaio-devel
yum -y install libaio-devel.i686
yum -y install libXp
yum -y install libaio-devel
yum -y install numactl
yum -y install numactl-devel
yum -y install make -y
yum -y install sysstat -y
yum -y install unixODBC
yum -y install unixODBC-devel
yum -y install elfutils-libelf-devel-0.97
yum -y install elfutils-libelf-devel
yum -y install redhat-lsb-core
yum -y install ksh*
yum -y install unzip
yum -y install *vnc*

 2.8、配置内核参数和资源限制

--修改资源限制参数
[root@hellodba ~]# vi /etc/security/limits.conf
#ORACLE SETTING
#打开文件描述符大小
oracle soft nproc 16384
oracle hard nproc 16384
#单个用户可用的进程数
oracle soft nofile 16384
oracle hard nofile 65536
oracle soft stack 10240
#进程堆栈段的大小
oracle hard stack 32768
oracle hard memlock 14000000
#内存锁,略低于物理内存
oracle soft memlock 14000000

[root@hellodba ~]# vi /etc/security/limits.d/20-nproc.conf
* soft nproc 16384

--修改内核参数
[root@hellodba ~]# vi /etc/sysctl.conf
#ORACLE SETTING
#可以拥有的异步IO请求数
fs.aio-max-nr = 1048576
#允许文件句柄的最大数目
fs.file-max = 6815744
#信号参数
kernel.sem = 250 32000 100 128
#IP V4的端口范围
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 = 1048586
#当系统检测到oops时,重新启动系统,以便系统能够重新初始化恢复正常工作
kernel.panic_on_oops = 1
#单个共享内存段最大值,让数据库在一个共享段里面的可以容纳整个SGA
#SGA=物理内存*80%*80% PGA=物理内存*80%*20%
#(kernel.shmmax = 物理内存*1024*1024*1024-1)
kernel.shmmax = 15032385536
#控制共享内存页数(kernel.shmall = shmmax/4096)
kernel.shmall = 3670016
#共享内存的最大数量
kernel.shmmni = 4096
#当系统内存使用90%的时候开始使用交换页面
vm.swappiness=10
#默认是100,增大这个参数设置了虚拟内存回收directory和i-node缓冲的倾向,这个值越大。越容易回收。
vm.vfs_cache_pressure=200
#大页内存,物理内存大于8G一定要配 (sga_max_size+1g) / 2M
vm.nr_hugepages = 4500

[root@hellodba ~]# sysctl -p
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
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 = 1048586
kernel.panic_on_oops = 1
kernel.shmmax = 15032385536
kernel.shmall = 3670016
kernel.shmmni = 4096
vm.swappiness = 10
vm.vfs_cache_pressure = 200
vm.nr_hugepages = 4500

 2.9、关闭透明页

// 开了大内存页,一定要关闭透明页
[root@hellodba ~]# cat /sys/kernel/mm/transparent_hugepage/defrag
[always] madvise never
[root@hellodba ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
[root@hellodba ~]# vi /etc/rc.d/rc.local
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi

[root@hellodba ~]# chmod +x /etc/rc.d/rc.local
[root@hellodba ~]# init 6
[root@hellodba ~]# cat /sys/kernel/mm/transparent_hugepage/defrag
always madvise [never]
[root@hellodba ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]

 2.10、关闭numa功能

[root@hellodba ~]# yum install numactl -y
[root@hellodba ~]# numactl --hardware
available: 1 nodes (0)
node 0 cpus: 0 1 2 3
node 0 size: 16383 MB
node 0 free: 5885 MB
node distances:
node 0
0: 10

[root@hellodba ~]# vi /etc/default/grub
将 GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet"
改 GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet numa=off"
[root@hellodba ~]# grub2-mkconfig -o /etc/grub2.cfg

 2.11、禁用SELINUX

[root@hellodba ~]# getenforce
Enforcing
[root@hellodba ~]# vi /etc/selinux/config
将 SELINUX=enforcing
改 SELINUX= disabled
[root@hellodba ~]# setenforce 0
[root@hellodba ~]# getenforce
Permissive

 2.12、关闭防火墙

[root@hellodba ~]# systemctl stop firewalld
[root@hellodba ~]# systemctl status firewalld
* firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Sat 2023-09-09 14:08:37 CST; 5s ago
Docs: man:firewalld(1)
Process: 10031 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 10031 (code=exited, status=0/SUCCESS)

Sep 09 14:05:01 hellodba systemd[1]: Starting firewalld - dynamic firewall daemon...
Sep 09 14:05:03 hellodba systemd[1]: Started firewalld - dynamic firewall daemon.
Sep 09 14:08:36 hellodba systemd[1]: Stopping firewalld - dynamic firewall daemon...
Sep 09 14:08:37 hellodba systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@hellodba ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

 2.13、设置系统默认字符界面启动

[root@hellodba ~]# systemctl set-default multi-user.target
[root@hellodba ~]# systemctl get-default
multi-user.target
//设置系统默认图形化界面启动
//[root@hellodba ~]# systemctl set-default graphical.target

 2.14、配置Oracle用户环境变量

[root@hellodba ~]# su - oracle
[oracle@hellodba ~]$ vi ~/.bash_profile
export PS1
export TMP=/tmp
export LANG=en_US
export TMPDIR=$TMP
export ORACLE_UNQNAME=hellodb
ORACLE_SID=hellodb; export ORACLE_SID
ORACLE_BASE=/oracle/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
#设置Oracle客户端字符集,必须与Oracle安装时设置的字符集保持一致,否则出现数据导入导出中文乱码问题
#NLS_LANG=AMERICAN_AMERICA.UTF8;export NLS_LANG
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANG
LANG=en_US.UTF8;export LANG
PATH=.:$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_BASE/product/11.2.0/db_1/bin:$ORACLE_HOME/bin; export PATH
THREADS_FLAG=native; export THREADS_FLAG
umask=022

if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -u 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

[oracle@hellodba ~]$ source ~/.bash_profile
[oracle@hellodba ~]$ env | grep ORACLE
ORACLE_UNQNAME=hellodb
ORACLE_SID=hellodb
ORACLE_BASE=/oracle/app/oracle
ORACLE_TERM=xterm
ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db_1

 2.15、重启操作系统

[root@hellodba ~]# init 6

3、安装Oracle数据库软件

 3.1、上传Oracle数据库安装软件到服务器并解压

//通过oracle用户上传Oracle数据库安装软件到服务器 /backup 目录
[root@hellodba ~]# su - oracle
[oracle@hellodba ~]$ cd /backup
[oracle@hellodba backup]$ ll
-rw-r--r--. 1 oracle oinstall 1395582860 Sep 9 23:07 p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r--. 1 oracle oinstall 1151304589 Sep 9 23:07 p13390677_112040_Linux-x86-64_2of7.zip
[oracle@hellodba backup]$ unzip p13390677_112040_Linux-x86-64_1of7.zip
[oracle@hellodba backup]$ unzip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@hellodba backup]$ ll
drwxr-xr-x. 7 oracle oinstall 136 Aug 27 2013 database
-rw-r--r--. 1 oracle oinstall 1395582860 Sep 9 23:07 p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r--. 1 oracle oinstall 1151304589 Sep 9 23:07 p13390677_112040_Linux-x86-64_2of7.zip

 3.2、操作系统启动VNC服务

//以oracle用户启动VNC服务
[oracle@hellodba ~]$ vncserver

You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
xauth: file /home/oracle/.Xauthority does not exist

New 'hellodba:1 (oracle)' desktop is hellodba:1

Creating default startup script /home/oracle/.vnc/xstartup
Creating default config /home/oracle/.vnc/config
Starting applications specified in /home/oracle/.vnc/xstartup
Log file is /home/oracle/.vnc/hellodba:1.log

 3.3、使用VNC客户端连接服务器

 3.4、安装数据库软件

[oracle@hellodba ~]$ cd /backup/database
[oracle@hellodba database]$ ./runInstaller -jreLoc /etc/alternatives/jre_1.8.0












// Linux 7 安装Oracle 11g的BUG
//解决办法
[oracle@hellodba ~]$ cd $ORACLE_HOME/sysman/lib
[oracle@hellodba lib]$ cp ins_emagent.mk ins_emagent.mk.bak
[oracle@hellodba lib]$ vi ins_emagent.mk
搜索/NMECTL并添加参数如下 -lnnz11

#===========================
# emdctl
#===========================

$(SYSMANBIN)emdctl:
$(MK_EMAGENT_NMECTL) -lnnz11

#===========================


[root@hellodba ~]# /oracle/app/oraInventory/orainstRoot.sh
Changing permissions of /oracle/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /oracle/app/oraInventory to oinstall.
The execution of the script is complete.
[root@hellodba ~]# /oracle/app/oracle/product/11.2.0/db_1/root.sh
Performing root user operation for Oracle 11g

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /oracle/app/oracle/product/11.2.0/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Finished product-specific root actions.

4、配置监听

[oracle@hellodba ~]$ netca








//查看监听状态
[oracle@hellodba ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 10-SEP-2023 00:15:26

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hellodb)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 10-SEP-2023 00:13:59
Uptime 0 days 0 hr. 1 min. 27 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /oracle/app/oracle/diag/tnslsnr/hellodba/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hellodba)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

//关闭监听
[oracle@hellodba ~]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 10-SEP-2023 00:15:37

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hellodb)(PORT=1521)))
The command completed successfully

//启动监听
[oracle@hellodba ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 10-SEP-2023 00:15:42

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Starting /oracle/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /oracle/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /oracle/app/oracle/diag/tnslsnr/hellodba/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hellodba)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hellodb)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 10-SEP-2023 00:15:42
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /oracle/app/oracle/diag/tnslsnr/hellodba/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hellodba)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

5、创建数据库

[oracle@hellodba ~]$ dbca





















6、登录数据库

//登录数据库
[root@hellodba ~]# su - oracle
[oracle@hellodba ~]$ sqlplus / as sysdba

//查看数据库基础信息
SQL> select name,log_mode,open_mode,platform_name,db_unique_name from v$database;
NAME LOG_MODE OPEN_MODE PLATFORM_NAME DB_UNIQUE_NAME
--------------------------------------------------------------------------------------
HELLODB NOARCHIVELOG READ WRITE Linux x86 64-bit hellodb

//查看数据库版本
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

//查看数据库字符集
SQL> select * from nls_database_parameters;
PARAMETER VALUE
--------------------------------------------------------------
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET ZHS16GBK
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_RDBMS_VERSION 11.2.0.4.0

//查看数据库块大小
SQL> show parameter db_block_size
NAME TYPE VALUE
-------------------------------------------
db_block_size integer 8192

7、基础维护

 7.1、取消180天密码过期限制

SQL> select * from dba_profiles where profile='DEFAULT' and RESOURCE_NAME='PASSWORD_LIFE_TIME';
PROFILE RESOURCE_NAME RESOURCE_TYPE LIMIT
-----------------------------------------------------------------------------------------------
DEFAULT PASSWORD_LIFE_TIME PASSWORD 180

SQL> alter profile default limit password_life_time unlimited;

SQL> select * from dba_profiles where profile='DEFAULT' and RESOURCE_NAME='PASSWORD_LIFE_TIME';
PROFILE RESOURCE_NAME RESOURCE_TYPE LIMIT
-----------------------------------------------------------------------------------------------
DEFAULT PASSWORD_LIFE_TIME PASSWORD UNLIMITED

 7.2、关闭审计

SQL> show parameter audit;
NAME TYPE VALUE
----------------------------------------------------------------------------------------------
audit_file_dest string /oracle/app/oracle/admin/hellodb/adump
audit_sys_operations boolean FALSE
audit_syslog_level string
audit_trail string DB

SQL> alter system set audit_trail=none scope=spfile; (重启数据库生效)

 7.3、参数检查

//查看PGA
SQL> show parameter pga;
NAME TYPE VALUE
-----------------------------------------------------------------------------
pga_aggregate_target big integer 1966M

//查看SGA
SQL> show parameter sga;
NAME TYPE VALUE
-----------------------------------------------------------------------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 7872M
sga_target big integer 7872M

//查看进程数
SQL> show parameter process;
NAME TYPE VALUE
----------------------------------------------------------------------------
aq_tm_processes integer 1
cell_offload_processing boolean TRUE
db_writer_processes integer 1
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 1000
log_archive_max_processes integer 4
processes integer 2000
processor_group_name string

//查看游标
SQL> show parameter open_cursors;
NAME TYPE VALUE
----------------------------------------------------------------------------
open_cursors integer 300

//将 open_cursors 改为和 processes 一样
SQL> alter system set open_cursors = 2000 scope=spfile; (重启数据库生效)

 7.4、调整undo大小

//关闭隐含参数
SQL> alter system set "_undo_autotune"=false;
SQL> select name from v$datafile;
NAME
----------------------------------------------------------------------------
/oradata/hellodb/system01.dbf
/oradata/hellodb/sysaux01.dbf
/oradata/hellodb/undotbs01.dbf
/oradata/hellodb/users01.dbf

//调整undo大小
SQL> alter database datafile '/oradata/hellodb/undotbs01.dbf' resize 30g;

 7.5、调整db_files

SQL> show parameter db_files;
NAME TYPE VALUE
---------------------------------------------------------------------------
db_files integer 200

SQL> alter system set db_files=1024 scope=spfile; (重启数据库生效)

8、Oracle数据库的启停

 8.1、启动

[root@hellodba ~]# su - oracle
[oracle@hellodba ~]$ lsnrctl start
[oracle@hellodba ~]$ sqlplus / as sysdba
SQL> startup

 8.2、停止

[root@hellodba ~]# su - oracle
[oracle@hellodba ~]$ lsnrctl stop
[oracle@hellodba ~]$ sqlplus / as sysdba
SQL> shutdown immediate;

9、总结

  到此Oracle数据库安装完毕,并进行了一些常规的设置。安装Oracle数据库需要有一定的专业知识和经验,在实际操作中,可能还会遇到其他问题和挑战,建议在进行安装之前详细阅读相关文档和指南,并确保有必要的技术支持和备份措施。

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论