ITPub博客

首页 > 数据库 > Oracle > oracle 10g dataguard

oracle 10g dataguard

原创 Oracle 作者:lzf200012 时间:2016-03-21 11:12:31 0 删除 编辑

-----primary
log_archive_config                   string      dg_config=(orcl,orcl2) --db_unique_name
alter system set log_archive_dest_2='SERVICE=orcl78 valid_for=(all_logfiles,all_roles) db_unique_name=orcl2' scope=both;

fal_client                           string      orcl
fal_server                           string      orcl78

---
log_archive_config                   string      dg_config=(orcl2,orcl)
alter system set log_archive_dest_2='SERVICE=orcl138 valid_for=(all_logfiles,all_roles) db_unique_name=orcl' scope=both;

fal_client                           string      orcl
fal_server                           string      orcl138


ALTER DATABASE ADD STANDBY LOGFILE GROUP 10 ('/oracle/dbs/log1c.rdo','/oracle/dbs/log2c.rdo') SIZE 500M;

备库:
rman target sys/oracle3@orcl138 auli
 duplicate target database for standby from active database nofilenamecheck;




--管理模式
startup nomount;
alter database mount standby database;(此时主库open)  startup mount;
--alter database open;
alter database recover managed standby database using current logfile disconnect from session;


--
startup mount;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

--切换到只读模式
alter database recover managed standby database cancel;
SQL>alter database open read only;


--------
主库切换为备库
alter database commit to switchover to physical standby;
alter database commit to switchover to physical standby with session shutdown;-- 主库有会话连接的时候
shutdown immediate
startup nomount;
alter database mount standby database;
alter database open;
alter database recover managed standby database using current logfile disconnect from session;
----------
从库切换为主库
alter database commit to switchover to primary;
shutdown immediate;
startup
alter system switch logfile;

------------------------
--------
主库切换为备库
alter database commit to switchover to physical standby with session shutdown;-- 主库有会话连接的时候
shutdown immediate;
startup mount;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

从库切换为主库
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
shutdown immediate;
startup;

------------------------------------
--
从库关闭:
 alter database recover managed standby database cancel;
shutdown immediate;
--
主库关闭:
shutdown immediate;
alter database force logging;
shutdown immediate;
startup mount;
alter database archivelog;


primary端:
Oracle$rman target /
 RMAN>backup full format='/u01/app/oracle/bak/ora10g_%d_%T_%s' database include current controlfile for standby plus archivelog format='/u01/app/oracle/bak/arch_%d_%T_%s';

备份完毕后,把相应备份文件拷贝到丛库的相应目录(目录必须一致)
Oracle$Scp /export/home/oracle/bak/* oracle@192.168.94.199:/export/home/oracle/bak/

--primary端:
Oracle$rman target / auxiliary sys/system@dgdb1_s
 RMAN> duplicate target database for standby nofilenamecheck dorecover;

standby端建立standby log(至少比redo多一组):
Oracle$sqlplus / as sysdba
 SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ('/export/home/oracle/product/10.2.0/oradata/dgdb1/redo04.log') size 50M;
 SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ('/export/home/oracle/product/10.2.0/oradata/dgdb1/redo05.log') size 50M;
 SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ('/export/home/oracle/product/10.2.0/oradata/dgdb1/redo06.log') size 50M;
 SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 ('/export/home/oracle/product/10.2.0/oradata/dgdb1/redo07.log') size 50M;
--开启服务(standby端):
SQL> alter database recover managed standby database disconnect from session;
----------

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9569516/viewspace-2060782/,如需转载,请注明出处,否则将追究法律责任。

上一篇: oracle 11g rac安装
下一篇: 没有了~
请登录后发表评论 登录
全部评论
  • 博文量
    5
  • 访问量
    3340