Oracle11g-linux安裝

一、檢查交換空間linux

用fdisk命令(例:# fdisk /dev/sdb)對磁盤進行分區,添加swap分區,新建分區,在fdisk中用「t」命令將新添的分區id改成82(Linux swap類型),最後用w將操做實際寫入硬盤(沒用w以前的操做是無效的)。c++

 # mkswap /dev/xvde2 #格式化swap分區,這裏的sdb2要看您加完後p命令顯示的實際分區設備名數據庫

 # swapon /dev/xvde2 #啓動新的swap分區vim

 爲了讓系統啓動時能自動啓用這個交換分區,能夠編輯/etc/fstab,加入下面一行安全

/dev/xvde2               swap                   swap    defaults        0 00bash

mkfs.ext4 /dev/tianyiyun/etfssession

磁盤掛載: 磁盤使用fdisk 命令分區以後,選擇須要使用的分區 經過 mkfs.ext4 /dev/xvde1    來格式化該分區,oracle

而後使用命令 blkid   查看分區後的UUIDapp

複製對應的UUID使用vim  /etc/fstab 命令編輯  /etc/fstab   來加入下行設置磁盤的永久掛載點(本例掛載到 /app 目錄)ide

UUID=xxxxxxxxxxxxxxx  /app  ext4 defaults  00

二、修改主機名禁用防火牆

  vim /etc/sysconfig/network

  vim /etc/hosts

  sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config  

  setenforce 0

  chkconfig iptables off

  service iptables stop

  service iptables status

三、檢查依賴包

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \

elfutils-libelf \

elfutils-libelf-devel \

gcc \

gcc-c++ \

glibc \

glibc-common \

glibc-devel \

glibc-headers \

libaio \

libaio-devel \

libgcc \

libstdc++ \

libstdc++-devel \

make \

sysstat \

unixODBC \

unixODBC-devel

四、根據缺乏的安裝依賴包

----其中pdksh依賴包沒法經過yum 在線安裝,須要下載它的rpm 包 使用 rpm方式安裝

yum -y install gcc gcc-c++ make binutils compat-libstdc++-33 elfutils-libelf \

elfutils-libelf-devel glibc glibc-common glibc-devel \

libaio libaio-devel libgcc libstdc++ libstdc++-devel \

unixODBC unixODBC-devel

 

rpm -e ksh-20120801-35.el6_9.x86_64

rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm

yum -y install glibc*.i686*

yum -y install compat-libstdc++*x86*64*

yum -y install elfutils-libelf-devel

yum -y install libaio-devel

yum -y install  elfutils-libelf-devel

yum -y install libaio-devel

yum -y install unixODBC

yum -y install unixODBC-devel

五、設置操做系統參數

vim /etc/sysctl.conf

net.ipv4.ip_local_port_range= 9000 65500  

fs.aio-max-nr = 1048576  

fs.file-max = 6815744  

kernel.shmall = 10523004  

kernel.shmmax = 6465333657  

kernel.shmmni = 4096  

kernel.sem = 250 32000 100 128  

net.core.rmem_default=262144  

net.core.wmem_default=262144  

net.core.rmem_max=4194304  

net.core.wmem_max=1048576

sysctl -p                        ---檢查配置是否有報錯

/sbin/sysctl -a   確認全部值已修改好

六、設置操做系統資源限制配置

vim /etc/security/limits.conf

 

oracle soft nproc 2047  

oracle hard nproc 16384  

oracle soft nofile 4096  

oracle hard nofile 65536  

 

grid soft nproc 2047  

grid hard nproc 16384  

grid soft nofile 1024  

grid hard nofile 65536

 

七、在namespace 下面加入這三行

vim /etc/pam.d/login

 

session    required    /lib64/security/pam_limits.so

session    required    /lib/security/pam_limits.so

session    required    pam_limits.so

 

八、添加oracle用戶分配用戶組

 groupadd oinstall

 groupadd dba

 groupadd oper

 useradd -u600 -g oinstall oracle

 usermod -G dba,oper oracle

 id oracle

 passwd oracle

 

九、建立oracle主目錄,分配給oracle用戶相應權限

 mkdir /oracle/u01

 mkdir /oracle/u02

 chown -R oracle:oinstall /oracle/u01

 chown -R oracle:oinstall /oracle/u02

 su oracle

 mkdir -p /oracle/u01/app/oracle/product/11.2.0/dbhome_1

 mkdir -p /oracle/u02/oradata

 mkdir -p /oracle/u02/oradata/oracledb

 

十、以oracle用戶登陸:設置環境變量

vim ~/.bash_profile

 

ORACLE_BASE=/oracle/u01/app/oracle;

export ORACLE_BASE  

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1;

export ORACLE_HOME  

LD_LIBRARY_PATH=$ORACLE_HOME/lib;

export LD_LIBRARY_PATH  

ORACLE_SID=oracledb; export ORACLE_SID  

ORA_NLS33=$ORACLE_HOME/nls/admin/data;

export ORA_NLS33  

NLS_LANG=american_america.zhs16gbk;

export NLS_LANG  

PATH=$ORACLE_HOME/bin:$PATH;

export PATH

 

source ~/.bash_profile             ----使剛配置的環境變量生效

 

十一、安裝桌面

runlevel

yum grouplist | more

yum -y groupinstall "desktop" "X Window System"

/etc/inittab文件,修改啓級別爲5,以下圖,而後從新啓動就能夠進入桌面環境了。由於我這是遠程環境的,只是運用了命令行,能夠使用VNC進行桌面環境的遠程。

將    id:3:initdefault:    改成     id:5:initdefault:

 

十二、安裝vnc

yum install tigervnc-server -y

chkconfig vncserver on

vim /etc/sysconfig/vncservers        

su oracle

vncpasswd oracle

vncserver &

 

1三、PLSQL鏈接數據庫時

    首選項配置oci.dll

    機器添加兩個環境變量,名爲TNS_ADMIN,值爲tnsnames.ora文件所在路徑。好比個人本機爲:D:/instantclient_11_2/

    NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

 

 

1四、數據庫基礎配置:

SELECT * FROM dba_profiles s WHERE s.profile='DEFAULT' AND resource_name='PASSWORD_LIFE_TIME';

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

alter system set processes = 5000 scope = spfile;

 

--限制sys用戶不能以普通身份登陸,這個是處於安全審計才須要調整的 你能夠不調

alter system set O7_DICTIONARY_ACCESSIBILITY=false scope=spfile;

 

alter system set remote_login_passwordfile=NONE scope=spfile;

shutdown immediate;

startup;

lsnrctl status

 

1五、建立表空間

alter tablespace P_OA

 add datafile 'P_OA1' size 20480M

 autoextend on next 200M maxsize 30720M

 ----添加表空間P_OA 添加數據文件P_OA1 初始大小20G 每次擴展200M最大擴展到30G

 

1六、建立用戶:

-- Create the user

create user t_pt

  identified by "8888"

  default tablespace P_OA;

-- Grant/Revoke role privileges

grant dba to t_pt with admin option;

grant resource to t_pt with admin option;

grant connect to t_pt with admin option;

-- Create the user

create user t_mflow

  identified by "8888"

  default tablespace P_OA;

-- Grant/Revoke role privileges

grant dba to t_mflow with admin option;

grant resource to t_mflow with admin option;

grant connect to t_mflow with admin option;

 

-- Create the user

create user t_du

  identified by "8888"

  default tablespace P_OA;

-- Grant/Revoke role privileges

grant dba to t_du with admin option;

grant resource to t_du with admin option;

grant connect to t_du with admin option;

 

-- Create the user

create user t_ca

  identified by "8888"

  default tablespace P_OA;

-- Grant/Revoke role privileges

grant dba to t_ca with admin option;

grant resource to t_ca with admin option;

grant connect to t_ca with admin option;

 

-- Create the user

create user t_sys

  identified by "8888"

  default tablespace P_OA;

-- Grant/Revoke role privileges

grant dba to t_sys with admin option;

grant resource to t_sys with admin option;

grant connect to t_sys with admin option;

相關文章
相關標籤/搜索