The procedure is as follows:
1. master database operations
1. Modify the attributes of the master database:
Alter system force logging;
# View status
Select force_logging from V $ database;
2. Change the database to archive mode:
Archive log list;
Shutdown immediate;
Startup Mount;
Alter database archivelog; (alter database noarchivelog; Disable archive Mode)
Archive log list;
3. Add standby logfile (or do not add it)
Add "backup online Log File" to the master database. Make sure that the backup log file is the same size as the online log file of the master database.
Adding backup log files is a rule:
The backup log should be at least one more than the redo log. The recommended number of standby redo logs depends on the number of threads in the primary database.
(Maximum number of log files per Thread + 1) * Number of threads
Alter database add standby logfile
Group 4 ('/oracle2/APP/Oracle/oradata/std_redo04a.log', '/oracle2/APP/Oracle/oradata/std_redo04b.log') size 50 m,
Group 5 ('/oracle2/APP/Oracle/oradata/std_redo05a.log', '/oracle2/APP/Oracle/oradata/std_redo05b.log') size 50 m,
Group 6 ('/oracle2/APP/Oracle/oradata/std_redo06a.log', '/oracle2/APP/Oracle/oradata/std_redo06b.log') size 50 m,
Group 7 ('/oracle2/APP/Oracle/oradata/std_redo07a.log', '/oracle2/APP/Oracle/oradata/std_redo08b.dbf') size 50 m;
Otherwise, the slave database reports the following information in the application:
RFS [1]: No standby redo logfiles created
RFS [1]: Archived log: '/oracle2/ARCH/1_30_633287861.dbf'
After the standby logfile is added to the master database, when the master database switches to the backup database, the redo logfile of the slave database is automatically used. The specific application information is as follows:
RFS [1]: successfully opened standby log 4: '/oracle2/APP/Oracle/oradata/10g/redo04.log'
RFS [1]: successfully opened standby log 4: '/oracle2/APP/Oracle/oradata/10g/redo04.log'
4. Modify the parameter file of the master database:
10g. _ db_cache_size = 1207959552
10g. _ java_pool_size = 16777216
10g. _ large_pool_size = 16777216
10g. _ shared_pool_size = 352321536
10g. _ streams_pool_size = 0
*. Audit_file_dest = '/oracle2/APP/Oracle/admin/10g/adump'
*. Background_dump_dest = '/oracle2/APP/Oracle/admin/10g/bdump'
*. Compatible = '10. 2.0.3.0'
*. Control_files = '/oracle2/APP/Oracle/oradata/10g/control01.ctl', '/oracle2/APP/Oracle/oradata/10g/control02.ctl ', '/oracle2/APP/Oracle/oradata/10g/control03.ctl'
*. Core_dump_dest = '/oracle2/APP/Oracle/admin/10g/cdump'
*. Db_block_size = 8192
*. Db_domain =''
*. Db_file_multiblock_read_count = 16
*. Db_name = '10g'
*. Db_unique_name = '10gpui' [color = Red] ### the unique identifier of each database must be defined. [/color]
*. Log_archive_config = 'dg _ Config = (10 upli, 10 gstandby) '[color = Red] ### required [/color]
*. Log_archive_dest_1 = 'location =/oracle2/ARCH/
Valid_for = (all_logfiles, all_roles) 'db_unique_name = '10ggi'
[Color = Red] ### local archiving path required [/color]
*. Log_archive_dest_2 = 'service = 10 gstandby
Arch async valid_for = (online_logfiles, primary_role)
Db_unique_name = 10gstandby '[color = Red] ### required (archiving logs on remote servers) [/color]
*. Log_archive_dest_state_1 = Enable
*. Log_archive_dest_state_2 = Enable
*. Fal_server = 10 upli
[Color = Red] ### define the oracle of the FAL Server
Net service name [/color] *. fal_client = 10 gstandby [color = Red] ###
Define the Oracle Net service name of the standby database (these two parameters can be unavailable in the primary database, but the standby database must have. Oracle
A foreigner engineer said that this must contain ^_^) [/color]
*. Db_recovery_file_dest = '/oracle2/APP/Oracle/flash_recovery_area'
*. Db_recovery_file_dest_size = 2147483648
*. Dispatchers = '(Protocol = TCP) (Service = 10 gxdb )'
*. Job_queue_processes = 10
*. Open_cursors = 300
*. Pga_aggregate_target = 1707081728
*. Processses = 150
*. Remote_login_passwordfile = 'clusive'
*. Sga_target = 1610612736
*. Undo_management = 'auto'
*. Undo_tablespace = 'undotbs1'
*. User_dump_dest = '/oracle2/APP/Oracle/admin/10g/udump'
*. Standby_file_management = auto [color = Red] ### set it to auto so that when the data file is added to or deleted from the primary database, the corresponding modifications can be automatically executed in the standby database. [/color]
5. Start with pfile and recreate the spfile.
Shutdown immediate;
Startup pfile = './pfile. pa ';
Create spfile from pfile = './pfile. ora ';
Shutdown immediate;
Startup;
6. Create password files and control files in the master database.
Orapwd file = orapw10gstandby. ora pass
WORD = change_on_install entries = 10
Alter database create standby database controlfile '/tmp/standby. CTL ';
7. The TNS information is as follows:
Master Database
10g =
(Description =
(Address_list =
(Address = (Protocol = TCP) (host = 192.169.1.204) (Port = 1921 ))
)
(CONNECT_DATA =
(SID = 10g)
)
)
10 upli =
(Description =
(Address_list =
(Address = (Protocol = TCP) (host = 192.169.1.20.) (Port = 1921 ))
)
(CONNECT_DATA =
(SID = 10g)
)
)
10 gstandby =
(Description =
(Address_list =
(Address = (Protocol = TCP) (host = 192.169.1.204) (Port = 1921 ))
)
(CONNECT_DATA =
(SID = 10g)
)
)
8. Full database backup for the master database
Run {
Allocate channel T1 type disk;
Allocate channel T2 type disk;
Backup database format '/tmp/full _ % s ';
Release Channel T1;
Release Channel T2;
}
[This post was last edited by jeffreyli
]
Jeffreyli
Reply: 15:45:28
2. perform the following operations on the slave database:
1. Create a directory structure on the slave database based on the data file location of the master database (preferably consistent with the master database );
Mkdir-P/Oracle/APP/Oracle/oradata /....
2. Use FTP to upload the password files, standby controlfile, and full backup database files created in the master database to the backup database host.
3. Backup parameter file content:
10g. _ db_cache_size = 1207959552
10g. _ java_pool_size = 16777216
10g. _ large_pool_size = 16777216
10g. _ shared_pool_size = 352321536
10g. _ streams_pool_size = 0
*. Audit_file_dest = '/oracle2/APP/Oracle/admin/10g/adump'
*. Background_dump_dest = '/oracle2/APP/Oracle/admin/10g/bdump'
*. Compatible = '10. 2.0.3.0'
*. Control_files = '/oracle2/APP/Oracle/oradata/10g/control01.ctl', '/oracle2/APP/Oracle/oradata/10g/control02.ctl ', '/oracle2/APP/Oracle/oradata/10g/control03.ctl'
*. Core_dump_dest = '/oracle2/APP/Oracle/admin/10g/cdump'
*. Db_block_size = 8192
*. Db_domain =''
*. Db_file_multiblock_read_count = 16
*. Db_name = '10g'
[Color = lime] *. db_unique_name = '10gstandby '##
*. Log_archive_config = 'dg _ Config = (10 upli, 10 gstandby) '# [/color]
[Color = lime] *. log_archive_dest_1 = 'location =/oracle2/ARCH/
Valid_for = (all_logfiles, all_roles) 'db_unique_name = '10gstandby '##
*. Log_archive_dest_2 = 'service = 10 upli arch async valid_for = (online_logfiles, primary_role) db_unique_name = 10upli' # [/color]
*. Log_archive_dest_state_1 = Enable
*. Log_archive_dest_state_2 = Enable
[Color = lime] *. fal_server = 10 gstandby ##
*. Fal_client = 10 upli # [/color] *. db_recovery_file_dest = '/oracle2/APP/Oracle/flash_recovery_area'
*. Db_recovery_file_dest_size = 2147483648
*. Dispatchers = '(Protocol = TCP) (Service = 10 gxdb )'
*. Job_queue_processes = 10
*. Open_cursors = 300
*. Pga_aggregate_target = 1707081728
*. Processses = 150
*. Remote_login_passwordfile = 'clusive'
*. Sga_target = 1610612736
*. Undo_management = 'auto'
*. Undo_tablespace = 'undotbs1'
*. User_dump_dest = '/oracle2/APP/Oracle/admin/10g/udump'
*. Standby_file_management = auto ##
4. Recover the full database of the slave database and start it to the standby database Mount state.
Use the pfile file to start to the nomount state, restore the control file, and then start to the Mount state, and then restore the entire database.
5. The TNS information is as follows:
10g =
(Description =
(Address_list =
(Address = (Protocol = TCP) (host = 192.169.1.204) (Port = 1921 ))
)
(CONNECT_DATA =
(SID = 10g)
)
)
10 upli =
(Description =
(Address_list =
(Address = (Protocol = TCP) (host = 192.169.1.20.) (Port = 1921 ))
)
(CONNECT_DATA =
(SID = 10g)
)
)
10 gstandby =
(Description =
(Address_list =
(Address = (Protocol = TCP) (host = 192.169.1.204) (Port = 1921 ))
)
(CONNECT_DATA =
(SID = 10g)
)
)
Whether or not to use tnsping.
6. Modify the standby database to archive the application
Alter database recover managed standby database disconnect from session;
If the master database is never archived, You can manually modify the parameters on the master database side as follows:
Alter system set log_archive_dest_state_2 = 'delete' scope = memory;
Alter system set log_archive_dest_state_2 = 'enable' scope = memory;
7. Test
Run alter system switch logfile on the master database. You can see that the slave database automatically applies the logs sent from the master database.
Iii. Switch Test
1. On the master database end
Select switchover_stats from V $ database;
If the table to standby is used, it can be switched normally.
Directly execute alter database commit to switchover to physical standby;
Otherwise execute: Alter database commit to switchover to physical standby with Session shutdown;
Shutdown immediate;
Startup nomount;
Alter database Mount standby database;
2. In the standby Database
In the slave Database
Select switchover_status from V $ database;
The to_primary table can be switched normally.
Run: Alter database commit to switchover to primary;
Otherwise execute: Alter database commit to switchover to primary with Session shutdown;
Shutdown immediate;
Startup;
Then observe the logs of the master and slave databases. If the logs are normal, the logs are automatically applied to the slave database.