oracle数据库安装笔记

安装centos,要在安装时设置网络为静态ip,不支持动态ip。

vi /etc/inittab 
id:5:initdefault:
change id:3:initdefault:
vi /etc/selinux/config
SELINUX=disabled
setup
close system services---sendmail

set dns
vi /etc/resolv.conf
nameserver 查看自己的dns服务器ip
nameserver 10.96.1.19
nameserver 10.176.2.1

下载软件
wget -c http://

install rlwrap
tar zxvf rlwrap
./configure && make && make install

less rpm
mount /dev/sr0 /mnt/cdro
m

mount 再次查看一下是否挂载成功

cd /etc/yum.repos.d/

mv .repo .repo.bak?保存一个.repo.bak,为了以后网络yum方便使用,并且备份

把所有的.repo?全部备份好。但是不改media.repo,因为后面要使用修改这个文件。

vim media.repo
修改:file:///挂载地址

修改:enable=1

注释file:///下面两个地址


#?file///media/cdrom


# file///media/cdrom

注释有严格格式

rpm -qa | grep readline 查看rpm包内是否有readline
yum install readline* 安装所有readline*的包

最后再次执行./configure && make && make install成功安装!

which rlwrap 查看安装路径

unzip oracle的安装文件.zip文件

ls -l 查看

在root 根目录下新建文件夹oracle

开始建组
groupadd oinstall
groupadd dba
建用户
useradd -g oinstall -G dba -d /oracle/oracle12 oracle
主组oinstall 辅组dba 用户oracle
设置密码
passwd oracle
进入oracle文件夹
mv /root/database/ .
粘贴到oracle文件夹内
更改database的权限和组
chown -R oracle:oinstall /oracle
磁盘布局完成,切换用户
su - oracle
ls -la 查看.bash_profile
vi .bash_profile
在最后一行增加
ORACLE_SID=walnut
ORACLE_BASE=/oracle
ORACLE_HOME=$ORACLE_BASE/oracle

LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
PATH=$ORACLE_HOME/bin:$PATH

DISPLAY=192.168.25.1:0.0

TNS_ADMIN=$ORACLE_HOME/network/admin

LD_ASSUME_KERNEL=2.4.19 //如果使用redhat就需要设置linux使用标准的linux Threads

export ORACLE_SID ORACLE_BASE ORACLE_HOME LD_LIBRARY_PATH PATH DISPLAY TNS_ADMIN

stty erase ^h

alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"

保存退出

查看一下
env | grep ORA
准备工作完成

安装必须的rpm包
必须在root用户下操作check
oracle database preinstallation requirments
checking the software requirements
Configuring Openerating systems for oracle database on linux
operating system requirements for x86-64 linux platforms

必须安装pdksh-devel包,但是文档中未提出。

按照文档中的rpm包查看是否已经安装好

如果没有安装好,就要下载,rpm文件
然后用命令安装
ls -l *.rpm可以查看有哪些.rpm包
rpm -ivh *.rpm

pdksh-devel

compat-libstdc++-33-3.2.3-71.el7 (i686
compat-libstdc++-33-3.2.3-71.el7 (x86_64)


step1:安装必需的rpm包

yum install binutils libX11 compat-libcap1 libXau compat-libstdc++-33 libaio gcc libaio-devel gcc-c++ libdmx glibc-devel glibc ksh make libgcc sysstat libstdc++ xorg-x11-utils libstdc++-devel xorg-x11-xauth libXext libXv libXtst libXi libxcb libXt libXmu libXxf86misc libXxf86dga libXxf86vm nfs-utils smartmontools

配置内核参数
Completing Preinstallation Tasks Manually
Changing Kernel Parameter Values
step1:安装必需的rpm包

yum install binutils libX11 compat-libcap1 libXau compat-libstdc++-33 libaio gcc libaio-devel gcc-c++ libdmx glibc-devel glibc ksh make libgcc sysstat libstdc++ xorg-x11-utils libstdc++-devel xorg-x11-xauth libXext libXv libXtst libXi libxcb libXt libXmu libXxf86misc libXxf86dga libXxf86vm nfs-utils smartmontools

Checking Resource Limits for Oracle Software Installation Users

step3:设置用户限制

vim /etc/security/limits.d/99-grid-oracle-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

step4:添加用户

groupadd --gid 54321 oinstall

groupadd --gid 54322 dba

groupadd --gid 54326 oper

groupadd --gid 54327 backupdba

groupadd --gid 54328 dgdba

groupadd --gid 54329 kmdba

useradd --uid 54321 --gid oinstall --groups dba,oper,backupdba,dgdba,kmdba oracle

echo "oracle"|passwd --stdin oracle

step5:设置目录

mkdir -p /u01/app/12.2.0/grid

chown -R oracle.oinstall /u01

chmod -R 755 /u01

step6:设置环境变量

su - oracle

vim .bash_profile

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1

export ORACLE_SID=orcl

export PATH=$ORACLE_HOME/bin:$PATH; 


确保DISPLAY=192.168.25.1:0.0
env | grep DIS 查看一下是否可以找到对应的ip的windows系统


需求:Unix/Linux下需要图形输出结果,往往需要用到Xwin图形界面。而unix/linux往往都是服务器,在远端;而我们操作的客户机往往是windows,通过SecureCRT/Putty连接到unix/Linux服务器上.如何在windows客户机上实现X11的图形界面功能呢?

实现步骤如下:
1、首先windows客户机下载安装Xming软件。

请在这里下载Xming软件:http://sourceforge.net/projects/xming/files/latest/download
2、配置Xming,确保允许远端服务器可连接windows客户机上的Xming。
把远端unix/Linux服务器的ip加入到xming的信任的ip里去. 在xming的安装目录中找到Xn.hosts (其中n为你的DISPLAY Number对应的值,如X0.hosts), 在里面新加一行ip 地址(这个文件中每个ip占一行) ,需重新启动Xming生效。

此步骤若不配置,会发生:类似”Xming: client 4 rejected from IP”的Xming log报错,且无法连接。

3、配置SecureCRT转发X11(putty类似),在连接unix/Linux服务器的会话选项中配置,见下图:
回话选项---远程X11---勾选转发X11数据包(F)
4、在服务器上配置X11到windows客户机:

export DISPLAY=192.168.X.X:0.0

192.168.X.X为你安装了Xming软件的客户机IP。

5、运行需要用到Xwin图形界面的应用即可,如gnuplot.

实用技巧:在Linux下设置xhost方法步骤

(1)安装vnc yum -y install vnc 
(2)安装vncserver依赖包 yum -y install xorg-x11-fonts-misc
(3)安装vncserver yum -y install tigervnc-server


第一步:用root登陆linux,启动vnc服务;

vncserver

New ‘localhost:1 (root)’ desktop is localhost:1

Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/localhost:1.log

第二步:根据vnc起来的端口为1,设置export DISPLAY=localhost:1(1表示vnc在第一个tty上启动的),vnc的启动信息见附件1;

export DISPLAY=localhost:1

第三步:执行xhost +,并且提示“access control disabled, clients can connect from any host”才正确。

xhost +


关闭vncserver 
vncserver -kill :n 
查看连接 
vncserver -list

关闭vncserver

重启服务器init 6

step7:开始安装

su - oracle

[oracle@oracle12c database]$ ./runInstaller

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 7211 MB    Passed

Checking swap space: must be greater than 150 MB.   Actual 1023 MB    Passed

Checking monitor: must be configured to display at least 256 colors

    >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.    Failed <<<<

Some requirement checks failed. You must fulfill these requirements before

continuing with the installation,

Continue? (y/n) [n] y

>>> Ignoring required pre-requisite failures. Continuing...

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-08-11_01-14-29AM. Please wait ...

DISPLAY not set. Please set the DISPLAY and try again.

Depending on the Unix Shell, you can use one of the following commands as examples to set the DISPLAY environment variable:

- For csh:              % setenv DISPLAY 192.168.1.128:0.0

- For sh, ksh and bash:     $ DISPLAY=192.168.1.128:0.0; export DISPLAY

Use the following command to see what shell is being used:

    echo $SHELL

Use the following command to view the current DISPLAY environment variable setting:

    echo $DISPLAY

- Make sure that client users are authorized to connect to the X Server.

To enable client users to access the X Server, open an xterm, dtterm or xconsole as the user that started the session and type the following command:

% xhost +

To test that the DISPLAY environment variable is set correctly, run a X11 based program that comes with the native operating system such as 'xclock':

    % <full path to xclock.. see below>

If you are not able to run xclock successfully, please refer to your PC-X Server or OS vendor for further assistance.

Typical path for xclock: /usr/X11R6/bin/xclock

之后尝试设置了多次$DISPLAY,都不行,如下

DISPLAY=192.168.107.155:0.0;export $DISPLAY

DISPLAY=192.168.107.155:1.0;export $DISPLAY

DISPLAY=192.168.107.155:0.1export $DISPLAY

DISPLAY=:0;export $DISPLAY

DISPLAY=:1;export $DISPLAY

之后我在root的一个窗口执行xclock,发现没有clock,之后安装了xorg-x11-apps(yum install xorg-x11-apps),使用root的xclock就可以看到clock了

之后su - oracle还是看不到clock

之后到root窗口echo $DISPLAY发现是:0,所以我在oracle窗口也设置

    DISPLAY=:0;export $DISPLAY

之后就可以正常的图形化安装了


参看文档

https://cloud.tencent.com/info/fccf3d24c14fa4cdb3c5c31ab7a86f6a.html

更改 inventory的目录为/u01/oraInventory

prerequisite checks这里用fix来修复一下

按提示进入root执行脚本,如果有提示,直接按回车。

DBCA建库

输入命令:dbca

默认,一直到typical configuration,选择name为orc,设置密码,下面的name为orclpdb

或者选择advanced configuration,在deployment type选择custom database,在database identification选择orcl和walnut,storage option选择use following for the database storage attribute,在fast recovery option选择两个复选框,在network configuration选择create下面listener1和1521,在configuration options内的sample schemas选择add复选框,在management options选择configure复选框为5500,在user Credentials 选择use the same admin,在creation option勾选所有复选框。

log:/oracle/cfgtoollogs/dbca/orcl

global database name:orcl
system identifier:walnut
server parameter file name:/oracle/oracle12/dbs/spfilewalnut.ora
em database express url:https://localhost:5500/em
设置密码 system Aa1
passwd oracle
sys 可以设置密码
orapwd file=orapwtest password=P@ssw0rd entries=10

安装完成

sqlplus /nolog

conn /as sysdba

select * from v$version;

quit

SYS@orcl> select host_name,version from v$instance;

unzip examples.zip
mv examples/ /oracle
cd /oracle
chown -R oracle:oinstall examples/

./runinstall

rm -r databse/ examples/ 删除安装文件database和example


版权声明:本文为qq_33568065原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。