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

Oracle11g_dataguard building

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

Share

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

First make sure that the primary library is in archive mode

SQL > archive log list; forced archiving

SQL > alter database force logging

ALTER DATABASE ADD LOGFILE GROUP 4 ('/ John/app/oracle/oradata/carthage/redo04.log','/John/app/oracle/oradata/carthage/redo044.log') SIZE 200m

ALTER DATABASE ADD LOGFILE GROUP 5 ('/ John/app/oracle/oradata/carthage/redo05.log','/John/app/oracle/oradata/carthage/redo055.log') SIZE 200m

ALTER DATABASE ADD LOGFILE GROUP 6 ('/ John/app/oracle/oradata/carthage/redo06.log','/John/app/oracle/oradata/carthage/redo066.log') SIZE 200m

Alter system switch logfile

Alter system switch logfile

Alter system switch logfile

Alter system checkpoint; ALTER DATABASE DROP LOGFILE GROUP 1

ALTER DATABASE DROP LOGFILE GROUP 2

ALTER DATABASE DROP LOGFILE GROUP 3; # cd / John/app/oracle/oradata/carthage/

# rm-rf redo01.log

# rm-rf redo02.log

# rm-rf redo03.log ALTER DATABASE ADD LOGFILE GROUP 1 ('/ John/app/oracle/oradata/carthage/redo01.log','/John/app/oracle/oradata/carthage/redo011.log') SIZE 200m

ALTER DATABASE ADD LOGFILE GROUP 2 ('/ John/app/oracle/oradata/carthage/redo02.log','/John/app/oracle/oradata/carthage/redo022.log') SIZE 200m

ALTER DATABASE ADD LOGFILE GROUP 3 ('/ John/app/oracle/oradata/carthage/redo03.log','/John/app/oracle/oradata/carthage/redo033.log') SIZE 200m

ALTER DATABASE ADD standby LOGFILE GROUP 7 ('/ John/app/oracle/oradata/carthage/standby_redo01.log','/John/app/oracle/oradata/carthage/standby_redo011.log') SIZE 200m

ALTER DATABASE ADD standby LOGFILE GROUP 8 ('/ John/app/oracle/oradata/carthage/standby_redo02.log','/John/app/oracle/oradata/carthage/standby_redo022.log') SIZE 200m

ALTER DATABASE ADD standby LOGFILE GROUP 9 ('/ John/app/oracle/oradata/carthage/standby_redo03.log','/John/app/oracle/oradata/carthage/standby_redo033.log') SIZE 200m

ALTER DATABASE ADD standby LOGFILE GROUP 10 ('/ John/app/oracle/oradata/carthage/standby_redo04.log','/John/app/oracle/oradata/carthage/standby_redo044.log') SIZE 200m

ALTER DATABASE ADD standby LOGFILE GROUP 11 ('/ John/app/oracle/oradata/carthage/standby_redo05.log','/John/app/oracle/oradata/carthage/standby_redo055.log') SIZE 200m

ALTER DATABASE ADD standby LOGFILE GROUP 12 ('/ John/app/oracle/oradata/carthage/standby_redo06.log','/John/app/oracle/oradata/carthage/standby_redo066.log') SIZE 200m; $> mkdir-p / John/app/oracle/oradata/carthage/archive_dest

$> mkdir-p / John/app/oracle/oradata/carthage/standby_archive alter system set log_archive_dest_1='location=/John/app/oracle/oradata/carthage/archive_dest' scope=spfile

Alter system set standby_archive_dest='/John/app/oracle/oradata/carthage/standby_archive' scope=spfile

Alter system set standby_file_management='AUTO';-consistency closes the database and executes the following command: create pfile from spfile

2.3.2 modify pfile

Cp $ORACLE_HOME/dbs/initcarthage.ora $ORACLE_HOME/dbs/initcarthage.ora.bak

Vi $ORACLE_HOME/dbs/initcarthage.ora

* .db_unique_name='carthage'

* .diagnostic_dest='/John/app/oracle'

* .dispatchers=' (PROTOCOL=TCP) (SERVICE=powerdesXDB)'

* .fal_client='carthage'

* .fal_server='carthage_dg'

* .standby_file_management='AUTO'

* .db_file_name_convert='/John/app/oracle/oradata/carthage','/John/app/oracle/oradata/carthage'

* .log_file_name_convert='/John/app/oracle/oradata/carthage','/John/app/oracle/oradata/carthage'

* .log_archive_config='DG_CONFIG= (carthage,carthage_dg)'

* .log_archive_dest_2='SERVICE=carthage_dg lgwr sync affirm VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=carthage_dg'

* .log_archive_dest_state_2='ENABLE'

Listener.ora # listener.ora Network Configuration File: / John/app/oracle/product/11.2.0/dbhome_2/network/admin/listener.ora

# Generated by Oracle configuration tools. SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = PLSExtProc)

(ORACLE_HOME = / John/app/oracle/product/11.2.0/dbhome_2)

(PROGRAM = extproc)

)

(SID_DESC =

(SID_NAME = carthage)

(ORACLE_HOME = / John/app/oracle/product/11.2.0/dbhome_2)

)

) LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 10.25.10.130) (PORT = 10010))

(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC0))

)

) ADR_BASE_LISTENER = / John/app/oracle

Tnsnames.ora # tnsnames.ora Network Configuration File: / John/app/oracle/product/11.2.0/dbhome_2/network/admin/tnsnames.ora

# Generated by Oracle configuration tools. Hammer =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP) (HOST = 10.25.10.130) (PORT = 10010))

)

(CONNECT_DATA =

(SERVICE_NAME = carthage)

)

) carthage =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP) (HOST = 10.25.10.130) (PORT = 10010))

)

(CONNECT_DATA =

(SERVICE_NAME = carthage)

)

) carthage_dg =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP) (HOST = 10.25.10.131) (PORT = 10010))

)

(CONNECT_DATA =

(SERVICE_NAME = carthage)

)

) EXTPROC_CONNECTION_DATA =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC0))

)

(CONNECT_DATA =

(SID = PLSExtProc)

(PRESENTATION = RO)

)

)

2.6 restart of the listening service

Lsnrctl stop

Lsnrctl start

Startup pfile=/John/app/oracle/product/11.2.0/dbhome_2/dbs/initcarthage.ora

-- install database software on the repository

Scp tnsnames.ora listener.ora 10.25.10.131:/John/app/oracle/product/11.2.0/dbhome_1/network/admin/

Scp initcarthage.ora orapwcarthage 10.25.10.131:/John/app/oracle/product/11.2.0/dbhome_1/dbs/ cat listener.ora # listener.ora Network Configuration File: / John/app/oracle/product/11.2.0/dbhome_2/network/admin/listener.ora

# Generated by Oracle configuration tools. SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = PLSExtProc)

(ORACLE_HOME = / John/app/oracle/product/11.2.0/dbhome_1)

(PROGRAM = extproc)

)

(SID_DESC =

(SID_NAME = carthage)

(ORACLE_HOME = / John/app/oracle/product/11.2.0/dbhome_1)

)

) LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 10.25.10.131) (PORT = 10010))

(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC0))

)

) ADR_BASE_LISTENER = / John/app/oracle

Cat initcarthage.ora

Carthage.__db_cache_size=63350767616

Carthage.__java_pool_size=536870912

Carthage.__large_pool_size=536870912

Carthage.__oracle_base='/John/app/oracle'#ORACLE_BASE set from environment

Carthage.__pga_aggregate_target=53687091200

Carthage.__sga_target=80530636800

Carthage.__shared_io_pool_size=0

Carthage.__shared_pool_size=15032385536

Carthage.__streams_pool_size=0

* .audit_file_dest='/John/app/oracle/admin/carthage/adump'

* .audit_trail='db'

* .compatible='11.2.0.0.0'

* .control_files='/John/app/oracle/oradata/carthage/control01.ctl','/John/app/oracle/oradata/carthage/control02.ctl'

* .db_block_size=8192

* .db_domain=''

* .db_name='carthage'

* .db_unique_name='carthage_dg'

* .db_file_name_convert='/John/app/oracle/oradata/carthage','/John/app/oracle/oradata/carthage'

* .log_file_name_convert='/John/app/oracle/oradata/carthage','/John/app/oracle/oradata/carthage'

* .log_archive_config='DG_CONFIG= (carthage,carthage_dg)'

* .fal_client='carthage_dg'

* .fal_server='carthage'

* .db_recovery_file_dest='/John/app/oracle/flash_recovery_area'

* .db_recovery_file_dest_size=4070572032

* .diagnostic_dest='/John/app/oracle'

* .dispatchers=' (PROTOCOL=TCP) (SERVICE=carthageXDB)'

* .log_archive_dest_1='location=/John/app/oracle/oradata/carthage/archive_dest'

* .log_archive_dest_2='SERVICE=carthage lgwr sync affirm VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=carthage'

* .log_archive_format='%t_%s_%r.dbf'

* .memory_target=134055198720

* .open_cursors=300

* .processes=500

* .remote_login_passwordfile='EXCLUSIVE'

* .sessions=555

* .standby_archive_dest='/John/app/oracle/oradata/carthage/standby_archive'

* .standby_file_management='AUTO'

* .undo_tablespace='UNDOTBS1'

Mkdir-p / John/app/oracle/admin/carthage/adump

Mkdir-p / John/app/oracle/flash_recovery_area

Mkdir-p / John/app/oracle/oradata/carthage/standby_archive

Mkdir-p / John/app/oracle/oradata/carthage/archive_dest

Lsnrctl start

Lsnrctl status

-create catalog library-optional (catalog must be a remote library)-CREATE TABLESPACE catalog_tbs DATAFILE'/ John/app/oracle/oradata/carthage/catalog_tbs.dbf' SIZE 50m REUSE AUTOEXTEND ON NEXT 50m; CREATE USER rman IDENTIFIED BY rman DEFAULT TABLESPACE catalog_tbs; GRANT RECOVERY_CATALOG_OWNER TO rman

$rman catalog rman/rman

RMAN > CREATE CATALOG

RMAN > REGISTER DATABASE;--

Rman target sys/oracle@carthage auxiliary sys/oracle@carthage_dg nocatalog

Duplicate target database for standby from active database nofilenamecheck; recover managed standby database using current logfile disconnect from session; select process,client_process,sequence#,status from v$managed_standby

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

View the log information of DG

Select * from v$dataguard_status

Alter database set standby database to maximize availability;-switch to the maximum available alter database set standby database to maximize protection;-switch to maximum protection (if an error is reported when switching to maximum protection mode, you need to activate the standby to switch to mount status)

-- failover manual-

-- primary does the following

Alter database commit to switchover to physical standby

Shutdown immediate

Startup alter database recover managed standby database disconnect from session

Select database_role,switchover_status from vault database;-- the standby side does the following

Alter database commit to switchover to primary

Shutdown immediate

Startup

Alter system switch logfile

Select database_role,switchover_status from vault database;-ADG do (fail over) handover test-

-- check status on the standby side

Select open_mode from v$database

-- We manually simulate the collapse of primary through shutdown abort, and directly shut down:-- the terminal.

Shutdown abort;-- perform the following operation on the standby side: startup mount

Alter system flush redo to 'carthage'; select thread#, low_sequence#, high_sequence# from vastly archived failover;-- if no obvious failover phenomenon is found, there will be no data loss. On the standby side, close the apply and end the application

Alter database recover managed standby database cancel

Alter database recover managed standby database finish

Select open_mode, switchover_status from v$database

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: 291

*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