Home Database Mysql Tutorial DataGuard部署及主从切换

DataGuard部署及主从切换

Jun 07, 2016 pm 04:48 PM
database

主库:vsgpdb 备库:dgdb 1、确认主库处于归档模式 SQLgt; archive log list Database log mode Archive Mode Au

主库:vsgpdb
 备库:dgdb
 

1、确认主库处于归档模式
 SQL> archive log list
 Database log mode              Archive Mode
 Automatic archival            Enabled
 Archive destination            /gp/arch
 Oldest online log sequence    1307
 Next log sequence to archive  1312
 Current log sequence          1312
 

2、将primary 数据库置为FORCE LOGGING 模式。通过下列语句:
 SQL> select force_logging from v$database;
 

FOR
 ---
 YES
 

SQL> alter database force logging;
 

3.配置Primary数据库的初始化参数
 修改客户端初始化参数文件,增加下列内容
 *.DB_UNIQUE_NAME=vsgpdb
 *.LOG_ARCHIVE_CONFIG='DG_CONFIG=(vsgpdb,dgdb)'
 *.LOG_ARCHIVE_DEST_2='SERVICE=dgdb LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dgdb'
 *.LOG_ARCHIVE_DEST_STATE_2=DEFER
 

 

SQL> alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(vsgpdb,dgdb)';
 SQL> alter system set LOG_ARCHIVE_DEST_2='SERVICE=dgdb LGWR SYNC AFFIRM
  VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dgdb';
 SQL> alter system set LOG_ARCHIVE_DEST_STATE_2=DEFER;
 

#--------配置standby 角色的参数用于角色转换
 *.FAL_SERVER=DGDB
 *.FAL_CLIENT=VSGPDB
 *.DB_FILE_NAME_CONVERT='/opt/ora10g/oradata/vsgpdb','/opt/dgdb/oradata/dgdb'
 *.LOG_FILE_NAME_CONVERT='/opt/ora10g/oradata/vsgpdb','/opt/dgdb/oradata/dgdb'
 *.STANDBY_FILE_MANAGEMENT=AUTO
 

SQL> alter system set FAL_SERVER=DGDB;
 

System altered.
 

SQL> alter system set FAL_CLIENT=VSGPDB;
 

System altered.
 

SQL> alter system set DB_FILE_NAME_CONVERT='/opt/ora10g/oradata/vsgpdb','/opt/dgdb/oradata/dgdb';
 alter system set DB_FILE_NAME_CONVERT='/opt/ora10g/oradata/vsgpdb','/opt/dgdb/oradata/dgdb'
                  *
 ERROR at line 1:
 ORA-02096: specified initialization parameter is not modifiable with this
 option
 

 

SQL> alter system set DB_FILE_NAME_CONVERT='/opt/ora10g/oradata/vsgpdb','/opt/dgdb/oradata/dgdb','/gp/oradata', '/opt/dgdb/oradata/dgdb' scope=spfile;
 

System altered.
 

SQL>
 SQL> alter system set LOG_FILE_NAME_CONVERT='/opt/ora10g/oradata/vsgpdb','/opt/dgdb/oradata/dgdb' scope=spfile;
 SQL> alter system set STANDBY_FILE_MANAGEMENT=AUTO;
 修改完之后重启
 

4.创建控制文件--primary 库操作
 SQL> alter database create standby controlfile as '/opt/ora10g/oradata/vsgpdb/dgdb03.ctl';
 

SQL> create pfile from spfile;
 

File created.
 

shutdown immediate  --一定要关掉主库再传送数据文件
 

5.传送文件到备库
 初始化参数文件+控制文件+数据文件
 备:192.168.165.26是备库IP
 scp /opt/ora10g/product/10.2.0/db_1/dbs/initvsgpdb.ora dgdb@192.168.165.26:/opt/dgdb/product/10.2.0/db_1/dbs/initdgdb.ora
 scp /opt/ora10g/oradata/vsgpdb/dgdb03.ctl dgdb@192.168.165.26:/opt/dgdb/oradata/dgdb/dgdb01.ctl
 scp /opt/ora10g/oradata/vsgpdb/dgdb03.ctl dgdb@192.168.165.26:/opt/dgdb/oradata/dgdb/dgdb02.ctl
 scp /opt/ora10g/oradata/vsgpdb/dgdb03.ctl dgdb@192.168.165.26:/opt/dgdb/oradata/dgdb/dgdb03.ctl
 scp /opt/ora10g/oradata/vsgpdb/redo02.log dgdb@192.168.165.26:/opt/dgdb/oradata/dgdb/
 scp /opt/ora10g/oradata/vsgpdb/system01.dbf dgdb@192.168.165.26:/opt/dgdb/oradata/dgdb/
 scp /gp/oradata/undo0201.dbf dgdb@192.168.165.26:/opt/dgdb/oradata/dgdb/
 scp /opt/ora10g/oradata/vsgpdb/redo01.log dgdb@192.168.165.26:/opt/dgdb/oradata/dgdb/
 scp /opt/ora10g/oradata/vsgpdb/redo03.log dgdb@192.168.165.26:/opt/dgdb/oradata/dgdb/
 scp /opt/ora10g/oradata/vsgpdb/sysaux01.dbf dgdb@192.168.165.26:/opt/dgdb/oradata/dgdb/
 scp /opt/ora10g/oradata/vsgpdb/temp01.dbf dgdb@192.168.165.26:/opt/dgdb/oradata/dgdb/
 scp /gp/oradata/temp01.dbf dgdb@192.168.165.26:/opt/dgdb/oradata/dgdb/
 scp /gp/oradata/users01.dbf dgdb@192.168.165.26:/opt/dgdb/oradata/dgdb/
 6.修改备库初始化参数文件
 [dgdb@rac1 dbs]$ cat initdgdb.ora
 dgdb.__db_cache_size=557842432
 dgdb.__java_pool_size=25165824
 dgdb.__large_pool_size=4194304
 dgdb.__shared_pool_size=255852544
 dgdb.__streams_pool_size=130023424
 *.aq_tm_processes=0
 *.audit_file_dest='/opt/dgdb/admin/dgdb/adump'
 *.audit_trail='DB'
 *.background_dump_dest='/opt/dgdb/admin/dgdb/bdump'
 *.compatible='10.2.0.3.0'
 *.control_files='/opt/dgdb/oradata/dgdb/dg01.ctl','/opt/dgdb/oradata/dgdb/dg02.ctl','/opt/dgdb/oradata/dgdb/dg03.ctl'
 *.core_dump_dest='/opt/dgdb/admin/dgdb/cdump'
 *.cursor_sharing='EXACT'
 *.db_block_size=8192
 *.db_domain=''
 *.db_file_multiblock_read_count=32
 *.db_file_name_convert='/opt/ora10g/oradata/vsgpdb','/opt/dgdb/oradata/dgdb','/opt/dgdb/oradata/dgdb','/opt/ora10g/oradata/vsgpdb'
 *.db_keep_cache_size=33554432
 *.db_name='vsgpdb'
 *.db_recovery_file_dest='/opt/dgdb/flash_recovery_area'
 *.db_recovery_file_dest_size=10737418240
 *.dispatchers='(PROTOCOL=TCP) (SERVICE=dgdbXDB)'
 *.fal_client='DGDB'
 *.fal_server='VSGPDB'
 *.global_names=TRUE
 *.job_queue_processes=10
 *.log_archive_config='DG_CONFIG=(vsgpdb,dgdb)'
 *.log_archive_dest_1='location=/gp/arch'
 *.log_archive_dest_2='SERVICE=vsgpdb LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=vsgpdb'
 *.log_archive_dest_state_2=ENABLE
 *.log_archive_format='arch%t_%s_%r.arc'
 *.log_buffer=61081600
 *.log_file_name_convert='/opt/ora10g/oradata/vsgpdb','/opt/dgdb/oradata/dgdb','/opt/dgdb/oradata/dgdb','/opt/ora10g/oradata/vsgpdb'
 *.nls_date_format='YYYY-MM-DD HH24:MI:SS'
 *.open_cursors=300
 *.open_links=4
 *.parallel_max_servers=20
 *.pga_aggregate_target=170917888
 *.processes=150
 *.recyclebin='OFF'
 *.remote_login_passwordfile='EXCLUSIVE'
 *.sga_max_size=1073741824
 *.sga_target=1073741824
 *.standby_file_management='AUTO'
 *.star_transformation_enabled='TRUE'
 *.streams_pool_size=26214400
 *.trace_enabled=FALSE
 *.undo_management='AUTO'
 *.undo_retention=3600
 *.undo_tablespace='UNDOTBS1'
 *.user_dump_dest='/opt/dgdb/admin/dgdb/udump'
 *.utl_file_dir='*'
 [dgdb@rac1 dbs]$
 

[dgdb@rac1 dbs]$ sqlplus / as sysdba
 

SQL*Plus: Release 10.2.0.4.0 - Production on Wed Aug 21 08:55:38 2013
 

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
 

Connected to an idle instance.
 

SQL>create spfile from pfile='/opt/dgdb/product/10.2.0/db_1/dbs/initdgdb.ora';
 
 startup mount
 

相关参考:

Oracle Data Guard 重要配置参数

基于同一主机配置 Oracle 11g Data Guard

探索Oracle之11g DataGuard

Oracle Data Guard (RAC+DG) 归档删除策略及脚本

Oracle Data Guard 的角色转换

Oracle Data Guard的日志FAL gap问题

Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby 处理方法

 

更多详情见请继续阅读下一页的精彩内容

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How does Go language implement the addition, deletion, modification and query operations of the database? How does Go language implement the addition, deletion, modification and query operations of the database? Mar 27, 2024 pm 09:39 PM

Go language is an efficient, concise and easy-to-learn programming language. It is favored by developers because of its advantages in concurrent programming and network programming. In actual development, database operations are an indispensable part. This article will introduce how to use Go language to implement database addition, deletion, modification and query operations. In Go language, we usually use third-party libraries to operate databases, such as commonly used sql packages, gorm, etc. Here we take the sql package as an example to introduce how to implement the addition, deletion, modification and query operations of the database. Assume we are using a MySQL database.

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

How does Hibernate implement polymorphic mapping? How does Hibernate implement polymorphic mapping? Apr 17, 2024 pm 12:09 PM

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

An in-depth analysis of how HTML reads the database An in-depth analysis of how HTML reads the database Apr 09, 2024 pm 12:36 PM

HTML cannot read the database directly, but it can be achieved through JavaScript and AJAX. The steps include establishing a database connection, sending a query, processing the response, and updating the page. This article provides a practical example of using JavaScript, AJAX and PHP to read data from a MySQL database, showing how to dynamically display query results in an HTML page. This example uses XMLHttpRequest to establish a database connection, send a query and process the response, thereby filling data into page elements and realizing the function of HTML reading the database.

Analysis of the basic principles of MySQL database management system Analysis of the basic principles of MySQL database management system Mar 25, 2024 pm 12:42 PM

Analysis of the basic principles of the MySQL database management system MySQL is a commonly used relational database management system that uses structured query language (SQL) for data storage and management. This article will introduce the basic principles of the MySQL database management system, including database creation, data table design, data addition, deletion, modification, and other operations, and provide specific code examples. 1. Database Creation In MySQL, you first need to create a database instance to store data. The following code can create a file named "my

Tips and practices for handling Chinese garbled characters in databases with PHP Tips and practices for handling Chinese garbled characters in databases with PHP Mar 27, 2024 pm 05:21 PM

PHP is a back-end programming language widely used in website development. It has powerful database operation functions and is often used to interact with databases such as MySQL. However, due to the complexity of Chinese character encoding, problems often arise when dealing with Chinese garbled characters in the database. This article will introduce the skills and practices of PHP in handling Chinese garbled characters in databases, including common causes of garbled characters, solutions and specific code examples. Common reasons for garbled characters are incorrect database character set settings: the correct character set needs to be selected when creating the database, such as utf8 or u

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

See all articles