1. View host and database information [[email protected] ~]$ sqlplus/as sysdba sql*plus:release 12.2.0.1.0 Production on Tue May 01:19:35 2018 copyright (c) 1982, Oracle. All rights reserved. connected to:oracle Database 12c Enterprise Edition Release 12.2.0.1.0-64bit production& nbsp Sql> set linesize 300set pagesize 999 select * from V$version; bannercon_ ID------------------------------------------------------------------------------------------Oracle Database 12c Enterprise Edition release 12.2.0.1.0-64bit production0pl/sql release 12.2.0.1.0- Production0core12.2.0.1.0production0tns for linux:version 12.2.0.1.0-production0nlsrtl Version 12.2.0.1.0- Production0 sql> set linesize 140set pagesize 999col name for A25col value for A60select name,value from v$p Arameter where name like '%dump% '; sql> sql> sql> sql> namevalue------------------------------------------------------------- ------------------------shadow_core_dumppartialbackground_core_dumppartialbackground_dump_dest/data/app/oracle/product/12.2.0.1/db_1/ rdbms/loguser_dump_dest/data/app/oracle/product/12.2.0.1/db_1/rdbms/logcore_dump_dest/data/app/oracle/diag/ Rdbms/orcl/orcl/cdumpmax_dump_file_sizeunlimited 6 rows selected. sql> col value for A60select name, Value from V$parameter where name is like '%pfile% '; namevalue---------------------------------------------------- ---------------------------------spfile/data/app/oracle/product/12.2.0.1/db_1/dbs/spfileorcl.ora sql> Col name for A50select name from V$controlfile; name--------------------------------------------------/data/ Oradata/orcl/control01.ctl/data/oradata/orcl/control02.ctl sql> Col member for A50select member from v$ Logfile; member--------------------------------------------------/data/oradata/orcl/redo03.log/data/ Oradata/orcl/redo02.log/data/oradata/orcl/redo01.log sql> select name from V$datafile;   NAME--------------------------------------------------/data/oradata/orcl/system01.dbf/data/oradata/orcl/slucex _01.dbf/data/oradata/orcl/sysaux01.dbf/data/oradata/orcl/undotbs01.dbf/data/oradata/orcl/qa_01.dbf/data/ Oradata/orcl/users01.dbf/data/oradata/orcl/ucex_service_01.dbf/data/oradata/orcl/activity_01.dbf 8 rows Selected. sql> select name from v$tempfile; NAME--------------------------------------------------/data/oradata/orcl/temp01.dbf sql> Col PARAMETER For A30col VALUE for A30select * from nls_database_parameters where parameter= ' Nls_characterset '; ParameterValue------------------------------------------------------------nls_charactersetal32utf8 $ echo $ oracle_base/data/app/oracle $ Echo $ORACLE _home/data/app/oracle/product/12.2.0.1/db_1 2. Preparations need to be prepared before they are implemented: The database software is installed on the disaster recovery side, in order to avoid unnecessary trouble, the software catalog and data file directory structure is consistent with the main library. If the data file structure on both ends is inconsistent, you will need to restart the database. Modify the Master repository/etc/hosts file. 3. Make sure the main library is in archive Mode SQL> archive log list;database log modearchiveModeautomatic archivalenabledarchive destination+dataoldest Online log sequence 2314Next log sequence to archive 2315Curr ENT log sequence2315 should be modified to archive mode if it is in non-archive mode. 4. Modify the main library to strong log mode sql> select Force_logging from v$database; for---no is checked for not strong log mode, first modified to strong log mode, The command follows:sql> ALTER DATABASE force LOGGING;  5 to create the same directory structure step omitted, referring to the preceding output to create the 6. Main Library Modify Parameters Sql>alter System set Standby_file_management=auto scope=both sid= ' * '; alter system set FAL_SERVER=ORCL scope=both sid= ' * '; alter System set log_archive_config= ' dg_config= (orcl,standby) ' Scope=both sid= ' * '; alter system set log_archive_dest_1= ' Location=/data/arch valid_for= (all_logfiles,all_roles) DB_UNIQUE_NAME=ORCL ' sid= ' *; 7. Configure TNSNAMES.ORAORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.190.60) (PORT = 1521)) &NB Sp (Connect_data = (SERVER = dedicated) (service_name = ORCL) ) &N Bsp ) standby = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.190.61) (PORT = 1521)) (connect_ DATA = (SERVER = dedicated) (service_name = standby) ) ) & Nbsp; 8. Transferring the parameter file and password file to the Repository 9. Main library using Rman backup rman> run{allocate channel CH1 type disk;allocate channel CH2 Type Disk;backup database format '/data/backup/dbf_%d_%t_%s_%p '; SQL ' alter system archive log current '; Backup Archivelog All format '/data/backup/arc_%d_%t_%s_%p ' delete input;backup current controlfile for standby format '/data/backup/ Control01.ctl ';} Transfer the backup file to the standby repository. 10. Start standby to Nomount state sql> startup Nomount; modify db_unique_namesql> ALTER SYSTEM SET db_unique_name=standby Scope=spfile; Note: db_name must be consistent on both sides of the main repository, db_unique_name must be inconsistent. Repository modification parameters alter system set db_file_name_convert= '/data/oradata/orcl ', '/DATA/ORADATA/ORCL ' scope=spfile; alter System set log_file_name_convert= '/data/oradata/orcl ', '/DATA/ORADATA/ORCL ' scope=spfile; reboot to make the parameters effective:sql> shutdown immediate; sql> startup nomount; 11. Recovery control File rman> restore standby controlfile from '/data/backup/control01.ctl '; Nbsp; 12. Start the standby to Mount state rman> ALTER DATABASE mount; 13. Restore the Repository rman> restore database; Rman> recover database; 14. Add standby LogFiles (performed in both main and standby) check current environment logfilesql> set lines pages 300col Member for A60select a.thread#,a.group#,b.member,b.type,a.bytes/1024/1024 MB from V$log a,v$logfile b where a.group#= B.group#union allselect a.thread#,a.group#,b.member,b.type,a.bytes/1024/1024 MB from V$standby_log a,v$logfile b where a.group#=b.group#; thread# group# membertype MB------------------------------------------------- ------------------------------------------------ 11/data/oradata/orcl/redo01.logonline200 13/data/ oradata/orcl/redo03.logonline200 12/data/oradata/orcl/redo02.logonline200 sql> ALTER DATABASE Add standby logfile Group '/data/oradata/orcl/redo14.log ' size 200m, group '/data/oradata/orcl/redo15.log ' size 200m, group '/data/oradata/orcl/redo16.log ' size 200m, group '/data/oradata/ Orcl/redo17.log ' size 200m; 15. Restore Open in main vault SQL> alter system set log_archive_dest_2= ' Service=standby LGWR Async compression=enable valid_for= (online_logfiles,primary_role) Db_unique_name=standby ' Scope=both; Note: Check Log_ The archive_dest_state_1 and log_archive_dest_state_2 parameters are set to enable, and if not set to enable, there may be a problem when switching. 16. In the repository open standby modify parameter Local_listener parameter modified to standby Host alter system set log_archive_dest_1= ' Location=/data/arch valid_for= (all _logfiles,all_roles) Db_unique_name=standby ' scope=both; alter system set local_listener= ' (ADDRESS= (PROTOCOL= TCP) (host=192.168.190.61) (port=1521)) ' scope=both; sql> ALTER DATABASE open read only; sql> Recover managed Standby database using current logfile disconnect; 17. Check whether the build is successful on the main library to cut the archive SQL> Alter system archive log current; Sql> alter system archive log current; Sql> Archive Log list;database log modearchive modeautomatic archivalenabledarchive destination/data/archoldest Online log sequence 142Next log sequence to archive 143Current Log sequence144 Reserve query to apply $ orac-dgarc Session altered. sequence# first_timenext_timeapplied archived---------------------------------------------- --------------------- 135 2018-07-18 00:00:09 2018-07-18 03:40:02 YES yes 136 20 18-07-18 03:40:02 2018-07-18 03:40:03 Yes yes 137 2018-07-18 03:40:03 2018-07-18 10:12:50 YES YES  ; 138 2018-07-18 10:12:50 2018-07-18 14:31:00 YES yes 139 2018-07-18 14:31:00 2018-07-18 1 6:00:59 Yes yes 2018-07-18 16:00:59 2018-07-18 16:02:42 YES yes 141 2018-07-18 16:02:42 2018-07-18 16:03:27 YES yes 142 2018-07-18 16:03:27 2018-07-18 16:03:31 Yes yes 143 2018-07-18 16:03:31 2018-07-18 16:08:01 YES yes 1 2018-07-18 16:08:01 2018-07-18 16:10:03 in-memory YES Check standby al ERT log, no error, instructions to build successfully $ Orac-log db 202018-07-18t16:03:31.294903+08:00recovery of Online Redo log:thread 1 Group S EQ 143 Reading Mem 0 mem# 0:/data/oradata/orcl/redo15.log2018-07-18t16:08:01.891964+08:00rfs[1]: Selected log + F or T-1. S-144 dbid 1507958524 Branch 9801777902018-07-18t16:08:01.892027+08:00archived Log entry added for T-1. S-143 ID 0x59e1d0fc lad:12018-07-18t16:08:01.974669+08:00media Recovery waiting for thread 1 sequence 144 (in transit) 2018 -07-18t16:08:01.974916+08:00recovery of Online Redo log:thread 1 Group-Seq 144 Reading mem 0 mem# 0:/data/orada TA/ORCL/REDO14.LOG2018-07-18T16:10:04.097893+08:00RFS[1]: Selected log for T-1. S-145 dbid 1507958524 Branch 9801777902018-07-18t16:10:04.097907+08:00archiVed Log entry added for T-1. S-144 ID 0x59e1d0fc lad:12018-07-18t16:10:04.180686+08:00media Recovery waiting for thread 1 sequence 145 (in transit) 2018 -07-18t16:10:04.180958+08:00recovery of Online Redo log:thread 1 Group Seq 145 Reading mem 0 mem# 0:/data/orada ta/orcl/redo15.log
Oracle 12C R2 on Linux 7.X Data Guard Build document