温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

ORACLE 10GR2 DATAGUARD ON RHEL 6

发布时间:2020-07-20 03:20:59 来源:网络 阅读:402 作者:扫地僧void 栏目:关系型数据库

1、OS安装Red Hat Enterprise Linux Server release 6.4 (Santiago)
64位
IP:10.56.1.204 10.55.1.204

2、安装oracle 10Gr2所需rpm包
配置本地yum源,使用系统盘中的yum仓库即可
相关包安装
yum -y install binutils compat-libstdc++-33 compat-libstdc++-33.i686 elfutils-libel
f elfutils-libelf-devel gcc gcc-c++ glibc glibc.i686 glibc-common glibc-devel glibc-devel.i686 glibc-headers ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel make sysstat
yum -y install libXp
yum -y install libXp.so.6
yum -y install libXt.i686 libXtst.i686

oracle安装参考文档
可参考文档:
http://www.cnblogs.com/mchina/archive/2013/03/08/2934473.html

3、创建用户及目录
~ ]# groupadd dba
 ~]# groupadd oinstall
 ~]# useradd oracle -g oinstall -G dba
 ~]# passwd oracle
 ~]# mkdir /u01/product/10.2.0/db_1 -p
 ~]# chown -R oracle.oinstall /u01
 ~]# mkdir /oradata
 ~]# chown -R oracle.oinstall /oradata/

4、设定相关内核参数及环境变量
~]# su - oracle
~]$ vim .bash_profile
unset USERNAME

umask 022
ORACLE_BASE=/u01; export ORACLE_BASE
ORACLE_HOME=/u01/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=wip; export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin; export PATH

~]$ bash .bash_profile
~]$ echo $ORACLE_HOME
/u01/product/10.2.0/db_1
~]$ echo $ORACLE_BASE
/u01

root
vim /etc/sysctl.conf
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 16000000000

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4194304
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144

~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.shmmax = 16000000000
kernel.shmall = 4194304
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144

vim /etc/security/limits.conf
#use by oracle
oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536

vim /etc/pam.d/login
#use by oracle
session    required     /lib/security/pam_limits.so

修改release文件
~]# vim /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 8)


5、oracle软件安装
解压文件
gunzip 10201_database_linux_x86_64.cpio.gz
cpio -idmv <10201_database_linux_x86_64.cpio
unzip p8202632_10205_Linux-x86-64.zip

xhost+进行图形化安装10g和10205patch


6、nsf挂载文件系统至主库,主库进行备份,备库还原
[root@DataGuard ~]# vi /etc/exports
[root@DataGuard ~]# cat /etc/exports
/mnt/rman 10.55.1.201(rw)
[root@DataGuard ~]# mkdir /mnt/rman -p
[root@DataGuard ~]# service nfs start
[root@DataGuard ~]# chown -R oracle.oinstall /mnt
[root@DataGuard ~]# chmod 777 /mnt
主库进行挂载
[root@LCM3RAC1 ~]# service portmap start
Starting portmap:                                          [  OK  ]
[root@LCM3RAC1 ~]# mount -t nfs 10.55.1.204:/mnt/rman /mnt/rman

主库进行备份至挂载文件内
rman target/
RMAN>backup database format '/mnt/rman/%d_FULL_%T_%u_%p_%c';

主库创建pfile,密码文件
[oracle@LCM3RAC1 rman]$ orapwd file=orapwwip password=oracle entries=5
[oracle@LCM3RAC1 rman]$ ls
orapwwip  test  WIP_FULL_20170109_0vrpjknq_1_1
[oracle@LCM3RAC1 rman]$ slqplus / as sysdba
-bash: slqplus: command not found
[oracle@LCM3RAC1 rman]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Mon Jan 9 14:57:08 2017

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> create pfile='/mnt/rman/initorcl.ora' from spfile;

File created.

pfile文件:
wip1.__db_cache_size=6358564864
wip3.__db_cache_size=3036676096
wip2.__db_cache_size=6392119296
wip3.__java_pool_size=16777216
wip2.__java_pool_size=16777216
wip1.__java_pool_size=16777216
wip3.__large_pool_size=16777216
wip2.__large_pool_size=16777216
wip1.__large_pool_size=16777216
wip1.__shared_pool_size=2164260864
wip3.__shared_pool_size=1191182336
wip2.__shared_pool_size=2130706432
wip3.__streams_pool_size=16777216
wip2.__streams_pool_size=16777216
wip1.__streams_pool_size=16777216
*._undo_autotune=FALSE
*.audit_file_dest='/u01/admin/wip/adump'
*.background_dump_dest='/u01/admin/wip/bdump'
*.cluster_database_instances=3
*.cluster_database=true
*.compatible='10.2.0.5.0'
*.control_files='/oradata/wip/control01.ctl','/oradata/wip/control02.ctl','/oradata/wip/control03.ctl'
*.core_dump_dest='/u01/admin/wip/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='wip'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=wipXDB)'
*.fal_client='STANDBY'
*.fal_server='WIP1','WIP2','WIP3'
wip1.instance_number=1
wip3.instance_number=3
wip2.instance_number=2
*.job_queue_processes=10
wip1.local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = 10.56.1.101)(PORT = 1521))'
wip2.local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = 10.56.1.102)(PORT = 1521))'
wip3.local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = 10.56.1.103)(PORT = 1521))'
*.log_archive_dest_1='location=/oradata/archivelog'
*.log_archive_dest_2='service=standby optional reopen=60'
*.log_archive_dest_state_2='DEFER'
*.open_cursors=2000
*.pga_aggregate_target=1671430144
wip1.pga_aggregate_target=3221225472
wip2.pga_aggregate_target=3221225472
wip3.pga_aggregate_target=1572864000
*.processes=2000
*.remote_listener='LISTENERS_WIP'
*.remote_login_passwordfile='exclusive'
wip1.sga_max_size=8589934592
wip2.sga_max_size=8589934592
wip3.sga_max_size=4294967296
*.sga_target=1610612736
wip1.sga_target=8589934592
wip2.sga_target=8589934592
wip3.sga_target=4294967296
*.standby_file_management='AUTO'
wip2.thread=2
wip3.thread=3
wip1.thread=1
*.undo_management='AUTO'
*.undo_retention=10800
wip2.undo_tablespace='UNDOTBS2'
wip3.undo_tablespace='UNDOTBS3'
wip1.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/admin/wip/udump'

根据pfile文件在备库中创建相应文件夹
[oracle@DataGuard ~]$ mkdir /u01/admin/wip/{adump,bdump,cdump,udump} -pv
mkdir: created directory `/u01/admin'
mkdir: created directory `/u01/admin/wip'
mkdir: created directory `/u01/admin/wip/adump'
mkdir: created directory `/u01/admin/wip/bdump'
mkdir: created directory `/u01/admin/wip/cdump'
mkdir: created directory `/u01/admin/wip/udump'
[oracle@DataGuard ~]$ mkdir /oradata/archivelog -pv
mkdir: created directory `/oradata/archivelog'

修改pfile参数文件
wip.__db_cache_size=6358564864
wip.__java_pool_size=16777216
wip.__large_pool_size=16777216
wip.__shared_pool_size=620756992
wip.__streams_pool_size=0
*.audit_file_dest='/u01/admin/wip/adump'
*.background_dump_dest='/u01/admin/wip/bdump'
*.cluster_database=false
*.compatible='10.2.0.5.0'
*.control_files='/oradata/wip/control01.ctl','/oradata/wip/control02.ctl','/oradata/wip/control03.ctl'
*.core_dump_dest='/u01/admin/wip/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='wip'
*.db_unique_name='wip'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=wipXDB)'
*.fal_client='standby'
*.fal_server='wip1','wip2','wip3'
*.instance_name='wip'
*.job_queue_processes=10
*.log_archive_dest_1='location=/oradata/archivelog'
*.open_cursors=2000
*.pga_aggregate_target=1671430144
*.processes=2000
*.remote_login_passwordfile='exclusive'
*.sga_max_size=3238002688
*.sga_target=3238002688
*.standby_file_management='AUTO'
*.thread=1
*.undo_management='AUTO'
*.undo_retention=10800


配置备库监听和tns,listener.ora/tnsnames.ora
主机监听
# listener.ora.lcm3rac1 Network Configuration File: /u01/product/10.2.0/db_1/network/admin
/listener.ora.lcm3rac1# Generated by Oracle configuration tools.
INBOUND_CONNECT_TIMEOUT_LISTENER_LCM3RAC1 = 0
LISTENER_LCM3RAC1 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = lcm3rac1-vip)(PORT = 1521)(IP = FIRST))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 10.56.1.201)(PORT = 1521)(IP = FIRST))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
      )
    )
  )

备库监听
# listener.ora Network Configuration File: /u01/product/10.2.0/db_1/network/admin/listener
.ora# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = DataGuard)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )

tns
# tnsnames.ora Network Configuration File: /u01/product/10.2.0/db_1/network/admin/tnsnames
.ora# Generated by Oracle configuration tools.

WIP =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = lcm3rac1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = lcm3rac2-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = lcm3rac3-vip)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = wip)
    )
  )

WIP3 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = lcm3rac3-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = wip)
      (INSTANCE_NAME = wip3)
    )
  )

WIP2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = lcm3rac2-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = wip)
      (INSTANCE_NAME = wip2)
    )
  )

WIP1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = lcm3rac1-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = wip)
      (INSTANCE_NAME = wip1)
    )
  )

LISTENERS_WIP =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = lcm3rac1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = lcm3rac2-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = lcm3rac3-vip)(PORT = 1521))
  )


OTHERWIP =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = lcm3rac1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = lcm3rac2-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = lcm3rac3-vip)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = wip)
    )
  )

STANDBY =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.54.2.3)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = wip)
    )
  )

lcm2wip =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.54.2.1)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.54.2.2)(PORT = 1521))
    (LOAD_BALANCE = on)
    (FAILOVER = on)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = wip)
      (FAILOVER_MODE=
        (TYPE=select)
        (method=basic)
        (retries = 200)
        (delay = 5)
      )
    )
  )

lcm1his =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.54.2.5)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = history)
    )
  )

lcm2his =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.52.2.5)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = history)
    )
  )

HISTORY =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.56.1.164)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = history)
    )
  )


OTHERHIS =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.56.1.164)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = history)
    )
  )

report =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.53.10.16)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = wuinterdb)
    )
  )

INTEGRATE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST =10.11.0.69)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = integrate.cptt)
    )
  )

INTEGRATE_PRD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST =10.48.0.117)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = ltwb07)
    )
  )

#for db link
lcm1WIP =
  (DESCRIPTION =
    (ADDRESS_LIST =    
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.52.1.101 )(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.52.1.102)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.52.1.103)(PORT = 1521))
      (LOAD_BALANCE = yes)
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = wip)
      (FAILOVER_MODE =
        (TYPE = select)
        (method = basic)
        (retries = 200)
        (delay = 5)
      )
    )
  )

本地host文件加解析
/etc/hosts
10.56.1.204 DataGuard

待备份完成后,手动进行几次归档后创建controlfile,拷贝至备库
SQL> alter system archive log current;

System altered.
SQL> alter database create standby controlfile as '/tmp/control01.ctl';

Database altered.

[oracle@DataGuard rman]$ mkdir -p /oradata/wip
[oracle@DataGuard rman]$ cp control01.ctl /oradata/wip/control01.ctl
[oracle@DataGuard rman]$ cp control01.ctl /oradata/wip/control02.ctl
[oracle@DataGuard rman]$ cp control01.ctl /oradata/wip/control03.ctl


复制密码文件
cp orapwwip /u01/product/10.2.0/db_1/dbs/

备库通过pfile启动到nomount状态,根据pfile创建spfile
[oracle@DataGuard rman]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Mon Jan 9 17:47:38 2017

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup nomount pfile='/mnt/rman/initorcl.ora'
ORACLE instance started.

Total System Global Area 3238002688 bytes
Fixed Size            2099784 bytes
Variable Size          654312888 bytes
Database Buffers     2566914048 bytes
Redo Buffers           14675968 bytes
SQL> create spfile from  pfile='/mnt/rman/initorcl.ora';

File created.

SQL>


将数据库启动至mount状态
SQL> alter database mount;

Database altered.

通过rman恢复数据库至备库
[oracle@DataGuard rman]$ rman target/

Recovery Manager: Release 10.2.0.5.0 - Production on Mon Jan 9 17:54:35 2017

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: WIP (DBID=277772385, not open)

RMAN> restore database;

主库修改对于standby的tns地址

将主库的archivelog拷贝至备库
scp *.dbf root@10.55.1.204:/oradata/archivelog/

备库开启监听
[root@DataGuard archivelog]# su - oracle
[oracle@DataGuard ~]$ lsnrctl start

备库recover主库拷贝过来的archivelog
[oracle@DataGuard ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Mon Jan 9 20:19:07 2017

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> recover standby database using backup controlfile until cancel;
ORA-00279: change 13449706423844 generated at 01/09/2017 14:51:38 needed for
thread 1
ORA-00289: suggestion : /oradata/archivelog/1_24855_751423971.dbf
ORA-00280: change 13449706423844 for thread 1 is in sequence #24855


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
AUTO
ORA-00279: change 13449706423844 generated at 01/09/2017 10:39:34 needed for
thread 2
ORA-00289: suggestion : /oradata/archivelog/2_14209_751423971.dbf
ORA-00280: change 13449706423844 for thread 2 is in sequence #14209


ORA-00279: change 13449706423844 generated at 01/09/2017 13:45:09 needed for
thread 3
ORA-00289: suggestion : /oradata/archivelog/3_13732_751423971.dbf
ORA-00280: change 13449706423844 for thread 3 is in sequence #13732


ORA-00279: change 13449706456434 generated at 01/09/2017 15:00:13 needed for
thread 2
ORA-00289: suggestion : /oradata/archivelog/2_14210_751423971.dbf
ORA-00280: change 13449706456434 for thread 2 is in sequence #14210
ORA-00278: log file '/oradata/archivelog/2_14209_751423971.dbf' no longer
needed for this recovery


ORA-00279: change 13449708067563 generated at 01/09/2017 16:23:20 needed for
thread 3
ORA-00289: suggestion : /oradata/archivelog/3_13733_751423971.dbf
ORA-00280: change 13449708067563 for thread 3 is in sequence #13733
ORA-00278: log file '/oradata/archivelog/3_13732_751423971.dbf' no longer
needed for this recovery


ORA-00279: change 13449708406961 generated at 01/09/2017 16:57:01 needed for
thread 1
ORA-00289: suggestion : /oradata/archivelog/1_24856_751423971.dbf
ORA-00280: change 13449708406961 for thread 1 is in sequence #24856
ORA-00278: log file '/oradata/archivelog/1_24855_751423971.dbf' no longer
needed for this recovery


ORA-00279: change 13449709361975 generated at 01/09/2017 17:29:34 needed for
thread 1
ORA-00289: suggestion : /oradata/archivelog/1_24857_751423971.dbf
ORA-00280: change 13449709361975 for thread 1 is in sequence #24857
ORA-00278: log file '/oradata/archivelog/1_24856_751423971.dbf' no longer
needed for this recovery


ORA-00279: change 13449709362031 generated at 01/09/2017 17:29:37 needed for
thread 3
ORA-00289: suggestion : /oradata/archivelog/3_13734_751423971.dbf
ORA-00280: change 13449709362031 for thread 3 is in sequence #13734
ORA-00278: log file '/oradata/archivelog/3_13733_751423971.dbf' no longer
needed for this recovery


ORA-00279: change 13449709362034 generated at 01/09/2017 17:29:37 needed for
thread 2
ORA-00289: suggestion : /oradata/archivelog/2_14211_751423971.dbf
ORA-00280: change 13449709362034 for thread 2 is in sequence #14211
ORA-00278: log file '/oradata/archivelog/2_14210_751423971.dbf' no longer
needed for this recovery


ORA-00279: change 13449709411751 generated at 01/09/2017 17:30:51 needed for
thread 2
ORA-00289: suggestion : /oradata/archivelog/2_14212_751423971.dbf
ORA-00280: change 13449709411751 for thread 2 is in sequence #14212
ORA-00278: log file '/oradata/archivelog/2_14211_751423971.dbf' no longer
needed for this recovery


ORA-00279: change 13449709411858 generated at 01/09/2017 17:30:52 needed for
thread 3
ORA-00289: suggestion : /oradata/archivelog/3_13735_751423971.dbf
ORA-00280: change 13449709411858 for thread 3 is in sequence #13735
ORA-00278: log file '/oradata/archivelog/3_13734_751423971.dbf' no longer
needed for this recovery


ORA-00279: change 13449709411887 generated at 01/09/2017 17:30:52 needed for
thread 1
ORA-00289: suggestion : /oradata/archivelog/1_24858_751423971.dbf
ORA-00280: change 13449709411887 for thread 1 is in sequence #24858
ORA-00278: log file '/oradata/archivelog/1_24857_751423971.dbf' no longer
needed for this recovery


ORA-00279: change 13449709412924 generated at 01/09/2017 17:31:19 needed for
thread 1
ORA-00289: suggestion : /oradata/archivelog/1_24859_751423971.dbf
ORA-00280: change 13449709412924 for thread 1 is in sequence #24859
ORA-00278: log file '/oradata/archivelog/1_24858_751423971.dbf' no longer
needed for this recovery


ORA-00308: cannot open archived log '/oradata/archivelog/1_24859_751423971.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3


ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/oradata/wip/system01.dbf'


同步日志
SQL> recover managed standby database disconnect from session;
Media recovery complete.

关闭数据库并进行备库开启
startup nomount;
alter database mount standby database;
alter database recover managed standby database disconnect from session;     开启MRP


7、查看应用是否正常
确认同步:备库执行 RFS远程文件接收进程 MRP0日志应用进程
SQL> select process,status from v$managed_standby;
SQL> /

PROCESS   STATUS
--------- ------------
ARCH      CONNECTED
ARCH      CONNECTED
MRP0      APPLYING_LOG
RFS      IDLE
RFS      IDLE
RFS      IDLE

6 rows selected.

SQL> /

PROCESS   STATUS
--------- ------------
ARCH      CONNECTED
ARCH      CONNECTED
MRP0      WAIT_FOR_LOG
RFS      IDLE
RFS      IDLE
RFS      IDLE

SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

 SEQUENCE# APP
---------- ---
     13735 YES
     13736 YES
     13737 YES
     13738 YES
     13739 YES
     13740 YES
     13741 YES
     14212 YES
     14213 YES
     14214 YES
     14215 YES

 SEQUENCE# APP
---------- ---
     14216 YES
     14217 YES
     14218 NO
     24859 YES
     24860 YES
     24861 YES
     24862 NO

18 rows selected.

SQL> select message from v$dataguard_status;

MESSAGE
--------------------------------------------------------------------------------
ARC0: Archival started
ARC1: Archival started
ARC0: Becoming the 'no FAL' ARCH
ARC0: Becoming the 'no SRL' ARCH
ARC1: Becoming the heartbeat ARCH
Attempt to start background Managed Standby Recovery process
MRP0: Background Managed Standby Recovery process started
Managed Standby Recovery not using Real Time Apply
Clearing online redo logfile 1 /oradata/wip/redo01.log
Clearing online redo logfile 1 complete
Media Recovery Waiting for thread 1 sequence 24859

MESSAGE
--------------------------------------------------------------------------------
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[1]: Assigned to RFS process 23716
RFS[1]: Identified database type as 'physical standby'
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[2]: Assigned to RFS process 23718
RFS[2]: Identified database type as 'physical standby'
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[3]: Assigned to RFS process 23720

MESSAGE
--------------------------------------------------------------------------------
RFS[3]: Identified database type as 'physical standby'
Media Recovery Log /oradata/archivelog/1_24859_751423971.dbf
Media Recovery Waiting for thread 2 sequence 14212
Fetching gap sequence in thread 2, gap sequence 14212-14212
Error 12545 received logging on to the standby
FAL[client, MRP0]: Error 12545 connecting to wip1 for fetching gap sequence
Error 12545 received logging on to the standby
FAL[client, MRP0]: Error 12545 connecting to wip1 for fetching gap sequence
Media Recovery Log /oradata/archivelog/2_14212_751423971.dbf
Media Recovery Waiting for thread 3 sequence 13735
Fetching gap sequence in thread 3, gap sequence 13735-13735

MESSAGE
--------------------------------------------------------------------------------
Error 12545 received logging on to the standby
FAL[client, MRP0]: Error 12545 connecting to wip1 for fetching gap sequence
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[4]: Assigned to RFS process 23729
RFS[4]: Identified database type as 'physical standby'
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[5]: Assigned to RFS process 23731
RFS[5]: Identified database type as 'physical standby'
Error 12545 received logging on to the standby

MESSAGE
--------------------------------------------------------------------------------
FAL[client, MRP0]: Error 12545 connecting to wip1 for fetching gap sequence
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[6]: Assigned to RFS process 23734
RFS[6]: Identified database type as 'physical standby'
Media Recovery Log /oradata/archivelog/3_13735_751423971.dbf
Media Recovery Log /oradata/archivelog/2_14213_751423971.dbf
Media Recovery Log /oradata/archivelog/3_13736_751423971.dbf
Media Recovery Waiting for thread 1 sequence 24860
Media Recovery Log /oradata/archivelog/1_24860_751423971.dbf
Media Recovery Log /oradata/archivelog/2_14214_751423971.dbf

MESSAGE
--------------------------------------------------------------------------------
Media Recovery Log /oradata/archivelog/3_13737_751423971.dbf
Media Recovery Waiting for thread 2 sequence 14215
Media Recovery Log /oradata/archivelog/2_14215_751423971.dbf
Media Recovery Waiting for thread 3 sequence 13738
Media Recovery Log /oradata/archivelog/3_13738_751423971.dbf
Media Recovery Waiting for thread 1 sequence 24861
Media Recovery Log /oradata/archivelog/1_24861_751423971.dbf
Media Recovery Log /oradata/archivelog/2_14216_751423971.dbf
Media Recovery Log /oradata/archivelog/3_13739_751423971.dbf
Media Recovery Log /oradata/archivelog/3_13740_751423971.dbf
Media Recovery Waiting for thread 2 sequence 14217

MESSAGE
--------------------------------------------------------------------------------
Media Recovery Log /oradata/archivelog/2_14217_751423971.dbf
Media Recovery Waiting for thread 3 sequence 13741
Media Recovery Log /oradata/archivelog/3_13741_751423971.dbf
Media Recovery Waiting for thread 1 sequence 24862
Media Recovery Log /oradata/archivelog/1_24862_751423971.dbf
Media Recovery Waiting for thread 2 sequence 14218
Media Recovery Log /oradata/archivelog/2_14218_751423971.dbf
Media Recovery Waiting for thread 3 sequence 13742

74 rows selected.

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE


8、开启备份,制定备份计划

对时脚本添加
[root@DataGuard ~]# crontab -l
#time
15 8 * * * /usr/sbin/ntpdate 10.53.1.9 &>/dev/null

备份脚本
#dbbackup
20 0 * * * /OCS/script/removebackup.sh
15 4 * * * /OCS/script/rman.sql
16 8 * * * /OCS/script/removearchive.sh
[root@DataGuard script]# cat removearchive.sh
/usr/bin/find /oradata/archivelog -name '*.dbf' -mtime +6 > /OCS/script/rmlog
for i in `/bin/cat /OCS/script/rmlog`
do
/bin/rm -f $i
done

[root@DataGuard script]# cat removebackup.sh
#/bin/ls
#/bin/rm
/usr/bin/find /mnt/rman -name 'oradb1*' > /OCS/script/rmlog
for i in `/bin/cat /OCS/script/rmlog`
do
/bin/rm -rf $i
done

[root@DataGuard script]# cat rman.sql
su - oracle <<EOF
export ORACLE_SID=wip
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
sqlplus /nolog @/OCS/script/switch2.sql
rman target / @/OCS/script/rman_full_backup.sql >>/mnt/rman/log/RmanBackup_`date +%y%m%d`.log
/bin/mv /mnt/rman/oradb /mnt/rman/oradb`date +%y%m%d`
/bin/mkdir -p /mnt/rman/oradb
sqlplus /nolog @/OCS/script/switch3.sql
exit
EOF

[root@DataGuard script]# cat rman_full_backup.sql
run{
sql 'alter database backup controlfile to trace';
backup database tag 'FULL' filesperset 1 format '/mnt/rman/oradb/%d_Full_%T_%u_%p_%c';
crosscheck archivelog all;
delete noprompt expired archivelog all;
crosscheck backup;
delete noprompt expired backup;
backup archivelog all filesperset 5 format '/mnt/rman/oradb/%d_LOG_%T_%u_%p_%c';
delete archivelog until time 'sysdate-7';
#backup filesperset 20 format 'al_%s_%p_%t' archivelog all delete input;
copy current controlfile to '/mnt/rman/oradb/CON_BACKUP.CTL';
delete noprompt obsolete;
}
exit

[root@DataGuard script]# cat switch2.sql
connect / as sysdba
alter database recover managed standby database cancel ;
alter database open read only ;
exit
[root@DataGuard script]# cat switch3.sql
connect / as sysdba
alter database recover managed standby database disconnect from session ;
exit

安装CA软件的agent,进行磁带备份



向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI