Record the process of installing Oracle volume uard with vmwarevm in windows.
1. install two Linux as 5 virtual machines in VMware. You do not need to install them twice. After one installation is complete (after Linux 5 and Oracle ), copy the file modification part of this virtual machine and open it directly as the file of the second virtual machine.
Reference http://www.5ienet.com/note/html/srac/rac_step_setup_second_note.shtml
2. Configure the network connection of the two VMS as host-only.
The IP address is as follows: This ensures the network connection between virtual machines.
VMWare virtual Ethernet adapter for vmnet1 for Windows Host
172.16.245.1
255.255.255.0
172.16.245.1
The IP Address Configuration of DG1 VM 1 is as follows:
172.16.245.100
255.255.255.0
172.16.245.1
The IP configuration of dg2 Virtual Machine 2 is as follows:
172.16.245.101
255.255.255.0
172.16.245.1
* Disable the firewall of the Linux virtual machine.
Oracle official documentation: http://docs.oracle.com/cd/B19306_01/server.102/b14239/create_ps.htm#g88234
3. Create a database (the database name is test) on the first virtual machine as the primary database.
The database information is as follows:
Export oracle_base =/opt/Oracle
Export ORACLE_HOME = $ oracle_base/product/10.0.2/db_1
Export oracle_sid = test
Then, perform the following steps:
Change the database to archive mode reference: http://blog.csdn.net/kkdelta/article/details/7193738
Then the master database preparation
1. SQL> alter database force logging;
2. Edit the parameter file. Based on the current spfile, create a pfile and then edit it.
Create pfile from spfile; inittest. ora is created under/opt/Oracle/product/10.0.2/db_1/DBS.
Add the following content:
#--------------------------
Db_unique_name = testp
Log_archive_config = 'dg _ Config = (testp, tests )'
Log_archive_dest_1 = 'location =/opt/Oracle/product/10.0.2/oradata/test/arclog/valid_for = (all_logfiles, all_roles) db_unique_name = testp'
Log_archive_dest_2 = 'service = test_s lgwr async valid_for = (online_logfiles, primary_role) db_unique_name = tests'
Fal_server = test_s
Fal_client = test_p
Standby_file_management = auto
Here, testp is the unique name of the primary database, tests is the unique name of the standby database, test_p is the TNS of the primary database, and test_s is the TNS of the standby database.
These TNS must be configured on both virtual machines (tnsnames. ora ).
3. Shut down the database and back up the data file of the primary database,
Shutdown immediate
Copy the/opt/Oracle/product/10.0.2/oradata/test data file (. DBF) from the first virtual machine to the second folder.
4. Start the master data to mount and create the control file for the standby database.
SQL> alter database create standby controlfile as '/opt/Oracle/product/10.0.2/oradata/stdby. CTL ';
SQL> alter database open;
Copy the created control file to the location of the second VM:/opt/Oracle/product/10.0.2/oradata/test/stdby. CTL
5. Prepare a parameter file for the standby database, copy the parameter file of the primary database to the same directory of the second virtual machine, and then modify the file as follows.
Modify *. control_files = '/opt/Oracle/product/10.0.2/oradata/test/stdby. CTL'
Replace the content added to the master database parameter file in step 2 with the following content:
#---------------------------
Db_unique_name = tests
Log_archive_config = 'dg _ Config = (testp, tests )'
Log_archive_dest_1 = 'location =/opt/Oracle/product/10.0.2/oradata/test/arclog/valid_for = (all_logfiles, all_roles) db_unique_name = tests'
Log_archive_dest_2 = 'service = test_p lgwr sync valid_for = (online_logfiles, primary_role) db_unique_name = testp'
Standby_file_management = auto
Fal_server = test_p
Fal_client = test_s
6. Copy the password file of the primary database to the virtual machine of the standby database.
7. Create a listener for the standby database on the second Virtual Machine
8. Open the backup database to mount and create the standby logfile.
Alter database Mount
Alter database add standby logfile '/opt/Oracle/product/10.0.2/oradata/test/stdby_redo01.log' size 20 m;
Alter database add standby logfile '/opt/Oracle/product/10.0.2/oradata/test/stdby_redo02.log' size 20 m;
Alter database add standby logfile '/opt/Oracle/product/10.0.2/oradata/test/stdby_redo03.log' size 20 m;
9. Start the redo application on the standby database.
SQL> alter database recover managed standby database disconnect from session;
10. Switch logs from the primary database to check whether the archived logs are transmitted to the standby database.
SQL> alter system switch logfile;
Check whether logs are uploaded to the backup database.
** Standby databases can only be opened in read-only mode.
Alter database recover managed standby database cancel;
Alter database open read only;
View the table content in the standby database:
Select * from T1;
In read-only mode, archive logs of the primary database are still uploaded to the standby database, but archive logs are not applied to the standby database.
View related to dataguard
V $ dataguard_config
V $ dataguard_status
V $ dataguard_stats
V $ managed_standby
Master-slave switchover:
1. Create a standby log in the primary database
Alter database add standby logfile '/opt/Oracle/product/10.0.2/oradata/test/stdby_redo01.log' size 20 m;
Alter database add standby logfile '/opt/Oracle/product/10.0.2/oradata/test/stdby_redo02.log' size 20 m;
Alter database add standby logfile '/opt/Oracle/product/10.0.2/oradata/test/stdby_redo03.log' size 20 m;
2. Stop all external applications on the primary machine and start switching
Alter database commit to switchover to physical standby with Session shudown;
Shutdown immediate;
Startup Mount;
3. Switch the standby server to primary,
Alter database recover managed standby database cancel;
Alter database commit to switchover to primary;
Alter database open;
The standby database automatically creates a redo log file group.
4. Enable the log application in the initial primary.
Alter database recover managed standby database disconnect from session;
If the primary database fails, enable standby database to serve the application.
1. Apply all logs and recover standby database;
2. Enable standby Database
Alter database recover managed standby database finish;
Shutdown immediate;
Startup open;