问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

oracle11g dataguard 从库 只需要安装数据库软件 不需要创建实例吗_百 ...

发布网友 发布时间:2022-04-29 02:10

我来回答

3个回答

懂视网 时间:2022-04-09 00:35

1、环境信息:
系统:
oracle-linux 5.7

数据库版本:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

主库:192.168.12.31 SID:yoon db_unique_name:yoon 
备库:192.168.12.231 SID:yoon db_unique_name:yoondg

 

2、查看DG是否已经安装:
SQL> select * from v$option where parameter = ‘Oracle Data Guard‘;
PARAMETER VALUE
-------------------- --------------------
Oracle Data Guard TRUE
TRUE表示已经安装可以配置,否则需要安装相应软件

 

3、查看主库是否开启归档:
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 4
Current log sequence 6

 

4、设置主库为归档模式:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.

Total System Global Area 2505338880 bytes
Fixed Size 2230952 bytes
Variable Size 553649496 bytes
Database Buffers 1946157056 bytes
Redo Buffers 3301376 bytes
Database mounted.

SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 4
Next log sequence to archive 6
Current log sequence 6

 

5、设置主库为强制记录日志:
SQL> alter database force logging;

Database altered.

 

6、创建standy log files:
SQL> select group#,member from v$logfile;

GROUP# MEMBER
------- -----------------------------------
3 /opt/oracle/oradata/yoon/redo03.log
2 /opt/oracle/oradata/yoon/redo02.log
1 /opt/oracle/oradata/yoon/redo01.log
添加:
SQL> alter database add standby logfile group 7 ‘/opt/oracle/oradata/yoon/standby07.log‘ size 50m;

Database altered.

SQL> alter database add standby logfile group 8 ‘/opt/oracle/oradata/yoon/standby08.log‘ size 50m;

Database altered.

SQL> alter database add standby logfile group 9 ‘/opt/oracle/oradata/yoon/standby09.log‘ size 50m;

Database altered.

SQL> alter database add standby logfile group 10 ‘/opt/oracle/oradata/yoon/standby10.log‘ size 50m;

Database altered.

 

7、创建standby控制文件:
SQL> shutdown immediate

SQL> startup mount

SQL> alter database create standby controlfile as ‘/opt/oracle/oradata/yoon/standby_control01.ctl‘;

Database altered.

SQL>alter database open;

 

8、设置db_unique_name:
默认db_name和db_unique_name是一样的,主库是yoon
在配置DG中主库和备库的SID可以一样,But,db_unique_name不能相同,备库设置为:yoondg
SQL> show parameter db_unique_name;

NAME TYPE VALUE
------------------------------------ ---------- ------------------------------
db_unique_name string yoon

--注意虽然默认db_unique_name和db_name是一致的,但是需要显式设置,否则在spfile中没有此参数
SQL> alter system set db_unique_name=yoon scope=spfile;

System altered.

 

9、配置主库listener.ora:
# listener.ora Network Configuration File: /opt/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER=
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = yoon)
(ORACLE_HOME = /opt/oracle/product/11.2.0/db_1/)
(SID_NAME = yoon)
)
)


LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.31)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

ADR_BASE_LISTENER = /opt/oracle

配置tnsnames.ora
# listener.ora Network Configuration File: /opt/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.


YOON =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.31)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = yoon)
)
)

YOONDG =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.231)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = yoondg)
)
)

10、将主库listener.ora和tnsnames.ora拷贝到备库修改
[root@1231 admin]# scp listener.ora tnsnames.ora oracle@192.168.12.231:/opt/oracle/product/11.2.0/db_1/network/admin/ 
配置listener.ora
# listener.ora Network Configuration File: /opt/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

 

SID_LIST_LISTENER=
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = yoon)
(ORACLE_HOME = /opt/oracle/product/11.2.0/db_1/)
(SID_NAME = yoon)
)
)

 


LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.231)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

ADR_BASE_LISTENER = /opt/oracle

配置tnsnames.ora
# listener.ora Network Configuration File: /opt/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

YOONDG =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.231)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = yoondg)
)
)

YOON =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.31)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = yoon)
)
)

11、配置完以后在主和备的oralce用户下测试下是否能ping通
主:
[oracle@1231 ~]$ tnsping yoon
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.31)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = yoon)))
OK (0 msec)

[oracle@1231 ~]$ tnsping yoondg
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.231)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = yoondg)))
OK (10 msec)

备:
[oracle@12231 ~]$ tnsping yoon
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.31)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = yoon)))
OK (0 msec)

[oracle@12231 ~]$ tnsping yoondg
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.231)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = yoondg)))
OK (0 msec)

 

12、重做日志传输配置
a.配置归档日志位置:
SQL> alter system set log_archive_dest_1=‘location=/opt/oracle/archive_bak valid_for=(all_logfiles,primary_roles) db_unique_name=yoon‘ scope=spfile;

System altered.

b.配置重做日志到备份库:
SQL> alter system set log_archive_dest_2=‘service=yoondg lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=yoondg‘ scope=spfile;

System altered.

 

13、配置FAL_SERVER
主:
SQL> alter system set fal_server=‘yoondg‘;

System altered.

 

14、Data Guard 配置里的另外一个库的名字
SQL> alter system set log_archive_config=‘dg_config=(yoon,yoondg)‘;

System altered.

SQL> alter system set log_archive_dest_state_1=enable scope=spfile;

System altered.

SQL> alter system set log_archive_dest_state_2=enable scope=spfile;

System altered.

SQL> create pfile from spfile;

File created.

SQL> create spfile from pfile;

File created.

 

15、查看主库inityoon.ora信息
yoon.__db_cache_size=1946157056
yoon.__java_pool_size=16777216
yoon.__large_pool_size=16777216
yoon.__oracle_base=‘/opt/oracle‘#ORACLE_BASE set from environment
yoon.__pga_aggregate_target=838860800
yoon.__sga_target=2516582400
yoon.__shared_io_pool_size=0
yoon.__shared_pool_size=520093696
yoon.__streams_pool_size=0
*.audit_file_dest=‘/opt/oracle/admin/yoon/adump‘
*.audit_trail=‘db‘
*.compatible=‘11.2.0.0.0‘
*.control_files=‘/opt/oracle/oradata/yoon/control01.ctl‘,‘/opt/oracle/fast_recovery_area/yoon/control02.ctl‘
*.db_block_size=8192
*.db_domain=‘‘
*.db_name=‘yoon‘
*.db_recovery_file_dest=‘/opt/oracle/fast_recovery_area‘
*.db_recovery_file_dest_size=4322230272
*.db_unique_name=‘YOON‘
*.diagnostic_dest=‘/opt/oracle‘
*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=yoonXDB)‘
*.fal_server=‘yoondg‘
*.log_archive_config=‘dg_config=(yoon,yoondg)‘
*.log_archive_dest_1=‘location=/opt/oracle/archive_bak valid_for=(all_logfiles,primary_roles) db_unique_name=yoon‘
*.log_archive_dest_2=‘service=yoondg lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=yoondg‘
*.log_archive_dest_state_1=‘ENABLE‘
*.log_archive_dest_state_2=‘ENABLE‘
*.open_cursors=300
*.pga_aggregate_target=837812224
*.processes=150
*.remote_login_passwordfile=‘EXCLUSIVE‘
*.standby_file_management=‘AUTO‘
*.sga_target=2514485248
*.undo_tablespace=‘UNDOTBS1‘

 

16、将主库的数据文件、控制文件、参数文件、密码文件拷贝到备库对应的目录
[root@1231 oracle]# scp -r admin/ fast_recovery_area/ oradata/ oracle@192.168.12.231:/opt/oracle/

 

17、修改备库参数文件
yoon.__db_cache_size=1946157056
yoon.__java_pool_size=16777216
yoon.__large_pool_size=16777216
yoon.__oracle_base=‘/opt/oracle‘#ORACLE_BASE set from environment
yoon.__pga_aggregate_target=838860800
yoon.__sga_target=2516582400
yoon.__shared_io_pool_size=0
yoon.__shared_pool_size=520093696
yoon.__streams_pool_size=0
*.audit_file_dest=‘/opt/oracle/admin/yoon/adump‘
*.audit_trail=‘db‘
*.compatible=‘11.2.0.0.0‘
*.control_files=‘/opt/oracle/oradata/yoon/control01.ctl‘,‘/opt/oracle/fast_recovery_area/yoon/control02.ctl‘
*.db_block_size=8192
*.db_domain=‘‘
*.db_name=‘yoon‘
*.db_recovery_file_dest=‘/opt/oracle/fast_recovery_area‘
*.db_recovery_file_dest_size=4322230272
*.db_unique_name=‘YOONDG‘
*.diagnostic_dest=‘/opt/oracle‘
*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=yoonXDB)‘
*.fal_server=‘yoon‘
*.log_archive_config=‘dg_config=(yoondg,yoon)‘
*.log_archive_dest_1=‘location=/opt/oracle/archive_bak valid_for=(all_logfiles,primary_roles) db_unique_name=yoondg‘
*.log_archive_dest_2=‘service=yoon lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=yoon‘
*.log_archive_dest_state_1=‘ENABLE‘
*.log_archive_dest_state_2=‘ENABLE‘
*.open_cursors=300
*.pga_aggregate_target=837812224
*.processes=150
*.remote_login_passwordfile=‘EXCLUSIVE‘
*.standby_file_management=‘AUTO‘
*.sga_target=2514485248
*.undo_tablespace=‘UNDOTBS1‘

 

18、在备库通过pfile创建spfile

 

19、删除备库的控制文件control01.ctl和control02.ctl
将standby_control01.ctl替换成control01.ctl和control02.ctl

 

20、启动备库
SQL> startup nomount
ORACLE instance started.

Total System Global Area 2505338880 bytes
Fixed Size 2230952 bytes
Variable Size 553649496 bytes
Database Buffers 1946157056 bytes
Redo Buffers 3301376 bytes
SQL>

SQL> alter database mount standby database;

Database altered.

启用redo应用
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

停止standby
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
SQL>shutdown immediate;

21、备用服务器的管理模式与只读模式
a.启动到管理模式

SQL>shutdown immediate;

SQL>startup nomount;

SQL>alter database mount standby database;

SQL>alter database recover managed standby database disconnect from session;

b.启动到只读模式
SQL>shutdown immediate;

SQL>startup nomount;

SQL>alter database mount standby database;

SQL> alter database open read only;

c.在管理恢复模式下到只读模式
SQL> recover managed standby database cancel;

SQL> alter database open read only;

d.从只读方式到管理恢复方式
SQL> recover managed standby database disconnect from session;

 

22、DG启动:
监听:先起备库再起主库

数据库:先起备库再起主库

关闭:与启动相反.

oracle-11g-配置dataguard

标签:

热心网友 时间:2022-04-08 21:43

不需要,只需要保证主从数据库参数一直,然后启动到 NOMOUNT 模式下,然后利用RMAN 将主库的数据备份。 远程还原即可。

热心网友 时间:2022-04-08 23:01

需要,从库的实例用来存储主库传来的数据。
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
ups快递客服电话24小时 贷款记录在征信保留几年? 安徽徽商城有限公司公司简介 安徽省徽商集团新能源股份有限公司基本情况 安徽省徽商集团有限公司经营理念 2019哈尔滨煤气费怎么有税? 快手删除的作品如何恢复 体育理念体育理念 有关体育的格言和理念 什么是体育理念 怎么使用Data Pump备份物理备库 爱普生L3118复印机没有卡纸但是灯一直闪? 爱普生因为卡纸取出来后就出现打印机错误的选项怎么办? dataguard 主库和备库 scn是一样的么 求教oracle dataguard 主备库日志不能同步的问题 爱普生打印机,在打印中老是出现卡纸现象.哪位好心人帮帮我吧/ oracle 11g dataguard支持多少个备库 爱普生打印机无法打印,总提示缺纸爱普生L3118单张打印正常,连续打印出第一张纸正常,第二页无动作_百度问一问 oracle 11g dataguard支持多少standby oracle 11g dataguard broker 成熟吗 请问oracle dataguard 物理备库逻辑备库分别适合什么类型的数据库? 再做Oracle 11g DataGuard物理standby配置的时候报错了,希望高手能指导... 熟爬虾怎么存放 青岛农商银行办银行卡没有预留手机号,打客服电话可以更改吗 我用支付宝转账给别人银行卡会显示我的名字吗 青岛农商银行 青岛市社会保障卡丢失怎么补办? 用支付宝的银行卡转账给别人银行卡,对方会收到我名字的提示吗? 青岛农商银行的卡丢了能否在异地补卡 在支付宝里使用支付宝绑定的银行卡向对方转账 银行可以看到对方的名字吗? 工商的网络银行https://mybank.icbc.com.cn/icbc/perbank/index.jsp是吗 如何在dataguard环境做到client的自动切换 DG物理备库的备份能用作主库的恢复吗 有没有朋友做过oracle主从配置,最好有详细文档 oracle 11g windows dataguard Failovers切换 求乡村旅游度假村开发策划案样本 乡村旅游规划的介绍 乡村旅游如何推动乡村振兴 王者荣耀苹果有账号了还可以把安卓的转移过来吗? 王者荣耀苹果系统怎么转移到安卓系统手机 王者ios可以转到安卓么 王者荣耀可以从苹果转到安卓吗 uv打印机喷头的寿命大概多久? win10更新0%卡住不动了,蓝屏了。百分之0已经快一个小时了。- 问一问 Win10蓝屏,失败的操作: NETIO.SYS,请问怎么解决? UV打印机爱普生喷头如何保养延长使用寿命 win10蓝屏开不了机 本来在看视频,突然蓝屏,然后收集错误信息一直0%, 爱普生uv万能打印机喷头一天用2小时左右保养好寿命多久 win10开机蓝屏卡在0% 不开机? 下水道为什么会产生硫化氢 为什么UV打印机喷头没有质保?