Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

18

积分

1

好友

18

主题
1#
发表于 2014-3-22 11:44:14 | 查看: 5343| 回复: 4
该文档是hunter生产环境实施成功版本,按该文档搭建物理DG高可用环境,没有任何问题!原创文档,禁止转载!
DG架构图:
http://b237.photo.store.qq.com/psb?/V12rSpsx4VU3RK/0iDucMz*ZSn7SZmhSfeIlQ90lwQLtCuTWwXo7kJ2IlE!/b/dH*2So0pEgAA&bo=LgIGAQAAAAABAAw!&su=0138647089&rf=2-9
Standby端:
1、建立相应目录:
mkdir /opt/oracle/oradata/qg_st -p
mkdir /opt/oracle/admin/qg_st –p
mkdir {a,b,c,u,dp}dump
mkdir pfile
mkdir  /opt/oracle/flash_recovery_area/QG_ST –p
2、备库端的密码文件:
   拷贝主库端的密码文件,修改SID。
    scp orapwqg_st root@192.168.1.182: /opt/oracle/product/10g/dbs
3、配置listener和tns:
listener配置:
  (SID_DESC =
      (GLOBAL_DBNAME = qg_st)
      (ORACLE_HOME =  /opt/oracle/product/10g)
      (SID_NAME = qg_st)
      )
tns配置(主备库两端都要配):
qgresearch =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.102)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = research.country)
    )
  )

qg_st =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.182)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = qg_st)
    )
  )
4、准备备库端参数文件(由于目录不一致,需要指定db_file_name_convert、log_file_name_convert和standby_file_management三个初始化参数):
qg_st.__db_cache_size=1509949440
qg_st.__java_pool_size=33554432
qg_st.__large_pool_size=16777216
qg_st.__shared_pool_size=536870912
qg_st.__streams_pool_size=33554432
*.audit_file_dest='/opt/oracle/admin/qg_st/adump'
*.background_dump_dest='/opt/oracle/admin/qg_st/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/opt/oracle/oradata/qg_st/control01.ctl','/opt/oracle/oradata/qg_st/control02.ctl','/opt/oracle/oradata/qg_st/control03.ctl'#Restore Controlfile
*.core_dump_dest='/opt/oracle/admin/qg_st/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_file_name_convert='/u01/oracle/oradata/research/','/opt/oracle/oradata/qg_st/'
*.db_name='research'
*.db_recovery_file_dest='/opt/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=21474836480
*.DB_UNIQUE_NAME='qg_st'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=qg_stXDB)'
*.fal_client='qg_st'
*.fal_server='qgresearch'
*.job_queue_processes=10
*.log_archive_config='DG_CONFIG=(qg_st,research)'
*.log_archive_dest_1='LOCATION=/rman/arch/qg_st/  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=qg_st'
*.log_archive_dest_2='SERVICE=qgresearch LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)  DB_UNIQUE_NAME=reserach'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='DEFER'
*.log_file_name_convert='/u01/oracle/oradata/research/','/opt/oracle/oradata/qg_st/'
*.open_cursors=300
*.pga_aggregate_target=1671430144
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=2147483648
*.standby_file_management='AUTO'
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/opt/oracle/admin/qg_st/udump'
5、将备库端启动到nomount状态:
        startup nomount
Primary 端:
1、检查主库开启归档和force logging
2、配置主库端的参数文件
alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(research,qg_st)';
alter system set LOG_ARCHIVE_DEST_1='LOCATION= /rman/archivelog/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=research';

alter system set LOG_ARCHIVE_DEST_2='SERVICE=qg_st LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)  DB_UNIQUE_NAME=qg_st';

alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE;
alter system set LOG_ARCHIVE_DEST_STATE_2=defer;
alter system set FAL_SERVER='qg_st';
alter system set FAL_CLIENT='qgresearch';
alter system set STANDBY_FILE_MANAGEMENT='AUTO';
3、配置主库的TNS,使primary和standby能相互ping通
qgresearch =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.102)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = research.country)
    )
  )

qg_st =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.182)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = qg_st)
    )
  )
4、主库进行全库的备份,将备份集拷贝到备库相同的目录下
RUN {
allocate channel c1 type disk;
allocate channel c2 type disk;
sql 'alter system archive log current';
backup current controlfile for standby format='/rman/backup/dgbackup_control_%U';
BACKUP FORMAT '/rman/backup/dgbackup_%U_%T' skip inaccessible filesperset 5 DATABASE ;
sql 'alter system archive log current';
BACKUP FORMAT '/rman/backup/dgbackup_arch_%U_%T' skip inaccessible filesperset 5 ARCHIVELOG ALL ;
release channel c2;
release channel c1;
}
过程省略,然后把备份文件SCP 到 standby相同的目录下,如果不同会出现ORA-19505

5、Rman下duplicate数据库,恢复备库
rman target / auxiliary sys/mycosoracle@qg_st
duplicate target database for standby nofilenamecheck dorecover;

select open_mode,database_role from v$database;
6、创建standby redo,打开主库的日志传输,备库端接收应用redo.
ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ('/opt/oracle/oradata/qg_st/redo04.log') size 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ('/opt/oracle/oradata/qg_st/redo05.log') size 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ('/opt/oracle/oradata/qg_st/redo06.log') size 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 ('/opt/oracle/oradata/qg_st/redo07.log') size 50M;

alter system set log_archive_dest_state_2=enable;
alter database recover managed standby database disconnect from session;

7、检查DG搭建成功后的状态
select max(sequence#), APPLIED from v$archived_log;

注:我们的192.168.1.182上面已经部署了133协议库的物理备库,ORACLE_SID也是research,所以在全国库和协议库主库上增加数据文件时,如果standby_file_management设置为自动,并且没有配置db_file_name_convert时,则都将备库端在与主库相同的目录/u01/oracle/oradata/research下增加数据文件,这将产生数据文件名重名的冲突。
5#
发表于 2014-12-7 00:45:11
备份主库的时候standby controfile是不是应该放在数据文件和归档文件备份完之后再备份?

回复 只看该作者 道具 举报

4#
发表于 2014-12-6 21:07:27
图片不显示,可以整理个pdf或者word发布么

回复 只看该作者 道具 举报

3#
发表于 2014-3-24 16:40:22
GOOD ,加精

回复 只看该作者 道具 举报

2#
发表于 2014-3-23 21:50:50
学习力,收藏下下次用

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-12-21 03:24 , Processed in 0.046070 second(s), 21 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569