Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3672868
  • 博文数量: 715
  • 博客积分: 1860
  • 博客等级: 上尉
  • 技术积分: 7745
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-07 08:51
个人简介

偶尔有空上来看看

文章分类

全部博文(715)

文章存档

2023年(75)

2022年(134)

2021年(238)

2020年(115)

2019年(11)

2018年(9)

2017年(9)

2016年(17)

2015年(7)

2014年(4)

2013年(1)

2012年(11)

2011年(27)

2010年(35)

2009年(11)

2008年(11)

分类: Oracle

2020-04-06 19:55:18

vmware默认快捷安装RHEL 7.4 ,没有图形界面。

虚拟机挂载iso
mount -r /dev/sr0 /mnt

配置一个yum源
cat  << EOF >/etc/yum.repos.d/a.repo
[server]
name=ISO
baseurl=file:///mnt
enabled=1
gpgcheck=0
EOF

主机改名,配置IP
hostnamectl --static set-hostname bj1db01
echo "192.168.204.137 bj1db01">> /etc/hosts

修改内核参数
/etc/sysctl.conf
cat << EOF >>/etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967296
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
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
EOF


sysctl -p


cat << EOF >> /etc/security/limits.conf
oracle soft nproc 65536
oracle hard nproc 65536
oracle soft nofile 65536
oracle hard nofile 65536
EOF


echo "session    required     pam_limits.so">>/etc/pam.d/login


systemctl stop firewalld
systemctl disable firewalld
sed -i "s#SELINUX=enforcing#SELINUX=disabled#g" /etc/selinux/config

安装相关包
yum install binutils -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y
yum install zlib-devel -y
yum install elfutils-libelf-devel -y
##
yum install xhost -y
yum install xdpyinfo -y

创建用户、组
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
#groupadd -g 54324 backupdba
#groupadd -g 54325 dgdba
#groupadd -g 54326 kmdba
#groupadd -g 54327 asmdba
#groupadd -g 54328 asmoper
#groupadd -g 54329 asmadmin


useradd -g oinstall -G dba,oper oracle
echo "oracle" | passwd --stdin oracle


mkdir -p /u01/app/oracle/product/11.2.0.4/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01


su - oracle
vi /home/oracle/.bash_profile
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR


#ORACLE_HOSTNAME=ol7.localdomain; export ORACLE_HOSTNAME
#ORACLE_UNQNAME=ORCL; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1; export ORACLE_HOME
ORACLE_SID=ORCL; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH


LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH


export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'
umask 022

上传介质
put /u01/install/p133*.zip
启动Xmanager-passive 

yum -y install xdpyinfo
export DISPLAY=192.168.204.1:0.0

安装软件,建库。

配置DG
alter database force logging;
--设置db_unique_name, log_archive_config(这里主库的db_unique_name,出于对现有的生产环境最小影响考虑没有改)
--alter system set db_unique_name='jingyu' scope=spfile;  
alter system set log_archive_config='DG_CONFIG=(ORCLPRD,ORCLPRDDX)'; 
--归档日志目录
alter system set log_archive_dest_1='LOCATION=/arc VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ORCLPRD';
alter system set log_archive_dest_2='SERVICE=ORCLPRDDX ASYNC LGWR VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ORCLPRDDX';
--归档日志文件命名规则
alter system set log_archive_format='a%r_%t_%s.arc' scope=spfile;
--DG的fal_server和fal_client
alter system set fal_server=ORCLPRDDX;
--设置standby_file_management为自动
alter system set standby_file_management=AUTO; 
--设置备库日志文件组,数量一般为目标库日志文件组+1
alter database add standby logfile group 11 size 50M; 
alter database add standby logfile group 12 size 50M; 
alter database add standby logfile group 13 size 50M; 
alter database add standby logfile group 14 size 50M; 


加一下tnsnames.ora内容
ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.204.137)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCL)
    )
  )


ORCLDG =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.204.139)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCLDG)
    )
  )

listener.ora加静态注册
SID_LIST_LISTENER =
   (SID_LIST =
        (SID_DESC =
          (GLOBAL_DBNAME = ORCL)
          (ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/db_1)
          (SID_NAME = ORCL)   
        )  
    ) 

主备口令文件、tnsnames.ora一致
orapwd file=$ORACLE_HOME/dbs/orapwORCL password=oracle entries=10 ignorecase=Y

主库create pfile from spfile;
根据dg环境修改参数:
db_unique_name
dest_1
dest_2
创建目录

备库启动到startup状态
rman target / auxiliary sys/oracle@orcldg
duplicate target database for standby from active database nofilenamecheck;
见证DG的时刻到了...

阅读(1211) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~