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;

目录
相关文章
|
2月前
|
Oracle 关系型数据库 Linux
【赵渝强老师】Oracle数据库配置助手:DBCA
Oracle数据库配置助手(DBCA)是用于创建和配置Oracle数据库的工具,支持图形界面和静默执行模式。本文介绍了使用DBCA在Linux环境下创建数据库的完整步骤,包括选择数据库操作类型、配置存储与网络选项、设置管理密码等,并提供了界面截图与视频讲解,帮助用户快速掌握数据库创建流程。
337 93
|
3月前
|
Ubuntu Linux 网络安全
Linux服务器之Ubuntu的安装与配置
Ubuntu Desktop是目前最成功、最流行的图形界面的Linux发行版;而Ubuntu Server也在服务器端市场占据了较大的份额。今天为大家详细介绍了Ubuntu Server的安装与配置,希望对你能有所帮助。关于VMware、VirtualBox等虚拟化软件的使用,朱哥还会在后续的文章中为大家详细介绍,敬请关注!
|
1月前
|
存储 Linux 开发工具
Linux环境下使用Buildroot配置软件包
使用Buildroot可以大大简化嵌入式Linux系统的开发和维护工作,但它需要对Linux系统和交叉编译有深入的理解。通过上述步骤,可以有效地配置和定制软件包,为特定的嵌入式应用构建高效、稳定的系统。
170 11
|
7月前
|
Oracle 关系型数据库 MySQL
Oracle Linux 8.10 编译安装sysbench
Oracle Linux 8.10 编译安装sysbench
217 34
|
6月前
|
Oracle Cloud Native 关系型数据库
Oracle Linux 10 - Oracle 提供支持 RHEL 兼容发行版
Oracle Linux 10 - Oracle 提供支持 RHEL 兼容发行版
298 11
Oracle Linux 10 - Oracle 提供支持 RHEL 兼容发行版
|
4月前
|
Kubernetes Linux 网络安全
Rocky Linux 8.9配置Kubernetes集群详解,适用于CentOS环境
初始化成功后,记录下显示的 `kubeadm join`命令。
259 0
|
6月前
|
关系型数据库 MySQL Java
安装和配置JDK、Tomcat、MySQL环境,以及如何在Linux下更改后端端口。
遵循这些步骤,你可以顺利完成JDK、Tomcat、MySQL环境的安装和配置,并在Linux下更改后端端口。祝你顺利!
457 11
|
6月前
|
Oracle Cloud Native 关系型数据库
Oracle Linux 9.6 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
Oracle Linux 9.6 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
315 0
Oracle Linux 9.6 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
|
5月前
|
Oracle 关系型数据库 Linux
MyEMS开源系统安装之CentOS/RHEL/Rocky/AlmaLinux/Oracle Linux
本指南介绍如何在CentOS/RHEL/Rocky/AlmaLinux/Oracle Linux服务器上部署MyEMS开源能源管理系统。内容涵盖系统准备、数据库配置、多个MyEMS服务(如myems-api、myems-admin、myems-modbus-tcp等)的安装与配置,以及Nginx服务器设置和防火墙规则调整。通过完成所有步骤,您将能够访问MyEMS Admin UI和Web UI,默认端口分别为8001和80,初始登录凭据已提供。
287 0
|
5月前
|
Linux 网络安全 开发工具
在Linux下配置gitee与Github的远程仓库
注意,git push后,是输入你的账号与密码。这个步骤可以通过特殊设置省去,但是一开始还是不要太省。
313 0