DataGuardAbbreviationDGIs a database-levelHAThe main functions of the solution are redundancy, data protection, and fault recovery,DGProduction database"Transaction consistencyCopy ",Use the physicalCopyAfter the slave database is created, the archive logs transmitted by the slave database through the production database(Or redo entries)The standby database is automatically maintained. Apply the redo data to the slave database.DGDivided"PhysicalStandby"And"LogicStandby". This instance usesStandby".DGYesOracleEnterprise Edition exclusive features, so the Standard Edition is not available.
| Operating System |
Master-slave relationship |
IPAddress |
Data File Path |
| Win2003server |
Primary |
192.168.48.101 |
D: \ oracle \ product \ 10.2.0 \ oradata \ dgoracle |
| Win2003server |
Standby |
192.168.48.102 |
D: \ oracle \ product \ 10.2.0 \ oradata \ dgoracle |
Note:Primary AndStandby The data file paths can be different. Hardware and operating system requirements: 1. Run on the same hardware platform, suchIntelx86 Architecture32 BitLinux Platform 2. The server configuration can be different, as long as there is enough space to store data files. 3.Primary AndStandby The operating system of the server must be consistent. Of course, the version may be slightly different. For exampleAS4, The other isAS5 .Oracle Database Name Planning:
| Db_name |
Dgoracle |
| Db_uniqe_name |
Dgoracle |
| Instance_name |
Txgj |
| Service_name |
Dgoracle |
| Oracle_sid |
Txgj |
InPrimary AndStandby The server is installed separatelyOracle Database, you can also install the software first, and thenPrimary Create a database, and then upload the data fileCopy ToStandby .DG Path to configuration 1. InPrimary View archives onSQL> archive log list If not, archive is enabled.SQL> shutdown immediate; SQL> startup mount; SQL> alter database archivelog; SQL> alter database open; SQL> archive log list; 2. InPrimary Specify the path and format of the archived logSQL> Alter system set log_archive_dest_1 = 'd: \ oracle \ archlog VALID_FOR = (ALL_LOGFILES, ALL_ROLES) 'scope = spfile;SQL> alter system set log_archive_format = 'arch _ % t _ % s _ % r_arc' scope = spfile; 3. InPrimary Change the database to the forced archiving mode onSQL> alter database force logging; SQL> shutdowm immediate; 4. InPrimary Create parameter files andStandby Control FileSQL> startup mountSQL> create pfile = 'd: \ oracle \ init. ora 'from spfile; SQL> alter database create standby controlfile as 'd: \ oracle \ 01. ctl '; SQL> shutdown immediate; 5. CloseStandby Library, andPrimary Copy the data file and overwrite the file with the same name. Copy the created parameter file and the control file01. ctl Copy again2 And name it a control file with the same name, and then overwrite the file with the same name in the installation directory. CopyPrimary Password File OverwriteStandby Files with the same name in the installation directory.6. ModifyPrimary The createdPfile Parameter to add the following content:*. LOG_ARCHIVE_DEST_STATE_1 = ENABLE *. LOG_ARCHIVE_DEST_STATE_2 = ENABLE *. FAL_SERVER = 'standby '*. FAL_CLIENT = 'Primary '*. STANDBY_FILE_MANAGEMENT = 'auto '*. STANDBY_ARCHIVE_DEST = 'd: \ oracle \ archstandby '*. LOG_FILE_NAME_CONVERT = ('d: \ oracle \ product \ 10.2.0 \ oradata \ dgoracle ', 'd: \ oracle \ product \ 10.2.0 \ oradata \ dgoracle ')*. DB_FILE_NAME_CONVERT = ('d: \ oracle \ product \ 10.2.0 \ oradata \ dgoracle ', 'd: \ oracle \ product \ 10.2.0 \ oradata \ dgoracle ') What does each parameter mean?Baidu .7. ModifyStandby Parameter file to add the following content:*. Log_archive_dest_2 = 'service = primary lgwr async '*. LOG_ARCHIVE_DEST_STATE_1 = ENABLE *. LOG_ARCHIVE_DEST_STATE_2 = ENABLE *. FAL_SERVER = primary *. FAL_CLIENT = standby *. STANDBY_ARCHIVE_DEST = 'd: \ oracle \ archstandby '*. STANDBY_FILE_MANAGEMENT = AUTO *. LOG_FILE_NAME_CONVERT = ('d: \ oracle \ product \ 10.2.0 \ oradata \ dgoracle ', 'd: \ oracle \ product \ 10.2.0 \ oradata \ dgoracle ')*. DB_FILE_NAME_CONVERT = ('d: \ oracle \ product \ 10.2.0 \ oradata \ dgoracle ', 'd: \ oracle \ product \ 10.2.0 \ oradata \ dgoracle') 8. Configure the listening file of the Master/Slave DatabaseSID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = f: \ oracle \ product \ 10.2.0 \ db_1) (PROGRAM = extproc) ) (SID_DESC = (GLOBAL_DBNAME = dgoracle) (ORACLE_HOME = D: \ oracle \ product \ 10.2.0 \ db_1) (SID_NAME = txgj) ) )LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST =192.168.48.101) (PORT = 1521 )) (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC0 )) ) ) Note: The Blue font must be added to the master and slave databases, while the red font is used to modify the cost.IP .