安装Oracle linux的 带图形化的比较简单,所以就用图形化的类进行配置了。
如果是minimal的 用如下方法安装图形化:
yum groupinstall 'Server with GUI'
systemctl set-default graphical.target
systemctl isolate graphical.target
systemctl get-default
安装图形化之后进行基本的资源分配:
[root@localhost ~]# grep MemTotal /proc/meminfo
[root@localhost ~]# free -m
[root@localhost ~]# df -h /tmp
[root@localhost ~]# uname -m
[root@localhost ~]# df -h
要求1个G以上的 /tmp空间,runlevel3以上 1024X768分辨率
内存1G建议2G。
需要各种依赖软件包,后边自动监测就好了。
确定共享内存挂载
df -h
tmpfs 1.8G 0 1.8G 0% /dev/shm
初始化
配置网络,关闭防火墙,selinux,主机名 ,hosts文件
创建 oracle 相关用户和用户组
[root@localhost ~]# groupadd -g 1010 oinstall
[root@localhost ~]# groupadd -g 1100 dba
[root@localhost ~]# groupadd -g 1200 oper
[root@localhost ~]# groupadd -g 1300 backupdba
[root@localhost ~]# groupadd -g 1400 dgdba
[root@localhost ~]# groupadd -g 1500 kmdba
[root@localhost ~]# useradd -u 777 -g oinstall -G dba,oper,backupdba,dgdba,kmdba oracle
设置oracle用户的环境变量
[root@localhost ~]# vim /home/oracle/.bash_profile
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_SID=prod
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_home1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib64:/usr/lib64
export PATH=$ORACLE_HOME/bin:$PATH
su - oracle
[oracle@oracle12c ~]$ echo $ORACLE_BASE
/u01/app/oracle
[oracle@oracle12c ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/12.2.0/db_home1
[oracle@oracle12c ~]$ echo $ORACLE_SID
prod
创建相关路径:
[root@localhost ~]# mkdir /u01/app/oracle -pv
[root@localhost app]# chmod -R 775 /u01/app/
[root@localhost app]# chown -R oracle.oinstall /u01/app/
内核参数等等的可以让oracle自动修改
。
然后重新挂载12C的镜像
[root@oracle12c mnt]# unzip ORACLE12C_LINUX_x86_64.zip -d /usr/local/src/
解压缩
目录结构:
[root@oracle12c mnt]# cd /usr/local/src/
[root@oracle12c src]# ls
database
[root@oracle12c src]# cd database/
[root@oracle12c database]# ls
install response rpm runInstaller sshsetup stage welcome.html
runInstaller 叫 OUI oracle universion installer
12c database]# xhost +
access control disabled, clients can connect from any host
切换 oracle 用户 运行OUI
[root@oracle12c database]# su - oracle
[oracle@oracle12c database]$ export DISPLAY=:0.0
[oracle@oracle12c database]$ ./runInstaller
这里要修改下分辨率
这里要修改下分辨率
这里要修改下分辨率
默认安装后是800x600 这个显示不全
用这些命令查看和修改分辨率至少为1024x768
[root@oracle12c ~]# xrandr
查看当前分辨率
[root@oracle12c database]# xrandr --output Virtual1 --mode "1024x768"
修改Virtual1 屏幕的分辨率为1024x768
图形化安装向导:
注释:需要填写邮箱,会接收到Oracle的安全升级信息,要使用MOS帐号对应的邮箱。这个帐号是收费的。没有取消然后下一步。
会报这个警告,确定不填写邮箱吗,直接yes
安装软件和数据库分开,这里选只安装软件
选择单实例安装。
这个是oracle的base 和软件的location目录,前边的软件环境变量正确的话这里自动填好的。
如果没有的话,先写上后边再补。
软件路径这个自动创建,下边的用户组,默认就好。
这个是各种不同权限的用户组,默认就好了。
环境监测
检测之后是这样的,当前的内容有不符合的地方,没安装包,是不合规定的。
然后点击fix
按照下边提示操作。
新开个窗口,运行:
[root@oracle12c ~]# /tmp/CVU_12.2.0.1.0_oracle/runfixup.sh
All Fix-up operations were completed successfully.
运行成功
然后回去点ok
少了很多但是有个错误 failed
Soft Limit: maximum stack size - This is a prerequisite condition to test whether the soft limit for maximum stack size is set correctly. Details:
PRVG-0449 : Proper soft limit for maximum stack size was not found on node “oracle12c” [Expected >= “10240” ; Found = “8192”]. - Cause: The Cluster Verification Utility determined that the setting for the indicated soft limit did not meet Oracle’'s recommendations for proper operation on the indicated nodes. - Action: Modify the resource limits to meet the requirement and take operating system specific measures to ensure that the corrected value takes effect for the current user before retrying this check.
查看发现是soft limit 推荐是10240 但是检测到的是8192,然后查看下文件看是不是。
[root@oracle12c ~]# vi /etc/security/limits.conf
#Oracle recommended value for stack is set to 10240 for user oracle
oracle soft stack 10240
发现就是10240但是还有错,所以就忽略就好了
然后解决软件包的问题。
镜像再换成系统光盘。
手写个yum源
[root@oracle12c yum.repos.d]# gzip public-yum-ol7.repo
[root@oracle12c yum.repos.d]# vim ol.repo
[base-mnt-iso]
name=mnt-linux-iso
baseurl=file:///mnt
gpgcheck=0
enabled=1
然后安装软件:
[root@oracle12c yum.repos.d]# yum install -y compat-libcap1 libstdc++-devel ksh glibc-devel libaio-devel
就是检测哪里发现缺少的
安装之后到检测页面 点击 check again再次检测,发现就剩下这个了,这个报错刚刚看过是正常的。
那就忽略这个错误 ignore all -> 下一步。
会弹出警告,真的忽略一些问题吗? yes
然后就到最后了
install安装之前可以点击上边的save response file 保存响应文件,响应文件就类似于无人值守的KS文件,记录自己的配置等。
然后install 等待安装。
安装到这里时会出个弹窗。按顺序执行这两个脚本。
[root@oracle12c ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@oracle12c ~]# /u01/app/oracle/product/12.2.0/db_home1/root.sh
Performing root user operation.
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/12.2.0/db_home1
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.
Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] :
no 这里问是否安装 Trace File Analyzer (TFA)跟踪文件的分析器 要就yes,不用就no。
Oracle Trace File Analyzer (TFA - User Mode) is available at :
/u01/app/oracle/product/12.2.0/db_home1/suptools/tfa/release/tfa_home/bin/tfactl
OR
Oracle Trace File Analyzer (TFA - Daemon Mode) can be installed by running this script :
/u01/app/oracle/product/12.2.0/db_home1/suptools/tfa/release/tfa_home/install/roottfa.sh
下边是提示,如果要安装TFA的话,按照下边的步骤。
然后回来点ok
就安装完成了
有了软件 之后
查看 oracle home 多了很多文件
[oracle@oracle12c database]$ cd $ORACLE_HOME
[oracle@oracle12c db_home1]$ ls
addnode crs deinstall install lib olap oss racg sqlj utl
apex css demo instantclient log OPatch oui rdbms sqlpatch wwg
assistants ctx diagnostics inventory md opmn owm relnotes sqlplus xdk
bin cv dmu javavm mgw oracore perl root.sh srvm
ccr data dv jdbc network oraInst.loc plsql schagent.conf suptools
cdata dbjava env.ora jdk nls ord precomp scheduler sysman
cfgtoollogs dbs has jlib oc4j ordim QOpatch slax ucp
clone dc_ocm hs ldap odbc ords R sqldeveloper usm
创建监听:
[oracle@oracle12c db_home1]$ netca
配置监听,next
添加
监听名称
网络协议
端口,默认1521端口
还要不要配置别的
这里直接finish,结束监听创建
查看监听状态
没有库 监听是空的
@oracle12c db_home1]$ lsnrctl status
创建数据库:
[oracle@oracle12c db_home1]$ dbca
创建数据库
高级配置
就用通用型了
PDB数据库 可插拔的数据库。
使用模板
开启FRA
监听,如果没有监听的话外部程序是不能连接到数据库的,之前没创建可以在下边创建。
这里不用配什么直接next
选自动内存管理机制就好了
下一步
默认5500端口 连接这个端口就能管理了
设置密码 ,就用同一个密码了,要求有大小写字母数字各一个,太简单会警告。
显示配置的概要,保存响应文件。 然后finish。
然后等待就好了。
安装完显示信息。
查下监听
[oracle@oracle12c db_home1]$ lsnrctl status
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 16-MAR-2020 05:53:14
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle12c.gsc.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 16-MAR-2020 05:03:21
Uptime 0 days 0 hr. 49 min. 52 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.2.0/db_home1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/oracle12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle12c.gsc.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=oracle12c.gsc.com)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/prod/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "a0f6c15b85b84a04e053fa0010acbee6.gsc.com" has 1 instance(s).
Instance "prod", status READY, has 1 handler(s) for this service...
Service "prod.gsc.com" has 1 instance(s).
Instance "prod", status READY, has 1 handler(s) for this service...
Service "prodXDB.gsc.com" has 1 instance(s).
Instance "prod", status READY, has 1 handler(s) for this service...
Service "prodpdb.gsc.com" has 1 instance(s).
Instance "prod", status READY, has 1 handler(s) for this service...
The command completed successfully
登陆一下:
[oracle@oracle12c db_home1]$ sqlplus / as sysdba
SQL> show parameter instance_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name string prod
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PRODPDB READ WRITE NO
数据库就安装完了。
下面是windows客户端安装。
windows要先有java环境。
我的jdk版本
下载12c客户端直接运行。
管理员的功能比较多。
可能会遇到个BUG 也可能不会。https://blog.csdn.net/n_u_l_l_/article/details/104926791
支持语言
使用内置账户
位置
基本信息,同样可以保存响应文件
安装
打开软件:
SQL Developer
连接数据库:
换成oracle用户
[root@oracle12c ~]# su - oracle
启动监听
[oracle@oracle12c ~]$ lsnrctl start
查看状态
[oracle@oracle12c ~]$ lsnrctl status
这里就应该能看到4个实例了,如果没有看到那就启动实例
登录进去
[oracle@ora12c ~]$ sqlplus / as sysdba
启动实例
SQL> startup;
打开prodpdb
SQL>alter pluggable database prodpdb open;
然后退出
[oracle@oracle12c ~]$ sqlplus sys/密码@172.16.0.250:1521/prodpdb.gsc.com as sysdba
prodpdb 那个是要连接的实例名字。 as sysdba是系统用户的名字。
登陆进去之后给hr用户打开
SQL> alter user hr identified by hr account unlock;
User altered.
打开客户端创建连接
测试连接成功就可以连接了。
可以查询下样例数据库:
到此结束。
没有hr用户
可以创建个用户 然后给大点权限:
create user demo identified by demo;
grant dba to demo;
[oracle@oracle12c ~]$ cd $ORACLE_HOME/network/admin
[oracle@oracle12c admin]$ ls
listener.ora samples shrept.lst tnsnames.ora
[oracle@oracle12c admin]$ vim tnsnames.ora
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle12c.gsc.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prodpdb.gsc.com)
)
)
[oracle@oracle12c admin]$ tnsping prodpdb
[oracle@oracle12c admin]$ cd $ORACLE_HOME/sqlplus/admin
[oracle@oracle12c admin]$ vim glogin.sql
set sqlprompt "&_user@&_connect_identifier>" --设置SQL命令提示符的格式
set null (null) --设置空值的显示格式
define _editor=vi --设置默认编辑器通过"ed"命令调用