ORACLE 11G Dataguard Build physical standby

Source: Internet
Author: User

1 Installation Environment

Install the database software on the Primary Library, and build the monitoring and instance, install the database software on the Standby Library, and build the monitoring, but do not build the instance.

centos release 6.4  64 bit

TD valign= "Top" style= "Background:rgb (183,221,232)" >

Primary Library

Standby Library

operating system

centos release 6.4  64 bit

IP / host name

192.183.3. 17/nn

192.183.3.145/kk

Database software version

Oracle 11.2.0.1.0

Oracle 11.2.0.1.0

Oracle_home

/ home/oracle/product

/ home/oracle/product

Oracle_sid

Orcl

Orcl

Db_unique_name

Primary

Standby

Net Service Name

Ser_pri

Ser_std



2 Primary Library configuration 2.1 set up database forced archive and archive mode

    • Set the main library to force LOGGING mode

      Sql>alter database force logging;

    • Turn on archive mode

To view the archive mode:

     Sql>archive log list;
To set the archive mode:


2.2 rebuilding a password file

All databases in the same Dataguard must have separate password files and ensure that the sys user has the same password to guarantee The transmission of the redo. the default Oracle Self-built password file is saved in the $ORACLE _home/dbs/orapw$oracle_sid and can be copied directly to the standby Library corresponding directory (this case uses this method), if not the file can also be rebuilt by the following way.

[Email protected]~]$ orapwd file= ' $ORACLE _home/dbs/orapw$oracle_sid ' password=123456 force=y ignorecase=y

2.3 STANDBY log files and control file creation
    • Add standby log file

     Sql>alter Database Add standby LogFile Group 4 ('/home/oracle/oradata/orcl/stdby01.log ') size 50M;     Sql>alter Database Add standby LogFile Group 5 ('/home/oracle/oradata/orcl/stdby02.log ') size 50M;     Sql>alter Database Add standby logfile Group 6 ('/home/oracle/oradata/orcl/std03.log ') size 50M;     Sql>select Group#,member from V$logfile order by 1;

    • Create a Standby control file

       sql> ALTER DATABASE create standby Controlfile as ' home/oracle/oradata/orcl/standby01.ctl ';      [Email protected] ~]$ cp/home/oracle/oradata/orcl/standby01.ctl/home/oracle/flash_recovery_area/orcl/ Standby02.ctl


2.4 Modify the primary library pfile2.4.1 generate pfile
       Sql>create pfile from SPFile;       Sql>shutdown immediate;
2.42 Modify pfile

     [Email protected]~] $vi $ORACLE _home/dbs/initorcl.ora

At the end, add the following red box content:

2.4.3 generate spfile
       Sql>startup pfile= '/home/oracle/product/dbs/initorcl.ora '      sql>create spfile from pfile= '/home/oracle/ Product/dbs/initorcl.ora ';
2.5 To modify a listening configuration file

Listen to the file directory $ORACLE _home/network/admin, restart the monitoring after the configuration is complete.

    [[email protected] admin] $vi Listener.ora

2.6 Modifying the TNS configuration file

TNS file directory $ORACLE _home/network/admin.

     [[email protected] admin] $vi Tnsnames.ora


2.7 backing up the database
    [[email protected] backupset] $rman target/     rman>sql ' alter system archive log current ';     Rman>backup database include current controlfile for standby plus archivelog;


After the backup is complete, the backup files are produced in the flash back area.

3 Standby Library Configuration3.1 create the appropriate file directory

Includes dump file directory, flashback area, data file directory, can be viewed via show parameter dest command

      [Email protected]~] $mkdir-P/home/oracle/admin/orcl/adump      [[email protected]~] $mkdir-P/home/oracle/admin/ Orcl/dpdump       [[email protected]~] $mkdir-P/home/oracle/admin/orcl/pfile      [[email protected]~] $mkdir-P/home/ Oracle/diag/rdbms      [[email protected]~] $mkdir-P/home/oracle/flash_recovery_area      [[Email protected]~]$ Mkdir-p/HOME/ORACLE/ORADATA/ORCL


3.2 copying files from the primary library server3.2.1 Copy the backup contents of the Flash back area

      [[email protected] ORCL] $SCP-R/home/oracle/flash_recovery_area/orcl/backupset 192.183.3.145:/home/oracle/flash_ recovery_area/orcl/


3.2.2 copy parameter file and password file

     [[email protected] ORCL] $SCP-R/home/oracle/product/dbs 192.183.3.145:/home/oracle/product/dbs


3.2.3 Copy listening Files

     [Email protected]~] $SCP-R/home/oracle/product/network/admin/*.ora 192.183.3.145:/home/oracle/product/network/ admin/

3.3 To modify a listening configuration file

3.4 TNS configuration file

3.5 Modifying a parameter file

     [Email protected] ~]$ VI $ORACLE _home/dbs/initorcl.ora

Modify the following content:

3.6 start standby library nomount status
       sql> STARTUP nomount pfile= '/home/oracle/product/dbs/initorcl.ora ';       Sql> create SPFile from pfile= '/home/oracle/product/dbs/initorcl.ora ';

3.7 Recovering a database
     [email protected]~] $rman target sys/[email protected]_pri auxiliary/     rman> Duplicate target database for standby Nofilenamecheck Dorecover;

Or you can perform the following script to restore the Standby library.



3.8 Start the Standby library

Duplicate the standby Library is already in the normal Mount State after completion , the recover should be turned on.

    sql> ALTER DATABASE recover managed standby database disconnect from session;

View database roles, role switches, Protected mode

    Sql> select Database_role,switchover_status,protection_mode,protection_level from V$database;

3.9 Verify that the configuration is successful

The archive log is the same as the current-log sequence, which indicates a successful configuration :

    • Primary Library

    • Standby Library




ORACLE 11G Dataguard Build physical standby

Related Article

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.