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

Oracle 11g R2 ADG build

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

-- = Oracle ADG build =

-= preparation stage =

1. Check that primary is in archivelog mode.

Select log_mode from v$database

If it is noarchivelog mode, switch to archivelog mode.

Shutdown immediate

Startup mount

Alter database archivelog

Alter database open

Perform forced logging:

Alter database force logging

two。 Service configuration.

Primay and standby resolve members in DG based on tnsname, with "$ORACLE_HOME/network/admin/tnsnames.ora" configured on the server.

You can use netca or create it manually.

SICILY =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = sicily)

)

)

SICILYBAK =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = sicilybak)

)

)

3. Record the db_name and db_unique_name of primary and standby.

Show parameter db_name

Show parameter db_unique_name

Role db_name db_unique_name

Primary sicily sicily

Standby sicily sicilybak

Standby and primary have the same db_name, but different db_unique_name.

The db_unique_name of primary and standby is used to configure the dg_config parameter of log_archive_config.

Executed on primary and standby, with parameter values of primary and db_unique_name of all standby members.

Alter system set log_archive_config='dg_config= (sicily,sicilybak)'

4. Sets the remote archive path.

The default local location archive path is in fast recovery area, and the size of the flashback area should be set large enough. (not recommended)

In general, modify log_archive_dest_1

1) View the path location of the archive file

Show parameter log_archive_dest_1

2) close the database

Alter database chenkpoint

Shutdown immediate

3) Mount the database

Start mount

4) modify the archive path

Alter system set log_archive_dest_1='LOCATION=/oracle/archive'

5) start the database

Alter database open

6) check whether it is effective

Select archiver from v$instance

Alter system switch logfile

Ls / oracle/archive

Note the service and db_unique_name associated with standby in the remote archive path.

ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=sicilybak NOAFFIRM ASYNC compression=enable VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sicilybak'

ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE

ALTER SYSTEM SET LOG_ARCHIVE_FORMAT='%t_%s_%r.arc' SCOPE=SPFILE

ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES=30

ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE SCOPE=SPFILE

If you need to switchover back and forth between primary and standby to change primary to standby role, you need to set the * _ convert parameter to ensure that the file names and paths between servers are different.

-- the service name is configured here, indicating where to get the log when GAP appears.

ALTER SYSTEM SET FAL_SERVER=sicilybak

Here is to replace the previous string with the following string

-- ALTER SYSTEM SET DB_FILE_NAME_CONVERT='sicilybak','sicily' SCOPE=SPFILE

-- ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='sicilybak','sicily' SCOPE=SPFILE

ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO

Note that some parameters cannot be modified and will take effect after the database is restarted.

-- = backup =

1.primary backup

$rman target /

RMAN > backup database as compressed backupset format'/ oracle/rman/full_%D_%u.bak'

two。 Create a standby control file

-- execute on primary

ALTER DATABASE CREATE STANDBY CONTROLFILE AS'/ oracle/rman/standby.ctl'

3. Create a standby parameter file PFILE

CREATE PFILE='/oracle/rman/pfile' FROM SPFILE

4. Modify the configuration of PFILE related to standby. Since it is a copy of the source server, you only need to modify the following parameters.

* .db_unique_name='sicilybak'

* .fal_server='sicily'

* .log_archive_dest_2='SERVICE=sicily ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sicily'

-- = copy =

1. Create directories listed in the data file directory, archive log file directory, audit directory, and other parameter files on standby

$mkdir-p / oracle/rman

$mkdir-p / oracle/archive

$mkdir-p / oracle/oradata/sicily

two。 Copy files from primary to standby

$# Standby controlfile to all locations.

$scp oracle@10.198.195.163:/oracle/rman/standby.ctl / oracle/rman/control01.ctl

$cp / oracle/rman/control01.ctl / oracle/fast_recovery_area/sicily/control02.ctl

$# Archivelogs

$scp-r oracle@10.198.195.163:/oracle/archive / oracle/archive

$# Parameter file.

$scp oracle@10.198.195.163:/oracle/rman/pfile / oracle/rman/pfile

$# Remote login password file.

$scp oracle@10.198.195.163:$ORACLE_HOME/dbs/orapw$ORACLE_SID $ORACLE_HOME/dbs

Note that if your backup is in the flashback area, you need to copy the flashback area backup to standby

If your backup is not in the flashback area, be sure to copy it to the same directory as primary.

-- = restore =

1. Create SPFILE with PFILE

Create spfile from pfile='/oracle/rman/pfile'

two。 Restore control file

RMAN > restore controlfile from'/ oracle/rman/standby.ctl'

3. Restore backup

RMAN > startup mount

RMAN > restore database

-- = create online redo logs and standby redo logs=

1. Create an online redo logs for standby, preferably consistent with primary

ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=MANUAL

ALTER DATABASE ADD LOGFILE ('/ oracle/oradata/sicily/redo01.log') SIZE 50m

ALTER DATABASE ADD LOGFILE ('/ oracle/oradata/sicily/redo02.log') SIZE 50m

ALTER DATABASE ADD LOGFILE ('/ oracle/oradata/sicily/redo03.log') SIZE 50m

ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO

two。 Create a standby redo logs for standby, and if the primary is to be switched to the standby role, it should also be built on primary.

Standby redo logs should be at least as big as the largest online redo log and one more than online redo logs.

ALTER DATABASE ADD STANDBY LOGFILE ('/ oracle/oradata/sicily/standby_redo01.log') SIZE 50m

ALTER DATABASE ADD STANDBY LOGFILE ('/ oracle/oradata/sicily/standby_redo02.log') SIZE 50m

ALTER DATABASE ADD STANDBY LOGFILE ('/ oracle/oradata/sicily/standby_redo03.log') SIZE 50m

ALTER DATABASE ADD STANDBY LOGFILE ('/ oracle/oradata/sicily/standby_redo04.log') SIZE 50m

-- = start the application process =

# Background redo apply. Control is returned to the session once the apply process is started.

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION

# you need to cancel the apply process, issue the following command.

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL

ALTER DATABASE OPEN READ ONLY

# you have configured standby redo logs, you can start real-time apply using the following command.

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT

-= check =

Select database_role,LOG_MODE,PROTECTION_MODE,PROTECTION_LEVEL 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: 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