Oracle Data Guard (2) Physical Standby

Source: Internet
Author: User

Oracle Data Guard (2) Physical Standby 1. check whether the Primary database is archivelog mode SQL> select log_mode from v $ database; if the result is not "ARCHIVELOG", run the following command: SQL> shutdown immediate; SQL> startup mount; SQL> alter database archivelog; SQL> alter database open; 2. check whether the Primary database is in force logging mode SQL> select force_logging from v $ database; if the result is not "YES", run the following command: SQL> alter database force logging; 3. create Standby logfileS on the Primary database QL> select group #, thread #, bytes/1024/1024 from v $ log; create a corresponding logfile for the Standby instance based on the number of groups and log size, by default, three groups are created, each of which is 50 MB. SQL> alter database add standby logfile '/home/oracle/app/oracle/oradata/sungoin/stby_redo01.log' size 50 m; SQL> alter database add standby logfile '/home/oracle/app/oracle/oradata/sungoin/stby_redo02.log' size 50 m; SQL> alter database add standby logfile '/home/oracle/app/oracle/oradata/sungoin/stby_redo03.log' size 50 m; 4. configure Standby related system parameters SQL> alter system set log_archive_config = 'dg _ C on the Primary database ONFIG = (test, standby) '; SQL> alter system set log_archive_dest_1 = 'location =/home/oracle/app/oracle/flash_recovery_area/test/archivelog VALID_FOR = (ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME = test'; SQL> alter system set log_archive_dest_2 = 'service = standby ASYNC valid_for = (ONLINE_LOGFILE, PRIMARY_ROLE) db_unique_name = standby'; SQL> alter system set fal_server = test; SQL> alter system set fal_client = standby; SQL> alter system set standby_file_management = auto; SQL> alter system set remote_login_passwordfile = exclusive; 5. configure the listener and TNS variable on the Primary server to register the test instance statically in the listener of the Primary server, add the following lines to the file/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener. in ora: SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = test) (ORACLE_HOME =/home/oracle/app/oracle/product/11.2.0/dbhome_1 ))) register t in the TNS of the Primary server Est and standby, add the following lines to the file/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames. in ora: TEST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = testdb) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test) STANDBY = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.102) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test) 6. in Stand Run the following command to create a directory structure on the by server in the Oracle user environment: $ mkdir-p/home/oracle/app/oracle/oradata/test/$ mkdir-p/home/oracle/app/oracle/admin/test/adump $ mkdir-p/ home/oracle/app/oracle/admin/test/dpdump $ mkdir-p/home/oracle/app/oracle/admin/test/pfile $ mkdir-p/home/oracle/ app/oracle/flash_recovery_area/test/archivelog/7. configure the listener and TNS variable on the Standby server to register the test instance in the listener of the Standby server, and add the following line to the file/home/oracle/app/oracle/prod. Uct/11.2.0/dbhome_1/network/admin/listener. in ora: SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = test) (ORACLE_HOME =/home/oracle/app/oracle/product/11.2.0/dbhome_1 ))) register sungoin and Standby in the TNS of the standby server and add the following lines to the file/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames. in ora: TEST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.101) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test) STANDBY = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = standby) (PORT = 1521 )) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test) 8. on the Standby server, create the Startup File and Password File/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/initsungoin. ora, the file content is as follows: DB_NAME = testDB_UNIQUE_NAME = standby copy the password file on the Primary service to the standby server, the command is as follows: scp oracle@192.168.1.101:/home/ Oracle/app/racle/product/11.2.0/dbhome_1/dbs/orapwtest/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/9. start the Standby instance $ sqlplus/as sysdba SQL> startup nomount; 10 on the standby server. create and execute the RMAN script file on the Primary server to create the script file dupstby. cmd, the file content is as follows: run {allocate channel pri1 type disk; allocate channel pri2 type disk; allocate channel prmy4 type disk; allocate auxiliary channel stby type disk; duplicate target Database for standby from active database dorecover spfile set db_unique_name = 'standby' set control_files = '/home/oracle/app/oracle/oradata/test/control01.ctl ', '/home/oracle/app/oracle/flash_recovery_area/test/control02.ctl' set fal_client = 'test' set fal_server = 'standby' set standby_file_management = 'auto' set log_archive_config = 'dg _ config = (test, standby) 'set log_archive_dest_1 = 'location =/home/ora Cle/app/oracle/logs/test/archivelog VALID_FOR = (ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME = standby 'set roles = 'service = test ASYNC valid_for = (ONLINE_LOGFILE, PRIMARY_ROLE) db_unique_name = test 'nofilenamecheck;} enters the rman environment and runs this script $ rman target/RMAN> connect auxiliary sys/oracle @ standby RMAN> @ dupstby. cmd 11. start the Standby Execution Process on the Standby database $ sqlplus/as sysdba SQL> alter database rec Over managed standby database disconnect from session; SQL> exit; 12. verify whether the configuration is successfully executed on the Primary server: SQL> archive log list; SQL> <any database changes> SQL> alter system switch logfile; SQL> archive log list; run SQL> archive log list; SQL> select sequence #, first_time, next_time, applied from v $ archived_log order by sequence # On the standby server #; check whether the Current log sequence at both ends is the same. It should be the same if it is correct. In addition, check the roles and status of the primary and standby instances and run the following commands on the two instances: SQL> select open_mode, switchover_status, database_role from v $ database; the result should be displayed on the Primary server: OPEN_MODE SWITCHOVER_STATUSDATABASE_ROLE ------------------ please read write to standbyprimary Standby server. The result should be: OPEN_MODE ready -------------------- ready ----------------------------------------------------------------- ------ Read only with applynot allowedphysical standby if the check result is different from the preceding one, which step may have an error? Check the Log for details.

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.