Just a simple case about the oracle 11gR1 dataguard configuration

01、 ORACLE_DATAGUARD_Case_11gconfiguration

Just acase:

First of all, please finish the  full backup of the primary database.

-- 1. Filename: Config the  oracle11g primary database

1). On the primary database.  Open the archive mode

$ mkdir /oracle/oradata/openview/archivelog     <======= Make  sure this folder have enough space for the archive log.

$ sqlplus / as sysdba

SQL> alter database force logging;

SQL> create pfile='$ORACLE_HOME/dbs/Backup_pri_initopenview.ora' from  spfile;

SQL> alter system set db_unique_name='propenview'  scope=spfile sid='*';

SQL> alter system set LOG_ARCHIVE_FORMAT='arc_%t_%s_%r_%d.arc'  scope=spfile sid='*';

SQL> alter system set  LOG_ARCHIVE_DEST_1='LOCATION=/oracle/oradata/openview/archivelog  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=propenview'  scope=spfile sid='*';

SQL> shutdown immediate;

SQL> startup mount;

SQL> alter database archivelog;

SQL> alter database open;

SQL> archive log list;

If you can see this, so we belongs to the archive mode:

Database log mode Archive Mode

Automatic archival ENABLED

 

 

2). On the primary database.  Change some parameter in the pfile, and rebuild the spfile

SQL> create pfile='$ORACLE_HOME/dbs/pri_initopenviewtmp.ora' from  spfile;

And change the following parameters in the pri_initopenviewtmp.ora, like  this:

*.db_unique_name='propenview'

*.log_archive_config='DG_CONFIG=(propenview,dropenview)'

*.LOG_ARCHIVE_FORMAT='arc_%t_%s_%r_%d.arc'

*.LOG_ARCHIVE_DEST_1='LOCATION=/oracle/oradata/openview/archivelog  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=propenview'

*.LOG_ARCHIVE_DEST_2='SERVICE=dropenview  LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dropenview'

*.LOG_ARCHIVE_DEST_STATE_1=ENABLE

*.LOG_ARCHIVE_DEST_STATE_2=ENABLE

*.FAL_SERVER=dropenview

*.FAL_CLIENT=propenview

*.DB_FILE_NAME_CONVERT='/oracle/oradata/openview/openview','/oracle/oradata/openview/openview'

*.LOG_FILE_NAME_CONVERT='/oracle/oradata/openview/openview','/oracle/oradata/openview/openview'

*.standby_file_management='AUTO'

*.LOG_ARCHIVE_MAX_PROCESSES=4

SQL> shutdown immediate;

SQL> create spfile='$ORACLE_HOME/dbs/spfileopenview.ora' FROM  pfile='$ORACLE_HOME/dbs/pri_initopenviewtmp.ora';

SQL> startup;

 

 

3). On the primary database.  Config the listener.ora and the tnsnames.ora in the  $ORACLE_HOME/network/admin folder

3.1). The contents of the listener.ora

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

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

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

    )

  )

SID_LIST_LISTENER =

  (SID_DESC =

    (GLOBAL_DBNAME = propenview)

    (ORACLE_HOME = /opt/oracle/db/product/11.1.0/db_1)

    (SID_NAME = openview)

  )

 

3.2). The contents of the tnsnames.ora

propenview =

  (DESCRIPTION =

    (ADDRESS_LIST =

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

    )

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = propenview)

    )

  )

dropenview =

  (DESCRIPTION =

    (ADDRESS_LIST =

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

    )

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = dropenview)

    )

  )

 

3.3). Open the listener

$ lsnrctl stop LISTENER

$ lsnrctl start LISTENER

 

 

4). On the primary database.  Create the standby redo logfiles.

$ sqlplus sys/password@propenview as  sysdba

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP  4 ('/oracle/oradata/openview/openview/dr_redo01.log')  SIZE 512M;

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP  5 ('/oracle/oradata/openview/openview/dr_redo02.log')  SIZE 512M;

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP  6 ('/oracle/oradata/openview/openview/dr_redo03.log')  SIZE 512M;

And check the status of the standby logfile:

SQL> select member from v$logfile;

 

 

 

 

-- 2. Filename: Config the  oracle11g standby database

1). On the standby database.  Open the archive mode

$ mkdir /oracle/oradata/openview/archivelog     <======= Make  sure this folder have enough space for the archive log.

$ sqlplus / as sysdba

SQL> create pfile='$ORACLE_HOME/dbs/Backup_std_initopenview.ora' from  spfile;

SQL> alter system set db_unique_name='dropenview'  scope=spfile sid='*';

SQL> alter system set LOG_ARCHIVE_FORMAT='arc_%t_%s_%r_%d.arc'  scope=spfile sid='*';

SQL> alter system set  LOG_ARCHIVE_DEST_1='LOCATION=/oracle/oradata/openview/archivelog  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dropenview'  scope=spfile sid='*';

SQL> shutdown immediate;

SQL> startup nomount;

 

 

2). On the standby database.  Change some parameter in the pfile, and rebuild the spfile

Copy the $ORACLE_HOME/dbs/pri_initopenviewtmp.ora  in the primary database to the standby database.

$ cd $ORACLE_HOME/dbs

$ mv pri_initopenviewtmp.ora std_initopenviewtmp.ora

And change the following parameters in the std_initopenviewtmp.ora,  like this:

*.db_unique_name='dropenview'

*.log_archive_config='DG_CONFIG=(propenview,dropenview)'

*.LOG_ARCHIVE_FORMAT='arc_%t_%s_%r_%d.arc'

*.LOG_ARCHIVE_DEST_1='LOCATION=/oracle/oradata/openview/archivelog  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dropenview'

*.LOG_ARCHIVE_DEST_2='SERVICE=propenview  LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=propenview'

*.LOG_ARCHIVE_DEST_STATE_1=ENABLE

*.LOG_ARCHIVE_DEST_STATE_2=ENABLE

*.FAL_SERVER=propenview

*.FAL_CLIENT=dropenview

*.DB_FILE_NAME_CONVERT='/oracle/oradata/openview/openview','/oracle/oradata/openview/openview'

*.LOG_FILE_NAME_CONVERT='/oracle/oradata/openview/openview','/oracle/oradata/openview/openview'

*.standby_file_management='AUTO'

*.LOG_ARCHIVE_MAX_PROCESSES=4

SQL> shutdown immediate;

SQL> create spfile='$ORACLE_HOME/dbs/spfileopenview.ora'  FROM pfile='$ORACLE_HOME/dbs/std_initopenviewtmp.ora';

SQL> startup nomount;

 

 

3). On the standby database.  Config the listener.ora and the tnsnames.ora in the  $ORACLE_HOME/network/admin folder

3.1). The contents of the listener.ora

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

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

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

    )

  )

SID_LIST_LISTENER =

  (SID_DESC =

    (GLOBAL_DBNAME = dropenview)

    (ORACLE_HOME = /opt/oracle/db/product/11.1.0/db_1)

    (SID_NAME = openview)

  )

 

3.2). The contents of the tnsnames.ora

propenview =

  (DESCRIPTION =

    (ADDRESS_LIST =

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

    )

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = propenview)

    )

  )

dropenview =

  (DESCRIPTION =

    (ADDRESS_LIST =

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

    )

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = dropenview)

    )

  )

 

3). Open the listener

$ lsnrctl stop LISTENER

$ lsnrctl start LISTENER

 

 

4). On the standby database.  Create the password file which same with the password of the primary database

$ cd $ORACLE_HOME/dbs

$ mv orapwopenvie orapwopenvie.bak

$ orapwd FILE=$ORACLE_HOME/dbs/orapworahw password=orahw;    <======  Must change "orahw" to the real password which same with the  password of the primary database

 

 

 

-- 3. Filename: Duplicate for  the standby database

1). On the primary database. Dulicate for the standby database

$ rman target sys/password@propenview  auxiliary sys/password@dropenview nocatalog  trace dup_stb.log

RMAN> run{

allocate channel prmy1 type disk;

allocate channel prmy2 type disk;

allocate channel prmy3 type disk;

allocate auxiliary channel stby2 type disk;

duplicate target database for standby from  active database nofilenamecheck;

}

 

 

2). On the standby database. Start the recover managed

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT  LOGFILE DISCONNECT FROM SESSION;

SQL> select process,status,thread#,sequence#,block#,blocks from  v$managed_standby;

 

 

你可能感兴趣的:(Just a simple case about the oracle 11gR1 dataguard configuration)