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的时刻到了...