Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle12C single instance dataguard configuration

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Oracle user environment variable configuration:

ORACLE_BASE=/orcl/app/oracle

ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1

ORACLE_SID=orcl

Export ORACLE_BASE ORACLE_HOME ORACLE_SID

PATH=$ORACLE_HOME/bin:$PATH

Export PATH

Export NLS_LANG=american_america.AL32UTF8

Main library:

1. Set the primary database to force logging mode

Select force_logging from v$database

Alter database force logging

two。 Create a password file (if not)

Orapwd file=$ORACLE_HOME/dbs/orapworcl password=syspassword entries=30

3. Put the main library in archive mode

Shutdown immediate

Startup mount

Alter database archivelog

Alter database open

4. Disabled selinux

Cat / etc/selinux/config | grep 'SELINUX'

5. Configure standby redo log

Select GROUP#,BYTES/1024/1024 size_M,STATUS,ARCHIVED from vault log; # query the current log group size

Alter database add standby logfile group 4 ('/ orcl/app/oracle/oradata/orcl/standbyrd01.log') size 200m

Alter database add standby logfile group 5 ('/ orcl/app/oracle/oradata/orcl/standbyrd02.log') size 200m

Alter database add standby logfile group 6 ('/ orcl/app/oracle/oradata/orcl/standbyrd03.log') size 200m

Alter database add standby logfile group 7 ('/ orcl/app/oracle/oradata/orcl/standbyrd04.log') size 200m

Alter database drop standby logfile group 4; # Delete

Select group#,thread#,sequence#,archived,status from vault standby log; # Verification

6. Generate control file

Alter database create standby controlfile as'/ orcl/app/oracle/oradata/orcl/orcldg01.ctl'

7. Generate initialization parameter file

Create pfile from spfile

Vi $ORACLE_HOME/dbs/initorcl.ora (add the following)

* .log_file_name_convert='/orcl/app/oracle/oradata/orcl/','/orcl/app/oracle/oradata/orcl/'

* .db_unique_name='orcl1'

* .fal_client='orcl1'

* .fal_server='orcldg'

* .log_archive_config='DG_CONFIG= (orcl1,orcldg)'

* .log_archive_dest_1='LOCATION=/orcl/app/oracle/oradata/orcl/ VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl1'

* .log_archive_dest_2='SERVICE=orcldg LGWR ASYNC VALID_FOR= (ALL_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=orcldg'

* .log_archive_dest_state_1='ENABLE'

* .log_archive_dest_state_2='ENABLE'

* .standby_file_management='AUTO'

* .remote_login_passwordfile='EXCLUSIVE'

* .log_archive_format=%t_%s_%r.arc

Create spfile from pfile='initorcl.ora'

8. Modify the listener.ora file

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = nginx01) (PORT = 1521))

(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))

)

)

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = orcl)

(SID_NAME = orcl)

)

)

ADR_BASE_LISTENER=/orcl/app/oracle

9. Modify the tnsnames.ora file

ORCL =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = nginx01) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = orcl)

)

)

ORCLDG =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = nginx01-dg) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = orcldg)

)

)

10. Shutdown immediate

11. Transfer control files, initialization parameter files, monitoring files, password files to the standby machine

Cd / orcl/app/oracle/product/12.2.0/db_1/network/admin

Scp listener.ora nginx01-dg:/orcl/app/oracle/product/12.2.0/db_1/network/admin

Scp tnsnames.ora nginx01-dg:/orcl/app/oracle/product/12.2.0/db_1/network/admin

Scp sqlnet.ora nginx01-dg:/orcl/app/oracle/product/12.2.0/db_1/network/admin

Cd / orcl/app/oracle/oradata/orcl

Scp orcldg01.ctl nginx01-dg:/orcl/app/oracle/oradata/orcl/

Cd / orcl/app/oracle/product/12.2.0/db_1/dbs

Scp initorcl.ora nginx01-dg:/orcl/app/oracle/product/12.2.0/db_1/dbs/initorcl.ora

Scp orapworcl nginx01-dg:/orcl/app/oracle/product/12.2.0/db_1/dbs/orapworcl

twelve。 RMAN backup and restore to standby on the main library:

1. The main library starts to mount state, and the standby library starts to nomount state.

2. Rman target sys/abcd1234@orcl auxiliary sys/abcd1234@orcldg

3. Duplicate target database for standby nofilenamecheck from active database; # master / slave machine directories consistently use nofilenamecheck parameters

Prepare the library:

1. Disabled selinux

Cat / etc/selinux/config | grep 'SELINUX'

two。 Create a directory

Mkdir-p / orcl/app/oracle/oradata/orcl/

Mkdir-p / orcl/app/oracle/admin/orcl/adump

3. Modify the initialization parameter file initorcl.ora file passed from the main library

* .control_files='/orcl/app/oracle/oradata/orcl/orcldg01.ctl','/orcl/app/oracle/oradata/orcl/orcldg02.ctl'

* .log_file_name_convert='/orcl/app/oracle/oradata/orcl/','/orcl/app/oracle/oradata/orcl/'

* .db_unique_name='orcldg'

* .fal_client='orcldg'

* .fal_server='orcl1'

* .log_archive_config='DG_CONFIG= (orcl1,orcldg)'

* .log_archive_dest_1='LOCATION=/orcl/app/oracle/oradata/orcl/ VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcldg'

* .log_archive_dest_2='SERVICE=orcl1 LGWR ASYNC VALID_FOR= (ALL_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=orcl1'

* .log_archive_dest_state_1='ENABLE'

* .log_archive_dest_state_2='ENABLE'

* .standby_file_management='AUTO'

* .log_archive_format=%t_%s_%r.arc

* .remote_login_passwordfile='EXCLUSIVE

4. Listener.ora and tnsnames.ora files do not need to be modified.

5. Start (after the rman backup restore is complete)

Alter database mount standby database

Alter database open read only

Alter database recover managed standby database disconnect from session

Alter database set standby database to maximize availability

6. Query verification

Select switchover_status,open_mode,database_role,db_unique_name,protection_mode,protection_level from v$database

Select SEQUENCE#,FIRST_TIME,NEXT_TIME, APPLIED from v$archived_log order by 1

Select max (sequence#) from v$log

7. Shutdown

Alter database recover managed standby database cancel

Shutdown immediate

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report