设置保护模式,在主数据库:
alter database set standby to maximize pepformance;
alter database set standby to maximize availability;
alter database set standby to maximize protection;
---------------------------------------------------------------dataguard的相关参数:
1.DB_UNIQUE_NAME该参数为数据库定义唯一名称。
2.LOG_ARCHIVE_CONFIG配置有效DB_UNIQUE_NAME参数列表,提供安全性检查。LOG_ARCHIVE_CONFIG=‘dg_Config=(orcl11g,stby)’
3.CONTROL_FILE备用控制文件
4.LOG_ARCHIVE_MAX_PROCESSES LOG_ARCHIVE_MAX_PROCESSES=‘4’
5.DB_CREATE_FILE_DEST 如果正在使用ASM,需要在备用数据库定义DB_CREATE_FILE_DEST=+DATA
----------------------------------------------------------------------主角色参数
1.LOG_ARCHIVE_DEST_n
a:SERVICE 备用数据库的tsnames描述符
b:sync 同步LGWR进程将等待来自LNS的确认消息 async 异步默认方法
c:NET_TIMEOUT 指定LGWR进程等待LNS进程做出响应的秒数,如果超过指定时间,将因故障放弃备用。
d:REOPEN 控制dataguard允许主数据库尝试重连故障备用数据库前等待的时间。默认300秒。待验证
e:DB_UNIQUE_NAME要在LOG_ARCHIVE_DEST_n使用该特性,还需要设置LOG_ARCHIVE_CONFIG,否则,将拒绝连接到该目标。
f:VALID_FOR定义何时使用LOG_ARCHIVE_DEST_n目标参数,以及应在哪类重做日志文件上运行。
日志文件的合法值
online_logfile;standby_logfile;all_logfiles
角色的合法值
primary_role;standby_role;all_roles
g:affirm noaffirm
h:compression
i:delay
j:alternate
建议不要使用的特性
k:location
m:mandatory
l:max_failure
n:noregister
2.log_archive_dest_state_n
----------------------------------------------------------------------备用角色参数
1.DB_FILE_NAME_CONVERT
2.LOG_fILE_NAME_CONVERT
3.FAL_SERVER 只于物理备用数据库。如果当物理备份备用遇到重做间隔时无法连接到主数据库,便会询问其他某个备用数据库,为此,将FAL_SERVER参数定义为存在于备用服务器的tns名称列表
4.FAL_CLIENT fal客户端是间隔请求数据库的tns名称,间隔请求接收者需要TNS名称,以便fal服务器数据库上的归档进程可反向连接请求者。
5.STANDBY_FILE_MAMAGEMENT
复制数据库
connect auxiliary sys/sys@orcl
duplicate target database to orcl11g nofilenamecheck
pfile=/home/oracle/oracle_tmp/init.ora;
logfile
'app/oracle/product/11.2.0/oradata/orcl11g/redo01.dbf' size 100m;
'app/oracle/product/11.2.0/oradata/orcl11g/redo02.dbf' size 100m;
'app/oracle/product/11.2.0/oradata/orcl11g/redo03.dbf' size 100m;
-----------------------------------------------------------------------------------------------------------------------------------------
创建物理备用数据库
1.在oracle11g中使用rman
(1)准备备用系统
为备用数据库创建一个静态监听器项。
创建一个内容只包含DB_NAME的init.ora文件
用主数据库sys密码创建密码文件
启动备用实例以nomnount模式
(2)准备主系统
db_create_file_dest='+DATA'
db_create_online_log_Dest_1='+FLASH'
db_crate_online_log_dest_2='+DATA'
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
如果在创建备用之前就在主数据库上创建了SRL文件,rman将自动在备用数据库上创建他们。
不要复用SRL文件
(3)创建备用数据库
rman>connect target sys/oracle@orcl11g auxiliary sys/oracle@stby
run{
allocate channel1 c1 type disk;
dulpicate target database for standb form active database
spfile
prameter_Value_convert 'orcl11g' 'stby'
set 'db_unique_name='stby''
set control_files='+DATA/stby/control.ctl'
set db_create_file_dest='+DATA'
set db_create_online_log_Dest_1='+FLASH'
set db_crate_online_log_dest_2='+DATA'
set db_recovery_File_dest='+FLASH'
set db_recovery_File_dest_size='10G'
nofilenamecheck;
}
(4)备用数据库
alter system set fal_server=orcl11g;
alter system set fal_client=stby;
alter system set standby_file_managemnet=auto;
alter system set log_Archive_Config='dg_Config=(orcl11g,stby)'
alter system set log_archive_dest_2='service=orcl11g async db_unique_name=orcl11g valid_for=(primary_role,online_logfile)'
启动应用进程
alter database recover managed standby database using current logfile disconnect;
(5)主数据库
alter system set log_Archive_Config='dg_Config=(orcl11g,stby)'
alter system set log_archive_dest_2='service=stby async db_unique_name=stby valid_for=(primary_role,online_logfile)'
alter system switch logfile;
alter system set fal_server=stby
alter system set fal_client=orcl11g
alter system set standby_file_managemnet=auto;
2.使用rman oracle database 10g方法
(1)准备备用系统
(2)获取必需的文件并创建备份
需要收集四个主文件以便传输到目标备用系统:初始化参数,密码文件,数据库备份,控制文件备份(作为备用控制文件)
create pfile='' from spfile;
cp $oracle_home/dbs/orapworcl11g /scratch/oracle/stage/stby 不能使用相同的sysmima为备用数据库创建密码文件,要将主数据库的密码文件复制到备用数据库
backup as compressed device type disk format '/scratch/oracle/stage/Database%U' database plus archivelog;
backup format '/scratch/oracle/stage/Control%U' current controlfile for standby;
(3)复制所需文件
(4)准备备用数据库
修改来自主数据库的INIT.Ora文件
*.db_unique_name='stby'
DB_FILE_NAME_CONVERT
log_FILE_NAME_CONVERT
(5)还原备份
以nomount模式启动备用数据库,然后使用rman连接到主数据库
startup nomount
rman>target sys/oracle@orcl11g auxiliary /
rman>duplicate target database for standby onfilenamecheck dorecover;
(6)配置备用数据库
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
alter system set fal_server=orcl11g;
alter system set fal_client=stby;
alter system set standby_file_managemnet=auto;
alter system set log_Archive_Config='dg_Config=(orcl11g,stby)'
alter system set log_archive_dest_2='service=orcl11g async db_unique_name=orcl11g valid_for=(primary_role,online_logfile)'
启动应用进程
alter database recover managed standby database using current logfile disconnect;
(7)完成主数据库配置
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
alter system set log_Archive_Config='dg_Config=(orcl11g,stby)'
alter system set log_archive_dest_2='service=stby async db_unique_name=stby valid_for=(primary_role,online_logfile)'
alter system switch logfile;
alter system set fal_server=stby
alter system set fal_client=orcl11g
alter system set standby_file_managemnet=auto;
创建物理备用数据库
run{
set until sequence=17 thread=1;
duplicate target database for standby dorecover;
}
alter database add standby logfile '/u01/app/oracle/oradata/orcl11g/sredolog03.log' size 50m;
alter system set log_archive_dest_1='location=/u01/app/oracle/product/11.2.0/db_1/dbs' scope=spfile;
alter system set log_archive_dest_2='service=stby lgwr async db_unique_name=stby valid_for=(primary_role,online_logfile)' scope=spfile;
alter system set log_archive_config='dg_config=(orcl11g,stby)' scope=spfile;
-------------------------------------------------------------------------------------------------------
alter database set standby to maximize pepformance;
alter database set standby to maximize availability;
alter database set standby to maximize protection;
---------------------------------------------------------------dataguard的相关参数:
1.DB_UNIQUE_NAME该参数为数据库定义唯一名称。
2.LOG_ARCHIVE_CONFIG配置有效DB_UNIQUE_NAME参数列表,提供安全性检查。LOG_ARCHIVE_CONFIG=‘dg_Config=(orcl11g,stby)’
3.CONTROL_FILE备用控制文件
4.LOG_ARCHIVE_MAX_PROCESSES LOG_ARCHIVE_MAX_PROCESSES=‘4’
5.DB_CREATE_FILE_DEST 如果正在使用ASM,需要在备用数据库定义DB_CREATE_FILE_DEST=+DATA
----------------------------------------------------------------------主角色参数
1.LOG_ARCHIVE_DEST_n
a:SERVICE 备用数据库的tsnames描述符
b:sync 同步LGWR进程将等待来自LNS的确认消息 async 异步默认方法
c:NET_TIMEOUT 指定LGWR进程等待LNS进程做出响应的秒数,如果超过指定时间,将因故障放弃备用。
d:REOPEN 控制dataguard允许主数据库尝试重连故障备用数据库前等待的时间。默认300秒。待验证
e:DB_UNIQUE_NAME要在LOG_ARCHIVE_DEST_n使用该特性,还需要设置LOG_ARCHIVE_CONFIG,否则,将拒绝连接到该目标。
f:VALID_FOR定义何时使用LOG_ARCHIVE_DEST_n目标参数,以及应在哪类重做日志文件上运行。
日志文件的合法值
online_logfile;standby_logfile;all_logfiles
角色的合法值
primary_role;standby_role;all_roles
g:affirm noaffirm
h:compression
i:delay
j:alternate
建议不要使用的特性
k:location
m:mandatory
l:max_failure
n:noregister
2.log_archive_dest_state_n
----------------------------------------------------------------------备用角色参数
1.DB_FILE_NAME_CONVERT
2.LOG_fILE_NAME_CONVERT
3.FAL_SERVER 只于物理备用数据库。如果当物理备份备用遇到重做间隔时无法连接到主数据库,便会询问其他某个备用数据库,为此,将FAL_SERVER参数定义为存在于备用服务器的tns名称列表
4.FAL_CLIENT fal客户端是间隔请求数据库的tns名称,间隔请求接收者需要TNS名称,以便fal服务器数据库上的归档进程可反向连接请求者。
5.STANDBY_FILE_MAMAGEMENT
复制数据库
connect auxiliary sys/sys@orcl
duplicate target database to orcl11g nofilenamecheck
pfile=/home/oracle/oracle_tmp/init.ora;
logfile
'app/oracle/product/11.2.0/oradata/orcl11g/redo01.dbf' size 100m;
'app/oracle/product/11.2.0/oradata/orcl11g/redo02.dbf' size 100m;
'app/oracle/product/11.2.0/oradata/orcl11g/redo03.dbf' size 100m;
-----------------------------------------------------------------------------------------------------------------------------------------
创建物理备用数据库
1.在oracle11g中使用rman
(1)准备备用系统
为备用数据库创建一个静态监听器项。
创建一个内容只包含DB_NAME的init.ora文件
用主数据库sys密码创建密码文件
启动备用实例以nomnount模式
(2)准备主系统
db_create_file_dest='+DATA'
db_create_online_log_Dest_1='+FLASH'
db_crate_online_log_dest_2='+DATA'
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
如果在创建备用之前就在主数据库上创建了SRL文件,rman将自动在备用数据库上创建他们。
不要复用SRL文件
(3)创建备用数据库
rman>connect target sys/oracle@orcl11g auxiliary sys/oracle@stby
run{
allocate channel1 c1 type disk;
dulpicate target database for standb form active database
spfile
prameter_Value_convert 'orcl11g' 'stby'
set 'db_unique_name='stby''
set control_files='+DATA/stby/control.ctl'
set db_create_file_dest='+DATA'
set db_create_online_log_Dest_1='+FLASH'
set db_crate_online_log_dest_2='+DATA'
set db_recovery_File_dest='+FLASH'
set db_recovery_File_dest_size='10G'
nofilenamecheck;
}
(4)备用数据库
alter system set fal_server=orcl11g;
alter system set fal_client=stby;
alter system set standby_file_managemnet=auto;
alter system set log_Archive_Config='dg_Config=(orcl11g,stby)'
alter system set log_archive_dest_2='service=orcl11g async db_unique_name=orcl11g valid_for=(primary_role,online_logfile)'
启动应用进程
alter database recover managed standby database using current logfile disconnect;
(5)主数据库
alter system set log_Archive_Config='dg_Config=(orcl11g,stby)'
alter system set log_archive_dest_2='service=stby async db_unique_name=stby valid_for=(primary_role,online_logfile)'
alter system switch logfile;
alter system set fal_server=stby
alter system set fal_client=orcl11g
alter system set standby_file_managemnet=auto;
2.使用rman oracle database 10g方法
(1)准备备用系统
(2)获取必需的文件并创建备份
需要收集四个主文件以便传输到目标备用系统:初始化参数,密码文件,数据库备份,控制文件备份(作为备用控制文件)
create pfile='' from spfile;
cp $oracle_home/dbs/orapworcl11g /scratch/oracle/stage/stby 不能使用相同的sysmima为备用数据库创建密码文件,要将主数据库的密码文件复制到备用数据库
backup as compressed device type disk format '/scratch/oracle/stage/Database%U' database plus archivelog;
backup format '/scratch/oracle/stage/Control%U' current controlfile for standby;
(3)复制所需文件
(4)准备备用数据库
修改来自主数据库的INIT.Ora文件
*.db_unique_name='stby'
DB_FILE_NAME_CONVERT
log_FILE_NAME_CONVERT
(5)还原备份
以nomount模式启动备用数据库,然后使用rman连接到主数据库
startup nomount
rman>target sys/oracle@orcl11g auxiliary /
rman>duplicate target database for standby onfilenamecheck dorecover;
(6)配置备用数据库
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
alter system set fal_server=orcl11g;
alter system set fal_client=stby;
alter system set standby_file_managemnet=auto;
alter system set log_Archive_Config='dg_Config=(orcl11g,stby)'
alter system set log_archive_dest_2='service=orcl11g async db_unique_name=orcl11g valid_for=(primary_role,online_logfile)'
启动应用进程
alter database recover managed standby database using current logfile disconnect;
(7)完成主数据库配置
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE '+FLASH' SIZE 50M;
alter system set log_Archive_Config='dg_Config=(orcl11g,stby)'
alter system set log_archive_dest_2='service=stby async db_unique_name=stby valid_for=(primary_role,online_logfile)'
alter system switch logfile;
alter system set fal_server=stby
alter system set fal_client=orcl11g
alter system set standby_file_managemnet=auto;
创建物理备用数据库
run{
set until sequence=17 thread=1;
duplicate target database for standby dorecover;
}
alter database add standby logfile '/u01/app/oracle/oradata/orcl11g/sredolog03.log' size 50m;
alter system set log_archive_dest_1='location=/u01/app/oracle/product/11.2.0/db_1/dbs' scope=spfile;
alter system set log_archive_dest_2='service=stby lgwr async db_unique_name=stby valid_for=(primary_role,online_logfile)' scope=spfile;
alter system set log_archive_config='dg_config=(orcl11g,stby)' scope=spfile;
-------------------------------------------------------------------------------------------------------