oracle 11g dataguard创建的简单方法
oracle 10g可以通过基于备份的rman DUPLICATE实现dataguard,通过步骤需要对数据库进行备份,并在standby侧进行数据库的恢复。
而到了11g,oracle推出了Duplicate From Active Database技术,不需要再对数据库进行rman备份恢复,一切动作都通过网络自动完成。
主库已在归档模式
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch
Oldest online log sequence 8
Next log sequence to archive 10
Current log sequence 10
SQL> alter database force logging;
SQL> alter database add standby logfile group 4 '/u01/app/oracle/flash_recovery_area/SALES/standbylog/standby01.log' size 50M;
SQL> alter database add standby logfile group 5 '/u01/app/oracle/flash_recovery_area/SALES/standbylog/standby02.log' size 50M;
SQL> alter database add standby logfile group 6 '/u01/app/oracle/flash_recovery_area/SALES/standbylog/standby03.log' size 50M;
SQL> alter database add standby logfile group 7 '/u01/app/oracle/flash_recovery_area/SALES/standbylog/standby04.log' size 50M;
SQL> alter system set log_archive_config='dg_config=(sales,dgsales)';
SQL> alter system set log_archive_dest_1='location=/home/oracle/arch';
SQL> alter system set log_archive_dest_2 ='service=dgsales async valid_for=(online_logfile,primary_role) db_unique_name=dgsales';
SQL> alter system set fal_client='sales' scope=spfile;
SQL> alter system set fal_server='dgsales' scope=spfile;
SQL> alter system set db_file_name_convert='/u01/app/oracle/oradata/SALES/','/u01/app/oracle/oradata/DGSALES/' scope=spfile;
SQL> alter system set log_file_name_convert='/u01/app/oracle/oradata/SALES/','/u01/app/oracle/oradata/DGSALES/','/u01/app/oracle/flash_recovery_area/SALES/','/u01/app/oracle/flash_recovery_area/DGSALES/' scope=spfile;
SQL> shutdown immediate
SQL> startup
创建用于备库的参数文件
SQL> create pfile='/home/oracle/initsales.ora' from spfile;
cat /home/oracle/initsales.ora
文件内容如下:
sales.__db_cache_size=721420288
sales.__java_pool_size=16777216
sales.__large_pool_size=16777216
sales.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
sales.__pga_aggregate_target=822083584
sales.__sga_target=1207959552
sales.__shared_io_pool_size=0
sales.__shared_pool_size=436207616
sales.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/sales/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/SALES/controlfile/o1_mf_cb0g8x26_.ctl','/u01/app/oracle/flash_recovery_area/SALES/controlfile/o1_mf_cb0g8x3g_.ctl'
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_domain=''
*.db_name='sales'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=salesXDB)'
*.log_archive_config='dg_config=(sales,dgsales)'
*.log_archive_dest_1='location=/home/oracle/arch'
*.log_archive_dest_2='service=dgsales async valid_for=(online_logfile,primary_role) db_unique_name=dgsales'
*.log_archive_format='sales_%t_%s_%r.log'
*.fal_client='sales'
*.fal_server='dgsales'
*.memory_target=2022703104
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
传输initsales.ora到备库
scp /home/oracle/initsales.ora root@192.168.59.130:/home/oracle/
mv /home/oracle/initsales.ora /home/oracle/initdgsales.ora
修改initdgsales.ora
vi /home/oracle/initdgsales.ora
dgsales.__db_cache_size=721420288
dgsales.__java_pool_size=16777216
dgsales.__large_pool_size=16777216
dgsales.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
dgsales.__pga_aggregate_target=822083584
dgsales.__sga_target=1207959552
dgsales.__shared_io_pool_size=0
dgsales.__shared_pool_size=436207616
dgsales.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/dgsales/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/DGSALES/controlfile/control01.ctl','/u01/app/oracle/flash_recovery_area/DGSALES/controlfile/control02.ctl'
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_domain=''
*.db_file_name_convert='/u01/app/oracle/oradata/SALES/','/u01/app/oracle/oradata/DGSALES/'
*.db_name='dgsales'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest='/u01/app/oracle'
*.fal_client='dgsales'
*.fal_server='sales'
*.log_archive_config='dg_config=(sales,dgsales)'
*.log_archive_dest_1='location=/home/oracle/arch'
*.log_archive_dest_2='service=sales async valid_for=(online_logfile,primary_role) db_unique_name=sales'
*.log_archive_format='dgsales_%t_%s_%r.log'
*.log_file_name_convert='/u01/app/oracle/oradata/SALES/','/u01/app/oracle/oradata/DGSALES/','/u01/app/oracle/flash_recovery_area/SALES/','/u01/app/oracle/flash_recovery_area/DGSALES/'
*.memory_target=2022703104
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
备库
创建目录
mkdir -p /u01/app/oracle/admin/dgsales/adump
mkdir -p /u01/app/oracle/oradata/DGSALES
mkdir -p /u01/app/oracle/flash_recovery_area
mkdir -p /home/oracle/arch
主库备库tnsnames.ora添加条目:
SALES =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = sales)
)
)
DGSALES =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.130)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = dgsales)
)
)
主库listener.ora静态注册备库监听
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dgsales)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = dgsales)
)
)
ADR_BASE_LISTENER = /u01/app/oracle
重启监听
lsnrctl stop
lsnrctl start
备库listener.ora静态注册主备监听
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = sales)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = sales)
)
(SID_DESC =
(GLOBAL_DBNAME = dgsales)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = dgsales)
)
)
ADR_BASE_LISTENER = /u01/app/oracle
重启监听
lsnrctl stop
lsnrctl start
传输主库sys口令文件到备库
scp /u01/app/oracle/product/11.2.0/db_1/dbs/orapwsales oracle@192.168.59.130://u01/app/oracle/product/11.2.0/db_1/dbs/
mv /u01/app/oracle/product/11.2.0/db_1/dbs/orapwsales /u01/app/oracle/product/11.2.0/db_1/dbs/orapwdgsales
启动standby 数据库到nomount
export $ORACLE_SID=dgsales
sqlplus / as sysdba
startup nomount pfile='/home/oracle/initdgsales.ora'
主库
rman target sys/oracle219@sales auxiliary sys/oracle219@dgsales
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate auxiliary channel s1 type disk;
duplicate target database
for standby
from active database
dorecover
spfile
parameter_value_convert 'sales','dgsales'
set db_unique_name='dgsales'
set db_file_name_convert='/SALES/','/DGSALES/'
set log_file_name_convert='/SALES/','/DGSALES/'
set control_files='/u01/app/oracle/oradata/DGSALES/controlfile/dgsales01.ctl','/u01/app/oracle/oradata/DGSALES/controlfile/dgsales02.ctl'
set log_archive_max_processes='5'
set fal_client='dgsales'
set fal_server='sales'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(sales,dgsales)'
set log_archive_dest_2='service=sales async valid_for=(online_logfile,primary_role) db_unique_name=sales' ;
set log_archive_dest_state_2='enable'
set log_archive_format='dgsales_%t_%s_%r.log'
sql channel c1 "alter system archive log current";
sql channel s1 "alter database recover managed standby database using current logfile disconnect";
}
oracle 11g dataguard创建的简单方法的更多相关文章
- Oracle 11g Dataguard参数详解
https://www.jb51.net/article/52269.htm注:本文译自<Oracle Data Guard 11g Handbook> Page 78 – Page 88 ...
- Oracle 11g dataguard check RTA(real time apply)
Oracle 11g dataguard check RTA(real time apply) 2017年8月24日 16:38 环境:oracle 11.2.0.1 OEL 5.8 注:以下操作都在 ...
- Oracle 11g R2创建数据库之手工建库方式
在之前的博文当中梳理了关于DBCA静默方式创建数据库的过程,本文就手工通过SQL*PLUS客户端采用CREATE DATABASE语句创建数据库.这种建库方式就是完全使用手工SQL语句创建数据库,通常 ...
- ORACLE 11G EXP导出空表方法
EXP在导出11G的库的时候,与过去10G,9I的版本有很大的差别. 就是没有数据的表是不会分配空间的. 从Oracle 11.2.0.1版本开始,Oracle又提供了一种新的空间分配方法: Crea ...
- Oracle 11g R2创建数据库之DBCA静默方式
通常创建Oracle数据库都是通过DBCA(Database Configuration Assistant)工具完成的,DBCA工具可以通过两种方式完成建库任务,即图形界面方式和静默命令行方式.既然 ...
- Oracle 11g DataGuard搭建(一) - 单节点到单节点
(一)DataGuard概要 DataGuard中文称为”数据卫士“,提供了数据库高可用性.数据保护和灾难恢复的功能.DataGuard通过建立primary数据库和standby数据库来确立参照关系 ...
- oracle 11g 如何创建、修改、删除list-list组合分区
Oracle11g在分区方面做了很大的提高,不但新增了4种复合分区类型,还增加了虚拟列分区.系统分区.INTERVAL分区等功能. 9i开始,Oracle就包括了2种复合分区,RANGE-HASH和R ...
- Oracle 11g EM删除重建的方法
虚拟机里的Oracle 11g好长时间没用了,突然打开之后发现EM无法访问了,EM可以重建,于是也不打算查找原因了,直接使大招 OS:Windows Server 2012 Oracle:11g R2 ...
- oracle 11g 分区表创建(自动按年、月、日分区)
前言:工作中有一张表一年会增长100多万的数据,量虽然不大,可是表字段多,所以一年下来也会达到 1G,而且只增不改,故考虑使用分区表来提高查询性能,提高维护性. oracle 11g 支持自动分区,不 ...
随机推荐
- sql分页存储过程
ALTER PROCEDURE [dbo].[P_SplitPagesQuery] @TablesName NVARCHAR(MAX),--表名或视图名(只能传单一表名) @PK NVARCHAR(M ...
- C#更改win7系统时间的代码,以及为什么更改不成功
我在用C#更改win7系统的时间时(必须用管理员的权限,点击要运行程序,鼠标右键“以管理员权限运行”),下面列出了3张图片,使用第一张的代码执行不成功,使用第二张图片可以执行成功,第三张图片是说明原因 ...
- 重新想象 Windows 8 Store Apps (34) - 通知: Toast Demo, Tile Demo, Badge Demo
[源码下载] 重新想象 Windows 8 Store Apps (34) - 通知: Toast Demo, Tile Demo, Badge Demo 作者:webabcd 介绍重新想象 Wind ...
- php中的字符串常用函数(一) strpos() 子字符首次出现的位置
strpos($str, $needle); 1.返回$needle在$str首次出现的位置.(大小写敏感). 2.从php5开始$needle支持多字符.php4只能用单个字符. 3.能找到$nee ...
- Linux命令详解之—cat命令
cat命令的功能是连接文件或标准输入并打印,今天就为大家介绍下Linux中的cat命令. 更多Linux命令详情请看:Linux命令速查手册 Linux 的cat命令通常用来显示文件内容,也可以用来将 ...
- mybatis中自建的类型别名
在使用mybatis过程中经常用到类型别名,除了我们自己新建的别名外,mybatis还自带了很多类型别名和java中的类型的映射,下面先看一个自建的别名的配置 <typeAliases> ...
- Windows程序控件升级==>>构建布局良好的Windows程序
01.菜单栏(MenuStrip) 01.看看这就是menuStrip的魅力: 02.除了一些常用的属性(name.text..)外还有: 03.有人会问:上图的快捷键: 方法: 方式一:1.设置菜单 ...
- NYOJ 21 三个水杯
三个水杯 时间限制:1000 ms | 内存限制:65535 KB 难度:4 描述 给出三个水杯,大小不一,并且只有最大的水杯的水是装满的,其余两个为空杯子.三个水杯之间相互倒水,并且水杯没有 ...
- Android应用与系统安全防御
来源:HTTP://WWW.CNBLOGS.COM/GOODHACKER/P/3864680.HTML ANDROID应用安全防御 Android应用的安全隐患包括三个方面:代码安全.数据安全和组件安 ...
- C# 分层 三层架构
Hello! 三层架构↓↓↓↓↓↓ 三层架构分为:表现层(UI(User Interface)).业务逻辑层(BLL(Business Logic Layer)).数据访问层(DAL(Data Acc ...