Use RMAN to build a Data Guard environment (maximize performance)

Source: Internet
Author: User

Master database:
-- Check whether archiving is enabled for the master database
Archive log list;

-- If archive is not enabled for the master database, archive is enabled.
-- Set the archive path
Alter system set log_archive_dest_1 = 'location =/u02/archivelog ';
-- Restart the database
Shutdown immediate;
Startup mount;
-- Enable Archiving
Alter database archivelog;
-- Enable the Force log writing Option
Alter database force logging;
-- Open the database
Alter database open;
-- Alter database add standby logfile group 11 ('/u02/standby/sta_redo11.log') size 50 M;

-- Create the static parameter file of the current database
Create pfile = '/home/Oracle/initC2155.ora' from spfile;

-- Modify the static parameter file created above and add:
DB_UNIQUE_NAME = pridb
LOG_ARCHIVE_CONFIG = 'dg _ CONFIG = (pridb, stadb )'
LOG_ARCHIVE_DEST_1 = 'location =/u02/archivelog
VALID_FOR = (ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME = pridb'
LOG_ARCHIVE_DEST_2 = 'service = stadb LGWR ASYNC
VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME = stadb'
LOG_ARCHIVE_DEST_STATE_1 = ENABLE
LOG_ARCHIVE_DEST_STATE_2 = ENABLE
REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE
FAL_SERVER = stadb
FAL_CLIENT = pridb
STANDBY_FILE_MANAGEMENT = AUTO

-- Restart the database
Shutdown immediate;
-- Use the modified static parameter file to start the database
Startup pfile = '/home/oracle/initC2155.ora ';

-- Use the modified static parameter file to create a dynamic parameter file
Create spfile from pfile = '/home/oracle/initC2155.ora ';

-- Use rman to back up the master database
Rman target/
-- Backup the control file of the master database
Backup format'/home/oracle/backup/ctl _ % U' current controlfile for standby;
-- Back up data files in the master database
Backup format'/home/oracle/backup/dbf _ % U' database plus archivelog delete input;

 

Slave database:
-- Create a password file (same as the sys password of the master database)
Orapwd file = $ ORACLE_HOME/dbs/orapwC2155 password = db2admin entries = 3

-- Copy the static parameter file of the master database to the slave database and add/modify the file:
DB_UNIQUE_NAME = stadb
LOG_ARCHIVE_CONFIG = 'dg _ CONFIG = (pridb, stadb )'
LOG_ARCHIVE_DEST_1 = 'location =/u02/archivelog
VALID_FOR = (ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME = stadb'
LOG_ARCHIVE_DEST_2 = 'service = pridb LGWR ASYNC
VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME = pridb'
LOG_ARCHIVE_DEST_STATE_1 = ENABLE
LOG_ARCHIVE_DEST_STATE_2 = ENABLE
REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE
FAL_SERVER = pridb
FAL_CLIENT = stadb
STANDBY_FILE_MANAGEMENT = AUTO

-- Connect to the slave Database
Sqlplus/nolog
Conn/as sysdba

-- Use the modified static parameter file to create a dynamic parameter file
Create spfile from pfile = '/home/oracle/initC2155.ora ';

-- Copy the backup file of the master database to the slave database to keep the path of the backup file consistent.

-- Use rman to restore the standby database (the standby database has been loaded to the mount state)
Rman target sys/db2admin @ pridb auxiliary/

-- Duplicate target database for standby nofilenamecheck dorecover;
Duplicate target database for standby nofilenamecheck

-- Select * from v $ logfile;

-- Alter database drop standby logfile group 11;

-- Alter database add standby logfile group 11 ('/u02/standby/sta_redo11.log') size 50 M;

-- Restore application logs
Alter database recover managed standby database disconnect from session;
-- Alter database recover managed standby database cancel;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.