Logical design

honggarae 11/10/2021 970

Logical database

Role switching

1. Switch the database to the role of the logical standby database.

SQL>ALTERDATABASECOMMITTOSWITCHOVERTOLOGICALSTANDBY;

2, stop the remote archiving operation.

SQL>ALTERSYSTEMSETLOG_ARCHIVE_DEST_STATE_2=DEFERSCOPE=BOTH;

3. Switch one of the standby libraries to the role of the main library.

SQL>ALTERDATABASECOMMITTOSWITCHOVERTOPRIMARY;

4, open the remote archive operation.

SQL>ALTERSYSTEMSETLOG_ARCHIVE_DEST_STATE_2=ENABLESCOPE=BOTH;

5. Create a connection to the main database on the new standby database.

Create connection

SQL>EXECUTEDBMS_LOGSTDBY.GUARD_BYPASS_ON;

SQL>CREATEDATABASELINKlocation1

2>CONNECTTOuser-nameIDENTIFIEDBYpasswordUSING'location1';

p>

SQL>EXECUTEDBMS_LOGSTDBY.GUARD_BYPASS_OFF;

Test the database connection

SQL>SELECT*FROMDBA_LOGSTDBY_PARAMETERS@location1;

6, open the SQL application in the new On the standby database.

SQL>ALTERDATABASESTARTLOGICALSTANDBYAPPLYNEWPRIMARYlocation1;

7. Do daily miscellaneous archiving operations on the main database and test the success of role switching.

SQL>ALTERSYSTEMARCHIVELOGSTART;

SQL>ALTERSYSTEMSWITCHLOGFILE;

Failure start

If the main database of DATAGUARD cannot be started, it is necessary to change The standby database is activated, temporarily or permanently replacing the main database!

SQL>ALTERDATABASESTOPLOGICALSTANDBYAPPLY;

SQL>ALTERDATABASEACTIVATELOGICALSTANDBYDATABASE;

Then do database recovery or other response operations or role conversion as above!

Archive log

If the archive log of the main database of DATAGUARD cannot be transferred to the standby database for uncertain and unpredictable reasons! Then you need to manually add the registration to the standby database!

Identify the missing archive log

SQL>COLUMNFILE_NAMEFORMATa55;

SQL>SELECTTHREAD#,SEQUENCE#,FILE_NAMEFROMDBA_LOGSTDBY_LOGL

2>WHERENEXT_CHANGE# NOTIN

3>(SELECTFIRST_CHANGE#FROMDBA_LOGSTDBY_LOGWHEREL.THREAD#=THREAD#)

4>ORDERBYTHREAD#,SEQUENCE#;

THREAD#SEQUENCE#FILE_NAME p>

16/disk1/oracle/dbs/log-1292880008_6.arc

110/disk1/oracle/dbs/log-1292880008_10.arc

copy the missing archive log To the standby database

copy file

register incomplete archive log

SQL>ALTERDATABASEREGISTERLOGICALLOGFILE

2>'/disk1/oracle /dbs/log-1292880008_7.arc';

Databasealtered.

SQL>ALTERDATABASEREGISTERLOGICALLOGFILE

2>'/disk1/oracle/dbs/log-1292880008_11. arc';

Databasealtered.

Common query statements

1. Query the role of the database.

Selectdatabase_rolefromv$database;

2, determine whether the redo log is applied to the standby database.

Selectapplied_scn,newest_scnfromdba_logstdby_progress;

3. Confirm the registration of redo data.

SELECTSEQUENCE#,FIRST_TIME,NEXT_TIME,DICT_BEGIN,DICT_ENDFROMDBA_LOGSTDBY_LOGORDERBYSEQUENCE#;

4. Confirm the application of redo data.

SELECTNAME,VALUEFROMV$LOGSTDBY_STATSWHERENAME='coordinatorstate';5,Dataguard access mode selectguard_statusfromv$database;

Other management

Run DDL statements on the logical standby database SQL & gt; ALTERDATABASESTOPLOGICALSTANDBYAPPLY; Databasealtered.SQL & gt; EXECUTEDBMS_LOGSTDBY.GUARD_BYPASS_ON; PL / SQLproceduresuccessfullycompleted.SQL & gt; ALTERTABLESCOTT.EMPADDCONSTRAINTEMPIDUNIQUE (EMPNO); Tablealtered.SQL & gt; EXECUTEDBMS_LOGSTDBY.GUARD_BYPASS_OFF; PL / SQLproceduresuccessfullycompleted.SQL & gt; ALTERDATABASESTARTLOGICALSTANDBYAPPLY; Databasealtered.2: added to the logical database When the data file is added or modified on the main database, if there is no response path on the standby database or there is no matching space left, the execution operation on the standby database will fail. SQL>selectevent,status_code,statusfromdba_logstdby_events; SQL>EXECUTEDBMS_LOGSTDBY.GUARD_BYPASS.

Latest: Dedicated system

Next: Modern bioengineering