2011年(10)
分类: Oracle
2011-08-08 12:43:14
primary 192.168.0.211 red1
standby 192.168.0.213 red3
P的安装过程中,出错,java_lang….. 初步认定是虚拟机分辨率过低,通过xhost +解决
开启P的归档
使用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;
传送
创建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'
-------------------------
生成配置后的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')
#这里采用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
起监听时候出错
解决 vi /etc/hosts 后加localhost
备库建目录
我没建目录,直接删除了pfile当中的带有目录的语句,采用简化的pfile引导
登陆
startup nomount pfile='/u01/pfile.ora';
主库 rman 登陆 auxiliary还原
rman target / auxiliary sys/oracle@orcls;
duplicate target database for standby nofilenamecheck dorecover;
问题
判断应该是ftp受局域网带宽影响,造成的数据损坏,明日限速再战……
6.14 16:55
经查是由于目标文件夹未创建造成
备库成功恢复!
select instance_name,status from v$instance;
create spfile from pfile=’/u01/pfile.ora’;
select GROUP#,THREAD#,STATUS from v$standby_log;
Ok 关闭,重启到nomount
Startup mount
控制文件报错,应该是由于我重建了spfile造成的,待查,先回复下ctfile
Ok mount一下
启用redo应用
Alter database recover managed standby database disconnect from session;
Alter database set standby database to maximize performance;