Oracle Non-stop warehouse build DG

Source: Internet
Author: User
Tags failover sqlplus cisco switch


DG with Rman Backup not off the library

Suppose the main library DB_UNIQUE_NAME=ORCL
Standby Library Db_unique_name=orcl2

1. Main Library archive directory, established by Oracle user
[Email protected] ~]# su-oracle
[Email protected] ~]$ cd/u01/oracle/oradata/orcl/arclog/
[[email protected] ~]$ mkdir prmlog-Archive path when main library
[[email protected] ~]$ mkdir Stdlog-The path to receive Cheng Beiku when the main library transforms redo

2. Change the main library to force log mode:
[Email protected] ~]$ Sqlplus/as SYSDBA
ALTER DATABASE force logging;

3.tnsnames add Orcl, Orcl2, and Ping each other
Tnsping ORCL
Tnsping Orcl2

4.rman Backup Main Library, using Rman backup of the night, my Rman backup script is as follows:
#!/bin/bash
Rman Target/<<eof
Run {
Allocate channel C1 type disk maxpiecesize=20g;
Allocate channel C2 type disk maxpiecesize=20g;
Backup database format '/U01/RMAN/DB_%D_%S_%P_%U_%T.DBF ';
SQL "alter system archive log current";
Crosscheck backup;
Delete NoPrompt obsolete;
Delete noprompt expired backup;
Backup Archivelog all format '/u01/rman/arc_%d_%u_%t.arc ' Delete all input;
Backup current controlfile format '/u01/rman/ctf_%d_%u_%t.ctl ';
Release channel C1;
Release channel C2;
}
Eof

5. Create a control file for the standby library on the main library
ALTER DATABASE create standby Controlfile as '/u01/standby.ctl ' reuse;

6. Main Library setup Pfile
Create Pfile from SPFile;

7. And copy the main library text parameters, password files, tnsnames files, rman Backup, standby control files to the repository
Scp/u01/oracle/orcl/dbs/initorcl.ora 192.168.1.69:/u01 /oracle/orcl/dbs/
Scp/u01/oracle/orcl/dbs/orapworcl 192.168.1.69:/u01/oracle/orcl/dbs/
Scp-r/u01/rman/   192.168.1.69:/U01/
Scp/u01/standby.ctl 192.168.1.69:/u01/oracle/oradata/orcl/control01.ctl
scp/u01/ Standby.ctl 192.168.1.69:/u01/oracle/flash_recovery_area/orcl/control02.ctl

8. Modify or add the following in the repository text parameter file
Db_unique_name=orcl2
Log_archive_config= ' dg_config= (Orcl,orcl2) '
Log_archive_dest_1= ' location=/u01/oracle/oradata/orcl/arclog/prmlog/valid_for= (online_logfiles,all_roles) db_ Unique_name=orcl2 '
Log_archive_dest_2= ' SERVICE=ORCL lgwr async valid_for= (online_logfiles,primary_role) DB_UNIQUE_NAME=ORCL '
Log_archive_dest_3= ' location=/u01/oracle/oradata/orcl/arclog/stdlog/valid_for= (standby_logfiles,standby_role) Db_unique_name=orcl2 '
Log_archive_max_processes=6
Fal_server=orcl
Fal_client=orcl2
Standby_file_management=auto
Log_file_name_convert= '/u01/oracle/oradata/orcl/', '/u01/oracle/oradata/orcl/' – avoid the redo of new repositories in the flashback zone

9. Prepare the library to establish SPFile
Create SPFile from Pfile;

10. The repository establishes the same data file, archive file path as the main library
Cd/u01/oracle/oradata/orcl
mkdir Arclog
CD Arclog
mkdir Prmlog Stdlog

11.rman Recovery
Rman Target/
Rman> Startup Mount
rman> Restore Database;
rman> Recover database;
Rman> exit
Check the existence of the redo file for the repository at this time

12. Add the redo file to the master repository
ALTER DATABASE add standby logfile '/u01/oracle/oradata/orcl/std_redo01.log ' size 50m;
ALTER DATABASE add standby logfile '/u01/oracle/oradata/orcl/std_redo02.log ' size 50m;
ALTER DATABASE add standby logfile '/u01/oracle/oradata/orcl/std_redo03.log ' size 50m;
ALTER DATABASE add standby logfile '/u01/oracle/oradata/orcl/std_redo04.log ' size 50m;

13. Modify the current main library parameters
Alter system set DB_UNIQUE_NAME=ORCL Scope=spfile;
Alter system set log_archive_config= ' dg_config= (Orcl,orcl2) ';
Alter system set log_archive_dest_1= ' location=/u01/oracle/oradata/orcl/arclog/prmlog/  valid_for= (online_ logfiles,all_roles)   DB_UNIQUE_NAME=ORCL ';
Alter system set log_archive_dest_2= ' Service=orcl2 lgwr async valid_for= (online_logfiles,primary_role)   Db_ Unique_name=orcl2 ';
Alter system set log_archive_dest_3= ' Location=/u01/oracle/oradata/orcl/arclog/stdlog/valid_for= (standby_ logfiles,standby_role) DB_UNIQUE_NAME=ORCL ';
Alter system set log_archive_max_processes=6;
Alter system set FAL_SERVER=ORCL2;
Alter system set FAL_CLIENT=ORCL;
Alter system set Standby_file_management=auto;

14. Check whether the Master Repository archive is abnormal
Col Dest_name for A30
Col error for A20
Select Dest_name,status,error,target,process from V$archive_dest where rownum<=3;
Common errors The first standby library log_archive_dest_2 is inactive, modified as follows:
Alter system set log_archive_dest_2= ' SERVICE=ORCL lgwr async valid_for= (online_logfiles,primary_role) db_unique_name= ORCL ';

15. Open the Standby library
Sqlplus/as SYSDBA
ALTER DATABASE open;
--If you report the following error at this time, you can skip this step, perform 12, 13 steps, then perform this step, then perform step 12.
ERROR at line 1:
Ora-10458:standby database requires recovery
Ora-01152:file 1 was wasn't restored from a sufficiently old backup
Ora-01110:data file 1: '/U01/ORACLE/ORADATA/ORCL/SYSTEM01.DBF '


16. Prepare the library to start the Redo app and verify that the app has been started
ALTER DATABASE recover managed standby database using current logfile disconnect from session;
Select sequence#,applied from V$archived_log;

17. Stop the SQL App command (not executed here)
ALTER DATABASE stop logical standbyapply;
------------------------------------------------------------------------------------

Automatic failover with viewer

a). Preparatory work
1. master Standby Monitoring Add database service separately: ORCL_DGMGRL or ORCL2_DGMGRL:
Cd/u01/oracle/orcl/network/admin
Adding in the main library listening Listener.ora
(Sid_desc =
(Global_dbname = ORCL_DGMGRL)
(Oracle_home =/U01/ORACLE/ORCL)
(Sid_name = ORCL)
)
The Global_dbname parameter format:<db_unique_name>_dgmgrl.<db_domain> the connection and is db_unique_name case sensitive.
Adding in the Standby library monitoring Listener.ora
(Sid_desc =
(Global_dbname = ORCL2_DGMGRL)
(Oracle_home =/U01/ORACLE/ORCL)
(Sid_name = ORCL)
)

2. The master repository reloads the monitor separately:
Lsnrctl Reload

3. Test monitoring, respectively, on the main standby library is executed:
Tnsping ORCL
Tnsping Orcl2

4. Check the main standby operation mode:
The primary and standby databases are to be run in Maximum performance mode:
Sqlplus/as SYSDBA
Sql> select Protection_mode,database_role,protection_level from V$database;

5. Check the primary and standby database to have standby online logs:
Sql> select group# from V$standby_log;

6. Prepare the library to stop the Application log:
ALTER DATABASE recover managed standby database cancel;

7. The primary and standby database is to start the database flashback function:
Sql> select flashback_on from V$database;
Sql> ALTER DATABASE flashback on;
If the SQL execution fails, check whether the SPFile Qicu is used, and if the standby is used SPFile Qicu, stop applying redo and then execute the SQL.

8. Increase the Flash back zone:
Sql> alter system set db_recovery_file_dest_size=50g;
Sql> Show Parameter Db_recovery_file_dest_size
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
Db_recovery_file_dest_size Big Integer 50G

9. Primary and Standby Database modification parameters Local_listener:
Main Library sql> alter system set local_listener= ' ORCL '; --ORCL for the Listener service name
Standby library sql> alter system set local_listener= ' Orcl2 '; --orcl2 for the Listener service name

10. The primary and standby database is to enable broker:
Sql> alter system set dg_broker_start=true;

11. Check the final destination of the Master Repository Archive for an exception:
Set Lines 400
Col Dest_name for A30
Col error for A20
Select Dest_name,status,target,archiver,error,process from V$archive_dest where rownum<=3;

The official recommendation is to set the observer on the third machine to detect the state of the master standby. The relevant tnsnames parameters are configured on observer machine, so that the third computer can access the instance of the master and Standby library.
It then uses this observer to determine the state of the Master repository. If the main library asks, then Observer will switch the standby to the main library.
The reason for placing on the third machine is also obvious, if the main library system is broken down, then the observer will fail.
If placed on a standby, a standby network or system failure causes the main library to shut down, while the repository is automatically cut to the primary library.

II). Configure the viewer:
1. Login to the main library on the viewer:
[Email protected] ~]$ DGMGRL
Dgmgrl> Connect sys/****** @orcl

2. Create the Mediation configuration:
dgmgrl> Create configuration ' Orclbroker ' as primary database is ' ORCL ' connect identifier is ORCL;

3. Add the standby database in the mediation configuration:
dgmgrl> Add database ' Orcl2 ' as connect identifier is Orcl2 maintained as physical;

4. View verbose and fast switching status:
Dgmgrl> Show configuration verbose;
Dgmgrl> Show Fast_start failover


5. View the configuration of the primary and standby database:
Dgmgrl> Show database verbose ORCL; -----ORCL is the only one in the main library
Dgmgrl> Show database verbose Orcl2; -----Orcl2 is the only one to reserve the library
Verify that the primary and standby database logxptmode= ' async ' (maximum performance is async, maximum available for sync), and not execute:
dgmgrl> Edit Database Orcl2 Set Property Logxptmode = ' Async '; -----Here assume Orcl's logxptmode= ' async '

6. Start the broker configuration:
dgmgrl> Enable configuration

Can modify the delay time of fast failover (default is 30 seconds, that is, the main library 30 seconds is not detected to switch the main standby library, but the Cisco switch plug in the network cable reaction time of about 35 seconds,
This value should be increased to prevent the network cable from accidentally touching when the main standby switch):
Dgmgrl> Edit configuration Set property faststartfailoverthreshold=60; The delay time is changed to 1 minutes.

7. Start fast failover:
Dgmgrl> Enable Fast_start failover

8. Start the Observer Monitor:
Dgmgrl> Start Observer
After startup, the foreground process does not exit and hangs there. Until you close from another window!

9. In the Repository new window, start a DGMGRL to see if the quick transfer configuration is successful:
Dgmgrl> Connect sys/****** @orcl2
Dgmgrl> Show configuration verbose;
Dgmgrl> Show Fast_start failover
Dgmgrl> Show database verbose ORCL;
Dgmgrl> Show database verbose Orcl2;

10. Check on the main library to see if you can switch to the standby library:
Sql> select Fs_failover_observer_present,fs_failover_observer_host,fs_failover_threshold from V$database;

This article is from "Healthy Happiness is Happiness" blog, please be sure to keep this source http://yiqiuyu.blog.51cto.com/3228402/1580915

Oracle Non-stop warehouse build DG

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.