为客户打造RAC-DG一些遇到的问题汇总

昨日有建立一个客户RAC-DG物理备用数据库,这里的一般过程中再次列举一下,为了不涉及泄露隐私。的主要参数已被替换名称。详细路径也不一致。因为环境的客户端不与本机连接的网络同意,当故障不能削减各种报警日志和trace主题文件。顾大致写出。

1.主库在线改动spfile參数

alter database force logging;

alter system set log_archive_config='DG_CONFIG=(dg,dgdg)';
alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dg';
alter system set log_archive_dest_2='SERVICE=dgdg LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dgdg';
alter system set log_archive_dest_state_1='ENABLE';
alter system set log_archive_dest_state_2='ENABLE';
alter system set standby_file_management='AUTO';

alter system set fal_server='DGDG';

需重新启动參数:

alter system set db_file_name_convert='C:\app\administrator\oradata\dg','+data/dg/datafile' scope=spfile;
alter system set log_file_name_convert='C:\app\administrator\oradata\dg','+data/dg/onlinelog' scope=spfile;



2.创建pfile

SQL> create pfile from spfile;



3.改动备库用的pfile

*.__db_cache_size=0

*.__java_pool_size=0
*.__large_pool_size=0
*.__oracle_base='C:\app\administrator'#ORACLE_BASE set from environment
*.__pga_aggregate_target=0
*.__sga_target=0
*.__shared_io_pool_size=0
*.__shared_pool_size=0
*.__streams_pool_size=0
*.audit_file_dest='C:\app\administrator\admin\dg\adump'
*.audit_trail='db'
*.cluster_database=false --说明是单实例数据库,否则启动会报错
*.compatible='11.2.0.0.0'
*.control_files='C:\app\administrator\oradata\dg\control01.ctl','C:\app\administrator\oradata\dg\control02.ctl'
*.db_block_size=8192
*.db_create_file_dest='C:\app\administrator\oradata'
*.db_domain=''
*.db_name='dg'
*.db_recovery_file_dest='C:\app\administrator\flash_recovery_area'
*.db_recovery_file_dest_size=3908042752
*.diagnostic_dest='C:\app\administrator'
*.dispadghers='(PROTOCOL=TCP) (SERVICE=DGXDB)'
*.fal_server='dg'
*.instance_number=1
*.log_archive_config='DG_CONFIG=(dg,dgdg)'
*.log_archive_dest_1='LOCATION=c:\archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dgdg'
*.log_archive_dest_2='SERVICE=dg LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dg'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='ARC%S_%R.%T'
*.memory_target=8577351680
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='exclusive'
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.db_file_name_convert='+data/dg/datafile','C:\app\administrator\oradata\dg'
*.log_file_name_convert='+data/dg/onlinelog','C:\app\administrator\oradata\dg'
*.db_unique_name=dgdg --复制过来的pfile假设不设置这个參数。默认的值是dg


4.改动tnsnamesl.ora

# tnsnames.ora Network Configuration File: C:\app\administrator\product\11.2.0\dbhome_1\network\admin\tnsnames.ora

# Generated by Oracle configuration tools.


dg =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dg-cluster-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dg)
    )
  )


DGDG =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = dgP)(HOST = dgdg)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = dg)
    )
  )


5.改动listener.ora(仅仅给备库用,主库能够不配置静态监听)

# listener.ora Network Configuration File: C:\app\administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.


SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = dg)
      (ORACLE_HOME = C:\app\administrator\product\11.2.0\dbhome_1)
      (SID_NAME = dg)
    )
  )


LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dgdg)(PORT = 1521))
  )


ADR_BASE_LISTENER = C:\app\administrator\product\11.2.0\dbhome_1\log


  

6.备库创建相关文件夹

c:\archivelog --指定一个本地归档路径,备库接收到的归档日志和自己生成的归档日志都放在这里
c:\app\administrator\admin\dg\adump
c:\app\administrator\admin\dg\dpdump
c:\app\administrator\admin\dg\hdump
c:\app\administrator\admin\dg\pfile
c:\app\administrator\flash_recovery_area
c:\app\administrator\oradata\dg


7.主库做rman全备

RMAN> backup as compressed backupset full database format 'c:\bak\full_%d_%I_%T_%U'


8.主库创建备库控制文件

SQL> alter database create standby controlfile as 'c:\control01.ctl';
SQL> alter database create standby controlfile as 'c:\control02.ctl';


9.复制备份文件、password文件、pfile文件、tnsnames.ora、listener.ora到备库对应位置


10.备库创建实例

oradim -new -sid dg -startmode manual -spfile;


11.启动监听

lsntrctl start


12.启动实例到mount

set oracle_sid=dg
sqlplus / as sysdba
SQL> startup mount


13.恢复数据库

RMAN> catalog start with 'd:\bak'; --不指定会提示无法恢复数据库
RMAN> restore database;


14.备库加入standby redo logfile

SQL> alter database add standby logfile 'C:\app\administrator\oradata\dg\std_05.log' size 50m;
SQL> alter database add standby logfile 'C:\app\administrator\oradata\dg\std_06.log' size 50m;
SQL> alter database add standby logfile 'C:\app\administrator\oradata\dg\std_07.log' size 50m;
SQL> alter database add standby logfile 'C:\app\administrator\oradata\dg\std_08.log' size 50m;
SQL> alter database add standby logfile 'C:\app\administrator\oradata\dg\std_09.log' size 50m;


15.启用redo apply

SQL> alter database recover managed standby database disconnect from session;


16.给备库创建spfile(可选)

SQL> create spfile from pfile;


以下记录几个在整个配置过程中遇到的问题:


1.用opatch apply命令无法打patch

出现原因:11.2.0.3默认装完后的opatch版本号是11.2.0.1.7,我要打的patch 27须要在这个版本号之上才干够

解决方法:解压高版本号的opatch安装包后覆盖原opatch文件夹



2.备库alert.log报警提示无法找到控制文件自己主动备份路径

出现原因:RAC主库之前部署过自己主动RMAN备份脚本,指定了控制文件自己主动备份路径。但备库并没有此路径

解决方法:进入RMAN,改动该项參数为备库存在的文件夹


3.參数设置错误而引起GAP,导致自己主动备份脚本停止执行


出现原因:之前在设置參数时,把主库的log_archive_dest_1參数设置了本地路径归档,如:
alter system set log_archive_dest_1='LOCATION=C:\archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dg';

作为RAC。归档路径在本地的话。其它节点就无法读取。发现后又一次设置为USE_DB_RECOVERY_FILE_DEST后,那些在本地的归档日志就成为GAP而无法传递到备库

解决方法:手工复制全部提示缺失的xxx归档到指定位置,再手动运行RMAN自己主动备份脚本


说明:因为RMAN自己主动备份脚本里配置了冗余7份,而之搭建DG时手动运行了全库备份,这些手动备份也是算在7份冗余之内的,为了不占用正常备份的配额。DG搭建完毕后建议物理删除。然后再crossecheck并清理掉


4.主、备库的alert.log常常会出现TNS错误

fatal NI connect error 12547


TNS-12547 TNS : 丢失连接
ns secondary err code : 12560
ns main err code : 517


TNS-00517 TNS : 丢失连接
nt secondary err code : 54
nt OS err code : 0


出现原因:节点2没有配置tnsnames.ora,造成thread 2的归档日志无法传递到备库,同一时候也会造成主库日志能传递过去,但无法应用。

解决方法: 把节点1的tnsnames.ora直接复制一个到节点2


说明:事实上这个也是造成备库应用出现GAP的最大原因,因为节点2日志传递不到备库,尽管之前的几个归档日志序列对应的applied列的属性值都是YES,可是会造成节点1的日志也不应用,哪怕在节点1切了非常多次归档。applied列始终会显示NO,但日志都是能够正常传递过去的







版权声明:本文博主原创文章,博客,未经同意不得转载。

posted @ 2015-09-14 13:04  hrhguanli  阅读(339)  评论(0编辑  收藏  举报