CentOS 5.8上搭建10g物理DG

wxjzqym發表於2014-04-01

I.Preparing the Primary Database
1.1 Enable Forced Logging
SQL> ALTER DATABASE FORCE LOGGING;

1.2 Create Password File
orapwd file=orapwORCL password=dgok_#1985 entries=5 force=y

1.3 Configure a Standby Redo Log
Determine the appropriate number of standby redo log file groups.
(maximum number of logfiles for each thread + 1) * maximum number of threads

Create standby redo log file groups
ALTER DATABASE ADD STANDBY LOGFILE GROUP 11
   '/opt/oracle/oradata/ORCL/std11.log' SIZE 500M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 12
   '/opt/oracle/oradata/ORCL/std12.log' SIZE 500M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 13
   '/opt/oracle/oradata/ORCL/std13.log' SIZE 500M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 14
   '/opt/oracle/oradata/ORCL/std14.log' SIZE 500M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 15
   '/opt/oracle/oradata/ORCL/std15.log' SIZE 500M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 16
   '/opt/oracle/oradata/ORCL/std16.log' SIZE 500M;

Verify the standby redo log file groups were created.
SQL> SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;

1.4 Set Primary Database Initialization Parameters
Primary Database: Primary Role Initialization Parameters
DB_NAME=ORCL
DB_UNIQUE_NAME=ORCL
LOG_ARCHIVE_CONFIG='DG_CONFIG=(ORCL,ORCLDG1)'
LOG_ARCHIVE_DEST_1=
 'LOCATION=/crmbak/rman/arch
  VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
  DB_UNIQUE_NAME=ORCL'
LOG_ARCHIVE_DEST_2=
 'SERVICE=ORCLDG1 LGWR ASYNC
  VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
  DB_UNIQUE_NAME=ORCLDG1'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
LOG_ARCHIVE_MAX_PROCESSES=30

Primary Database: Standby Role Initialization Parameters
FAL_SERVER=ORCLDG1
FAL_CLIENT=ORCL
STANDBY_FILE_MANAGEMENT=AUTO

1.5 Enable Archiving
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP MOUNT;
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER DATABASE OPEN;

II.Creating a Physical Standby Database
2.1 Create a Backup Copy of the Primary Database Datafiles

2.2 Create a Control File for the Standby Database
SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/tmp/ORCLDG1.ctl';

2.3 Set Standby Database Initialization Parameters
Create the primary database parameter file
SQL> CREATE PFILE='/tmp/initORCLDG1.ora' FROM SPFILE;


Set initialization parameters
Modifying Initialization Parameters for a Physical Standby Database
DB_NAME=ORCL
DB_UNIQUE_NAME=ORCLDG1
LOG_ARCHIVE_CONFIG='DG_CONFIG=(ORCL,ORCLDG1)'
LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
LOG_ARCHIVE_DEST_1=
 'LOCATION=/opt/oracle/arch
  VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
  DB_UNIQUE_NAME=ORCLDG1'
LOG_ARCHIVE_DEST_2=
 'SERVICE=ORCL LGWR ASYNC
  VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
  DB_UNIQUE_NAME=ORCL'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
STANDBY_FILE_MANAGEMENT=AUTO
FAL_SERVER=ORCL
FAL_CLIENT=ORCLDG1

2.4 Copy Files from the Primary System to the Standby System
backupset
standby controlfile
parameter file

2.5 Set Up the Environment to Support the Standby Database
Create a password file
orapwd file=orapwORCLDG1 password=dgok_#1985 entries=5 force=y

Configure listeners for the primary and standby databases.
lsnrctl stop
lsnrctl start

Create Oracle Net service names
ORCL   --primary database
ORCLDG1   --standby database

Create a server parameter file for the standby database
SQL> CREATE SPFILE FROM PFILE='/tmp/initORCLDG1.ora';

2.6 Start the Physical Standby Database
SQL> STARTUP MOUNT;
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

2.7 Verify the Physical Standby Database Is Performing Properly
Identify the existing archived redo log files
SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

Force a log switch to archive the current online redo log file.
SQL> ALTER SYSTEM SWITCH LOGFILE;

Verify the new redo data was archived on the standby database
SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG  ORDER BY SEQUENCE#;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20801486/viewspace-1134010/,如需轉載,請註明出處,否則將追究法律責任。

相關文章