=========================
primary
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u03
Oldest online log sequence 3
Next log sequence to archive 5
Current log sequence 5
SQL>
ALTER DATABASE FORCE LOGGING;
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/test/redo01a.log
/u01/app/oracle/oradata/test/redo01b.log
/u01/app/oracle/oradata/test/redo02a.log
/u01/app/oracle/oradata/test/redo02b.log
/u01/app/oracle/oradata/test/redo03a.log
/u01/app/oracle/oradata/test/redo03b.log
SQL> select group# from v$log;
GROUP#
----------
1
2
3
Database altered.
alter database add standby logfile group 4 '/u01/app/oracle/oradata/test/redo04b.log' size 300m;
alter database add standby logfile group 5 '/u01/app/oracle/oradata/test/redo05a.log' size 300m;
alter database add standby logfile group 6 '/u01/app/oracle/oradata/test/redo06a.log' size 300m;
if multiplexing you can use as below
alter database add standby logfile group 7 ('/u01/app/oracle/oradata/test/redo07a.log','/u01/app/oracle/oradata/test/redo07b.log') size 300m;
SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;
GROUP# THREAD# SEQUENCE# ARC STATUS
---------- ---------- ---------- --- ----------
4 0 0 YES UNASSIGNED
5 0 0 YES UNASSIGNED
6 0 0 YES UNASSIGNED
ALTER SYSTEM SET db_unique_name='test' SCOPE=SPFILE;
ALTER SYSTEM SET log_archive_config='dg_config=(test,test_stand)' SCOPE=SPFILE;
ALTER SYSTEM SET log_archive_dest_1='location=/u01/app/archive valid_for=(all_logfiles,all_roles) db_unique_name=test' SCOPE=SPFILE;
ALTER SYSTEM SET log_archive_dest_2='service=test_stand async valid_for=(online_logfiles,primary_role) db_unique_name=test_stand' scope=spfile;
SQL> ALTER SYSTEM SET fal_server='test_stand' SCOPE=SPFILE;
System altered.
11gr2 no longer required for fal_client;
SQL> ALTER SYSTEM SET fal_client='test' SCOPE=SPFILE;
System altered.
SQL> ALTER SYSTEM SET standby_file_management='AUTO' SCOPE=SPFILE;
system altered.
ALTER SYSTEM SET db_file_name_convert='/u01/app/oracle/oradata/test_stand','/u01/app/oracle/oradata/test' SCOPE=SPFILE;
System altered.
SQL> ALTER SYSTEM SET log_file_name_convert='/u01/app/oracle/oradata/test_stand','/u01/app/oracle/oradata/test' SCOPE=SPFILE;
System altered.
[oracle@PRD01 dbs]$ scp orapwtest prd02:/u02/app/oracle/product/12.2.0/dbhome_1/dbs
oracle@prd02's password:
orapwtest 100% 6144 2.6MB/s00:00
[oracle@PRD01 dbs]$
[oracle@prd02 dbs]$ mv orapwtest orapwtest_stand
[oracle@prd02 dbs]$
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;
ALTER SYSTEM SET LOG_ARCHIVE_FORMAT='%t_%s_%r.arc' SCOPE=SPFILE;
SQL> ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES=30;
System altered.
SQL> ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE SCOPE=SPFILE;
System altered.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
configure listener and
tnsnames.ora on both the side , it should be ping able from both the end.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
cp pfile from primary to secondary
make neccessary change in secondary/
startup nomount =======standby
on primary
rman target sys/Welcome_231@test auxiliary sys/Welcome_231@test_stand
RMAN> connect auxiliary sys/XX@dup
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-04006: error from auxiliary database: ORA-01017: invalid username/password; logon denied
recreate password for sys in oracle and create orapwd file as below
orapwd file=orapwtest password=Welcome_231 force=y entries=10
rman TARGET sys/Welcome_123@test AUXILIARY sys/Welcome_123@test_stand
[oracle@demo dbs]$ rman target /
Recovery Manager: Release 12.2.0.1.0 - Production on Tue Feb 23 13:50:24 2021
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
connected to target database: TEST (DBID=2362193459)
RMAN> connect auxiliary sys/Welcome_231@test_stand
connected to auxiliary database: TEST (not mounted)
duplicate target database for standby from active database nofilenamecheck;
select name,database_role,open_mode from v$database;
Enable the recovery:
SQL> alter database recover managed standby database disconnect from session;
SELECT ARCH.THREAD# “Thread”, ARCH.SEQUENCE# “Last Sequence Received”, APPL.SEQUENCE# “Last Sequence Applied”, (ARCH.SEQUENCE# – APPL.SEQUENCE#) “Difference” FROM (SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL WHERE ARCH.THREAD# = APPL.THREAD# ORDER BY 1;
SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
How To Enable Active Dataguard In Physical Standby Database
SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# APPLIED
---------- ---------
16 YES
17 YES
18 IN-MEMORY
SQL> /
SEQUENCE# APPLIED
---------- ---------
16 YES
17 YES
18 YES
19 YES
20 YES
21 IN-MEMORY
6 rows selected.
SQL> alter database recover managed standby database cancel;
Database altered.
alter database recover managed standby database cancel;
SQL> alter database open;
Database altered.
SQL> select name,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
TEST READ ONLY
start the media recover
alter database recover managed standby database using current logfile disconnect from session;
SQL> select name,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
TEST READ ONLY WITH APPLY
SELECT NAME,OPEN_MODE,DATABASE_ROLE,PROTECTION_MODE FROM V$DATABASE;
select * from v$logfile;
select b.thread#,a.group#, a.type, a.member, b.bytes FROM v$logfile a, v$standby_log b WHERE a.group# = b.group#;
SELECT NAME,OPEN_MODE,DATABASE_ROLE,PROTECTION_MODE FROM V$DATABASE;
Thanks
Ravi
No comments:
Post a Comment