Oracle11g Linux单机STANDBY配置

简介: 环境:RHEL 4 U5+Oracle 11.1.0.6 主库SID:ora11g 备用库SID:standby 主库数据文件存放目录:/home/oracle/opt/oradata/or...
环境:RHEL 4 U5+Oracle 11.1.0.6 主库SID:ora11g 备用库SID:standby 主库数据文件存放目录:/home/oracle/opt/oradata/ora11g/ 备用库数据文件存放目录:/home/oracle/opt/oradata/standby/ 1、 验证主库是否归档,如果是未归档模式的话必须更改为归档模式

环境:RHEL 4 U5+Oracle 11.1.0.6

主库SID:ora11g 备用库SID:standby

主库数据文件存放目录:/home/oracle/opt/oradata/ora11g/

备用库数据文件存放目录:/home/oracle/opt/oradata/standby/

1、 验证主库是否归档,如果是未归档模式的话必须更改为归档模式:

Sys@ORA11G> archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /home/oracle/opt/oradata/ora11g/archive

Oldest online log sequence 61

Next log sequence to archive 63

Current log sequence 63

2、 将主库置于FORCE LOGGING模式:

Sys@ORA11G> alter database force logging;

3、 对主库做一个全库的RMAN备份,用于STANDBY配置

[oracle@test51 bin]$ ./rman target /

Recovery Manager: Release 11.1.0.6.0 - Production on Thu Aug 16 15:51:22 2007

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: ORA11G (DBID=4026454982)

RMAN> backup database format '/home/oracle/liuyun/%U.bak';

Starting backup at 16-AUG-07

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=121 device type=DISK

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00004 name=/home/oracle/opt/oradata/ora11g/users01.dbf

input datafile file number=00002 name=/home/oracle/opt/oradata/ora11g/sysaux01.dbf

input datafile file number=00001 name=/home/oracle/opt/oradata/ora11g/system01.dbf

input datafile file number=00005 name=/home/oracle/opt/oradata/ora11g/example01.dbf

input datafile file number=00003 name=/home/oracle/opt/oradata/ora11g/undotbs01.dbf

channel ORA_DISK_1: starting piece 1 at 16-AUG-07

channel ORA_DISK_1: finished piece 1 at 16-AUG-07

piece handle=/home/oracle/liuyun/03iphp8l_1_1.bak tag=TAG20070816T155148 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:01:45

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

including current control file in backup set

including current SPFILE in backup set

channel ORA_DISK_1: starting piece 1 at 16-AUG-07

channel ORA_DISK_1: finished piece 1 at 16-AUG-07

piece handle=/home/oracle/liuyun/04iphpc9_1_1.bak tag=TAG20070816T155148 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 16-AUG-07

4、 准备STANDBY数据文件路径和其他路径:

[oracle@test51 oradata]$ pwd

/home/oracle/opt/oradata

[oracle@test51 oradata]$ mkdir standby

[oracle@test51 oradata]$ ls

ora11g orcl standby

[oracle@test51 oradata]$ cd $ORACLE_BASE/admin

[oracle@test51 admin]$ mkdir standby

[oracle@test51 admin]$ ls

ora11g orcl standby

[oracle@test51 standby]$mkdir adump

[oracle@test51 standby]$mkdir dpdump

[oracle@test51 standby]$mkdir pfile

[oracle@test51 standby]$ ls

adump dpdump pfile

5、更改tnsnames配置,添加主库和备用库的连接字:

primary =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = test51)(PORT = 1522))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = ora11g)

)

)

standby =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = test51)(PORT = 1522))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = standby)

)

)

6、生成STANDBY控制文件:

Sys@ORA11G> alter database create standby controlfile as '/home/oracle/opt/oradata/standby/control01.ctl';

Database altered.

[oracle@test51 standby]$ cp control01.ctl control02.ctl

[oracle@test51 standby]$ cp control01.ctl control03.ctl

[oracle@test51 standby]$ ls

archive control01.ctl control02.ctl control03.ctl

6、生成standby 初始化参数文件:

Sys@ORA11G> create pfile='$ORACLE_BASE/admin/standby/pfile/init.ora' from spfile;

File created.

添 加以下几个参数,需要注意的是从11G开始原来备用库归档参数standby_archive_dest这个参数已经废除了,STANDBY的归档路径改 为常规的归档路径log_archive_dest_n。还有原来单机配置STANDBY需要的参数lock_name_space也废除了:

*.log_archive_config='DG_CONFIG=(ora11g,standby)'

*.fal_client='standby'

*.fal_server='primary'

*.db_file_name_convert='ora11g','standby'

*.log_file_name_convert='ora11g','standby'

*.standby_file_management='auto'

*.log_archive_dest_1='location=/home/oracle/opt/oradata/standby/archive VALID_FOR=(STANDBY_LOGFILE,STANDBY_ROLE)'

更改后的参数文件如下,注意db_unique_name要和主库区分,否则无法MOUNT STANDBY:

standby.__db_cache_size=234881024

standby.__java_pool_size=12582912

standby.__large_pool_size=4194304

standby.__oracle_base='/home/oracle/opt'#ORACLE_BASE set from environment

standby.__pga_aggregate_target=209715200

standby.__sga_target=629145600

standby.__shared_io_pool_size=0

standby.__shared_pool_size=369098752

standby.__streams_pool_size=0

*.audit_file_dest='/home/oracle/opt/admin/standby/adump'

*.audit_trail='db'

*.compatible='11.1.0.0.0'

*.control_files='/home/oracle/opt/oradata/standby/control01.ctl','/home/oracle/opt/oradata/standby/control02.ctl'

,'/home/oracle/opt/oradata/standby/control03.ctl'

*.db_block_size=8192

*.db_domain=''

*.db_name='ora11g'

*.db_recovery_file_dest='/home/oracle/opt/flash_recovery_area'

*.db_recovery_file_dest_size=2147483648

*.db_unique_name='standby'

*.ddl_lock_timeout=10

*.diagnostic_dest='/home/oracle/opt'

*.dispatchers=''

*.job_queue_processes=0

*.local_listener='LISTENER_ora11g'

*.memory_target=838860800

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.undo_tablespace='UNDOTBS1'

*.log_archive_config='DG_CONFIG=(ora11g,standby)'

*.fal_client='standby'

*.fal_server='primary'

*.db_file_name_convert='ora11g','standby'

*.log_file_name_convert='ora11g','standby'

*.standby_file_management='auto'

*.log_archive_dest_1='location=/home/oracle/opt/oradata/standby/archive VALID_FOR=(STANDBY_LOGFILE,STANDBY_ROLE)'

7、启动STANDBY数据库,进行RESTORE:

[oracle@test51 standby]$ export ORACLE_SID=standby

[oracle@test51 standby]$ sql

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Aug 16 16:27:08 2007

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

idle> startup nomount pfile='$ORACLE_BASE/admin/standby/pfile/init.ora'

ORACLE instance started.

Total System Global Area 836976640 bytes

Fixed Size 1303132 bytes

Variable Size 595594660 bytes

Database Buffers 234881024 bytes

Redo Buffers 5197824 bytes

idle> alter database mount standby database;

Database altered.

[oracle@test51 bin]$ ./rman target /

Recovery Manager: Release 11.1.0.6.0 - Production on Thu Aug 16 16:30:11 2007

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: ORA11G (DBID=4026454982, not open)

RMAN> restore database;

Starting restore at 16-AUG-07

Starting implicit crosscheck backup at 16-AUG-07

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=147 device type=DISK

Crosschecked 4 objects

Finished implicit crosscheck backup at 16-AUG-07

Starting implicit crosscheck copy at 16-AUG-07

using channel ORA_DISK_1

Crosschecked 2 objects

Finished implicit crosscheck copy at 16-AUG-07

searching for all files in the recovery area

cataloging files...

no files cataloged

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00001 to /home/oracle/opt/oradata/standby/system01.dbf

channel ORA_DISK_1: restoring datafile 00002 to /home/oracle/opt/oradata/standby/sysaux01.dbf

channel ORA_DISK_1: restoring datafile 00003 to /home/oracle/opt/oradata/standby/undotbs01.dbf

channel ORA_DISK_1: restoring datafile 00004 to /home/oracle/opt/oradata/standby/users01.dbf

channel ORA_DISK_1: restoring datafile 00005 to /home/oracle/opt/oradata/standby/example01.dbf

channel ORA_DISK_1: reading from backup piece /home/oracle/liuyun/03iphp8l_1_1.bak

channel ORA_DISK_1: piece handle=/home/oracle/liuyun/03iphp8l_1_1.bak tag=TAG20070816T155148

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:02:05

Finished restore at 16-AUG-07

8、添加STANDBY LOGFILE,启动STANDBY至恢复管理模式:

idle> alter database add standby logfile '/home/oracle/opt/oradata/standby/redo04.log' size 50M;

Database altered.

Elapsed: 00:00:01.06

idle> alter database add standby logfile '/home/oracle/opt/oradata/standby/redo05.log' size 50M;

Database altered.

Elapsed: 00:00:01.18

idle> alter database add standby logfile '/home/oracle/opt/oradata/standby/redo06.log' size 50M;

Database altered.

Elapsed: 00:00:00.85

idle> recover managed standby database disconnect from session;

Media recovery complete.

9、主库配置到STANDBY的归档:

Sys@ORA11G> alter system set log_archive_dest_state_2=enable;

目录
相关文章
|
14天前
|
监控 Oracle 关系型数据库
Linux平台Oracle开机自启动设置
【11月更文挑战第8天】在 Linux 平台设置 Oracle 开机自启动有多种方法,本文以 CentOS 为例,介绍了两种常见方法:使用 `rc.local` 文件(较简单但不推荐用于生产环境)和使用 `systemd` 服务(推荐)。具体步骤包括编写启动脚本、赋予执行权限、配置 `rc.local` 或创建 `systemd` 服务单元文件,并设置开机自启动。通过 `systemd` 方式可以更好地与系统启动过程集成,更规范和可靠。
|
9天前
|
Oracle Cloud Native 关系型数据库
Oracle Linux 9.5 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
Oracle Linux 9.5 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
49 10
Oracle Linux 9.5 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
|
13天前
|
缓存 资源调度 安全
深入探索Linux操作系统的心脏——内核配置与优化####
本文作为一篇技术性深度解析文章,旨在引领读者踏上一场揭秘Linux内核配置与优化的奇妙之旅。不同于传统的摘要概述,本文将以实战为导向,直接跳入核心内容,探讨如何通过精细调整内核参数来提升系统性能、增强安全性及实现资源高效利用。从基础概念到高级技巧,逐步揭示那些隐藏在命令行背后的强大功能,为系统管理员和高级用户打开一扇通往极致性能与定制化体验的大门。 --- ###
40 9
|
15天前
|
存储 安全 数据管理
如何在 Rocky Linux 8 上安装和配置 Elasticsearch
本文详细介绍了在 Rocky Linux 8 上安装和配置 Elasticsearch 的步骤,包括添加仓库、安装 Elasticsearch、配置文件修改、设置内存和文件描述符、启动和验证 Elasticsearch,以及常见问题的解决方法。通过这些步骤,你可以快速搭建起这个强大的分布式搜索和分析引擎。
32 5
|
15天前
|
Oracle Ubuntu 关系型数据库
Linux平台Oracle开机自启动设置
【11月更文挑战第7天】本文介绍了 Linux 系统中服务管理机制,并详细说明了如何在使用 systemd 和 System V 的系统上设置 Oracle 数据库的开机自启动。包括创建服务单元文件、编辑启动脚本、设置开机自启动和启动服务的具体步骤。最后建议重启系统验证设置是否成功。
|
1月前
|
存储 Oracle 关系型数据库
|
29天前
|
Java Linux 网络安全
NIFI在Linux服务区上的部署配置过程是什么?
【10月更文挑战第21天】NIFI在Linux服务区上的部署配置过程是什么?
48 2
|
1月前
|
Ubuntu Linux 编译器
Linux/Ubuntu下使用VS Code配置C/C++项目环境调用OpenCV
通过以上步骤,您已经成功在Ubuntu系统下的VS Code中配置了C/C++项目环境,并能够调用OpenCV库进行开发。请确保每一步都按照您的系统实际情况进行适当调整。
319 3
|
1月前
|
监控 安全 网络协议
快速配置Linux云服务器
【10月更文挑战第3天】快速配置Linux云服务器
|
1月前
|
应用服务中间件 Linux Shell
Linux 配置 Nginx 服务的详细步骤,绝对干货
Linux 配置 Nginx 服务的详细步骤,绝对干货
76 0
下一篇
无影云桌面