Summary of the process of building physical DG using RMAN remote replication
This document only records the setup process. For detailed parameter meanings and configuration principles, refer to the previous summary.
Configure the tns of the master and slave databases before setting up the environment to ensure that the two databases can communicate with each other normally.
Primary
Make sure the database enables forced Archiving
Startup mount;
Alter database archivelog;
Alter database force logging;
Alter database open;
Modify configuration, export pfile, and copy pfile to the target slave database.
Alter system set db_unique_name = pri scope = spfile;
Alter system set log_archive_config = 'dg _ CONFIG = (pri, sty) 'scope = spfile;
Alter system set log_archive_dest_1 = 'location =/opt/app/Oracle/product/11.2.0/dbhome_1/dbs/arch VALID_FOR = (ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME = pri 'scope = spfile;
Alter system set log_archive_dest_2 = 'service = sty lgwr sync VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME = sty 'scope = spfile;
Alter system set log_archive_dest_state_1 = ENABLE;
Alter system set log_archive_dest_state_2 = ENABLE;
Alter system set fal_server = sty scope = spfile;
Alter system set fal_client = pri scope = spfile;
Alter system set standby_file_management = AUTO scope = spfile;
Create pfile = '/home/oracle/pripfile. ora' from spfile;
Standby
Install database software, no need to install Database
Copy the sys password file of the metadatabase to ensure that the passwords of the two databases are consistent.
Scp 192.168.000046: $ ORACLE_HOME/dbs/orapwxtttestdb $ ORACLE_HOME/dbs/
Copy the pfile exported from the target database and add the *. log_file_name_convert parameter option (after 10 Gb, it must be added even if the path is not changed)
Scp 192.168.000046:/home/oracle/pripfile. ora/home/oracle/
*. Log_file_name_convert = '/opt/app/oracle/oradata/xtttestdb/', '/opt/app/oracle/oradata/xtttestdb /'
Create necessary directories for restoring the standby Database
Mkdir-p/opt/app/oracle/admin/xtttestdb/adump
Mkdir-p/opt/app/oracle/oradata/xtttestdb
Mkdir-p/opt/app/oracle/product/11.2.0/dbhome_1/dbs/arch
Set SID to log on to the database
Export $ ORACLE_SID = xtttestdb
Sqlplus/as sysdba
Use copy and modified pfile to create spfile and start to nomount
SQL> create spfile from pfile = '/home/oracle/pripfile. ora ';
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1570009088 bytes
Fixed Size 2213696 bytes
Variable Size 1174407360 bytes
Database Buffers 385875968 bytes
Redo Buffers 7512064 bytes
Modify the parameter configuration of the slave Database
Alter system set db_unique_name = sty scope = spfile;
Alter system set log_archive_config = 'dg _ CONFIG = (pri, DG) 'scope = spfile;
Alter system set log_archive_dest_1 = 'location =/opt/app/oracle/product/11.2.0/dbhome_1/dbs/arch VALID_FOR = (ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME = sty 'scope = spfile;
Alter system set log_archive_dest_2 = 'service = pri lgwr sync VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME = pri 'scope = spfile;
Alter system set fal_server = pri scope = spfile;
Alter system set fal_client = sty scope = spfile;
Restart the database to nomount. The configuration takes effect (these configurations can also be modified in pfile before starting the database)
SQL> shutdown immediate;
SQL> startup mount;
Primary uses rman to copy the database
Rman target sys/[email protected] auxiliary sys/[email protected]
RMAN> duplicate target database for standby from active database nofilenamecheck;
Standby redo (at least three groups are required)
Alter database add standby logfile
Group 4 ('/opt/app/oracle/oradata/xtttestdb/styredo04.log') size 50 m,
Group 5 ('/opt/app/oracle/oradata/xtttestdb/styredo05.log') size 50 m,
Group 6 ('/opt/app/oracle/oradata/xtttestdb/styredo06.log') size 50 m,
Group 7 ('/opt/app/oracle/oradata/xtttestdb/styredo07.log') size 50 m;
Two methods to start the redo application of standby
① The default physical DG starts to apply the arch log after the arch log of the master database is fully written.
SQL> alter database recover managed standby database disconnect from session;
② You can add the current logfile parameter so that the application is currently reading and writing logs that have not been archived.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Disable REDO applications
SQL> alter database recover managed standby database cancel;
View standby log status
Select group #, thread #, sequence #, archived, status from v $ standby_log;
View application logs
Select name, creator, sequence #, applied, completion_time from v $ archived_log;
Verification:
Create a test table on the primary side and add data
SQL> select count (*) from test;
COUNT (*)
----------
7
SQL> insert into test select * from test;
7 rows created.
SQL> commit;
Commit complete.
SQL> select count (*) from test;
COUNT (*)
----------
14
Standby end verifies data synchronization
SQL> select count (*) from test;
COUNT (*)
----------
14
Summary of the setup process:
1. When the slave database is started to nomount and the tns test connection is used, the number of connections cannot be connected.
ORA-12528: TNS: listener: all appropriate instances are blocking new connections
The reason is that after 11 GB, the dynamic listener does not support remote tns Access in nomount state, and the listener configured on the server is always dynamic.
Add the listener. ora file and set static listening for standby
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME =/opt/app/oracle/product/11.2.0/dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = xtttestdb)
(ORACLE_HOME =/opt/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = xtttestdb)
)
)
Then test the connection.
2. redo error after RMAN remote database replication is complete
ORACLE error from auxiliary database: ORA-19527: physical standby redo log must be renamed
ORA-00312: online log 1 thread 1: '/opt/app/oracle/oradata/xtttestdb/redo01.log'
According to the error message, add a search on the Internet. Even if the path of the original slave database is the same as that of the log after 10 Gb, set the log_file_name_convert parameter to create the pfile file of the slave database, add this parameter and use pfile to start the database. The problem is solved.
Create pfile = '/home/oracle/stypfile. ora' from spfile;
Add
*. Log_file_name_convert = '/opt/app/oracle/oradata/xtttestdb/', '/opt/app/oracle/oradata/xtttestdb /'
Creaet spfile from pfile = '/home/oracle/stypfile. ora'
Startup
-------------------------------------- Split line --------------------------------------
Important configuration parameters of Oracle Data Guard
Configure Oracle 11g Data Guard based on the same host
Explore Oracle 11g elastic uard
Oracle Data Guard (RAC + DG) archive deletion policies and scripts
Role conversion for Oracle Data Guard
FAL gap in Oracle Data Guard logs
Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby
-------------------------------------- Split line --------------------------------------