Chinaunix首页 | 论坛 | 博客
  • 博客访问: 14258
  • 博文数量: 10
  • 博客积分: 210
  • 博客等级: 二等列兵
  • 技术积分: 115
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-24 11:33
文章分类
文章存档

2011年(10)

我的朋友
最近访客

分类: Oracle

2011-08-08 12:43:14

primary 192.168.0.211 red1

clip_image002

standby 192.168.0.213 red3

clip_image004

P的安装过程中,出错,java_lang….. 初步认定是虚拟机分辨率过低,通过xhost +解决

开启P的归档

clip_image006

使用vmware的虚拟机克隆,创建s库

之后修改s库

/etc/hosts

/etc/sysconfig/network

Hostname red3

/etc/sysconfig/network-scripts/

Ls vi eth0

IPADDR=

NETMASK=

GATEWAY=

Service network restart

P:

alter database force logging;

开启强制日志记录(DG一致性的前提)

创建密码文件

!orapwd file='/u01/orapworcl' password=oracle entries=5;

clip_image008

传送

clip_image010

创建standby log

select bytes/1024/1024 from v$log;

select count(*) from v$logfile;

alter database add standby logfile group 4 ('/u01/slog/log1.log') size 50M;

alter database add standby logfile group 5 ('/u01/slog/log2.log') size 50M;

alter database add standby logfile group 6 ('/u01/slog/log3.log') size 50M;

alter database add standby logfile group 7 ('/u01/slog/log4.log') size 50M;

#比redo log group+1

创建静态参数文件pfile

create pfile='/u01/pfile.ora' from spfile;

#需要注意和修改的项目

*.DB_UNIQUE_NAME='orclp'

*.log_archive_dest_1='location=/u01/archivelog'

*.log_archive_dest_2='SERVICE=orcls'

*.LOG_ARCHIVE_DEST_STATE_1=ENABLE

*.LOG_ARCHIVE_DEST_STATE_2=ENABLE

*.standby_file_management='AUTO'

*.standby_archive_dest='/u01/archivelog'

*.FAL_SERVER='orcls'

*.FAL_CLIENT='orclp'

-------------------------

clip_image012

生成配置后的spfile

startup pfile='/u01/pfile.ora'

create spfile from pfile='/u01/pfile.ora';

配置网络

listenner

cd /u01/app/oracle/product/10.2.0/db_1/network/admin

增加

(SID_DESC =

(GLOBAL_DBNAME = orcl)

(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)

(SID_NAME = orcl)

)

vi tnsnames.ora

注意使用ip

ORCLP =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.0.211 )(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = orcl)

)

)

ORCLS =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.0.213 )(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = orcl)

)

)

TNSPING测试双机通过

复制到备库

修改pfile

UName,log archive dest对应,fal顺序更换

加一条用于rman复制的

log_file_name_convert =('orcl','orcl')

clip_image014

#这里采用rman复制模式,可以不备份控制文件

--------------------------

冷备如下

alter database create standby controlfile as '/u01/orclp01.ctl';

select name from v$datafile;

cd /u01/app/oracle/

tar -cvf oradata.tar oradata

---------------------------------

Rman脚本

RUN {

allocate channel c1 type disk;

sql 'alter system archive log current';

backup current controlfile for standby format='/u01/backup/control_%U';

BACKUP FORMAT '/u01/backup/orcl_%U_%T' skip inaccessible filesperset 5 DATABASE ;

sql 'alter system archive log current';

BACKUP FORMAT '/u01/backup/arch_%U_%T' skip inaccessible filesperset 5 ARCHIVELOG ALL DELETE INPUT;

release channel c1;

}

backup full database include current controlfile for standby plus archivelog FORMAT '/u01/backup/orcl_%U_%T' skip inaccessible filesperset 5 ;

backup full database include current controlfile for standby format '/u01/backup/full%u_%s_%p'; 最简化语句

tnsping orcls

起监听时候出错

clip_image016

解决 vi /etc/hosts 后加localhost

备库建目录

clip_image018

我没建目录,直接删除了pfile当中的带有目录的语句,采用简化的pfile引导

登陆

startup nomount pfile='/u01/pfile.ora';

clip_image020

主库 rman 登陆 auxiliary还原

rman target / auxiliary sys/oracle@orcls;

duplicate target database for standby nofilenamecheck dorecover;

clip_image022

问题

clip_image024

判断应该是ftp受局域网带宽影响,造成的数据损坏,明日限速再战……

6.14 16:55

clip_image026

经查是由于目标文件夹未创建造成

clip_image028

备库成功恢复!

clip_image030

select instance_name,status from v$instance;

clip_image032

create spfile from pfile=’/u01/pfile.ora’;

clip_image034

select GROUP#,THREAD#,STATUS from v$standby_log;

clip_image036

Ok 关闭,重启到nomount

Startup mount

clip_image038

控制文件报错,应该是由于我重建了spfile造成的,待查,先回复下ctfile

clip_image040

Ok mount一下

clip_image042

启用redo应用

Alter database recover managed standby database disconnect from session;

clip_image044

Alter database set standby database to maximize performance;

clip_image046

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