Database: Oracle11gr2 master database alterdatabaseforcelogging; altersystemsetdb_unique_nameerpdbscopespfile; -- let's let the master database crash; altersystemsetLOG_ARCHIVE
Database: Oracle11gr2 master database alter database force logging; alter system set db_unique_name = 'erpdb' scope = spfile; -- let's make the master database db_name = db_unique_name alter system set REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE scope = spfile; alter system set LOG_ARCHIVE
Database: Oracle11gr2
Master Database
Alter database force logging;
Alter system set db_unique_name = 'erpdb' scope = spfile; -- let's make the master database db_name = db_unique_name
Alter system set REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE scope = spfile;
Alter system set LOG_ARCHIVE_FORMAT = '% t _ % s _ % r. arc' scope = spfile;
Alter system set LOG_ARCHIVE_CONFIG = 'dg _ CONFIG = (erpdb, erpdg) 'scope = both;
Alter system set LOG_ARCHIVE_DEST_1 = 'location = USE_DB_RECOVERY_FILE_DEST VALID_FOR = (ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME = erpdb' scope = both;
# Alter system set LOG_ARCHIVE_DEST_2 = 'service = erpdg ASYNC VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME = erpdg' scope = both;
Alter system set LOG_ARCHIVE_DEST_2 = 'service = 10.10.1.20.: 1601/erpdg ASYNC VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME = erpdg 'scope = both;
Alter system set LOG_ARCHIVE_DEST_STATE_1 = ENABLE scope = both;
Alter system set LOG_ARCHIVE_DEST_STATE_2 = defer scope = both;
Alter system set LOG_ARCHIVE_MAX_PROCESSES = 30 scope = both;
Restart Database
Shutdown immediate;
Startup mount
Enable Archiving:
Alter database archivelog;
Alter database open;
Configure the listeners and tns of both databases to enable tnsping for each other.
Listeners
SID_LIST_erpdb = (SID_LIST = (SID_DESC = (ORACLE_HOME =/u01/erpdb/db/tech_st/11.2.0) (SID_NAME = erpdb )))
Erpdb = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = erpdb.dji.com) (PORT = 1601 ))))
SID_LIST_erpdg = (SID_LIST = (SID_DESC = (SID_NAME = erpdg) (ORACLE_HOME =/u01/erpdg/db/tech_st/11.2.0 )))
Erpdg = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 10.10.1.20.) (PORT = 1601 ))))
TNS
Erpdb = (description = (address = (protocol = tcp) (host = 10.10.0.20.) (port = 1601) (connect_data = (sid = erpdb )))
Erpdg = (description = (address = (protocol = tcp) (host = 10.10.1.20.) (port = 1601) (connect_data = (sid = erpdg )))
Create a password file for the master database and send it to the dg database. Alternatively, the dg database directly creates a password file. The sys password is consistent with that of the master database.
Cd $ ORACLE_HOME/dbs & orapwd file = orapw $ ORACLE_SID password = oracle force = y
Cd $ ORACLE_HOME/dbs & vi fwy. ora
#
Db_name = erpdb
Db_unique_name = erpdg
Db_create_file_dest = '/u01/erpdg/db/pai_st'
Diagnostic_dest = '/u01/erpdg/db/tech_st/11.2.0/admin/erpd_erpdg'
LOG_ARCHIVE_CONFIG = 'dg _ CONFIG = (erpdb, erpdg )'
Fal_server = erpdb
Fal_client = erpdg
#
Utl_file_dir = '/tmp'
Log_buffer = 15728640 #15 m
Pga_aggregate_target = 1073741824 #1G
Java_pool_size = 157286400 #150 m
Large_pool_size = 157286400 #150 m
Sga_target = 0
Shared_pool_size = 1073741824 #1G
Db_cache_size = 1073741824 #1G
Parallel_max_servers = 8
_ B _tree_bitmap_plans = FALSE
_ Fast_full_scan_enabled = FALSE
O7_DICTIONARY_ACCESSIBILITY = FALSE
_ Like_with_bind_as_equality = TRUE
_ Optimizer_autostats_job = FALSE
_ Sort_elimination_cost_ratio = 5
_ System_trig_enabled = TRUE
_ Trace_files_public = true
Plsql_code_type = 'native'
Plsql_optimize_level = 2
Compatible = 11.2.0
Cursor_sharing = EXACT
Db_block_checking = false
Db_block_checksum = true
Db_files = 5120
Dml_locks = 30000
Log_checkpoint_interval = 100000
Log_checkpoint_timeout = 1200
Log_checkpoints_to_alert = TRUE
Nls_territory = america
Olap_page_pool_size = 4194304
Optimizer_secure_view_merging = FALSE
Parallel_min_servers = 0
Sec_case_sensitive_logon = false
Undo_management = auto
Undo_retention = 21600 #6 hours
Undo_tablespace = pai_undots1
Remote_login_passwordfile = EXCLUSIVE
Query_rewrite_enabled = true
DB _ block_size = 8192
Db_file_multiblock_read_count = 64
Db_writer_processes = 10
Resource_manager_plan =''
_ Resource_manager_always_on = false
Disk_asynch_io = false
Open_cursors = 7000
Recyclebin = off
_ System_trig_enabled = true
O7_DICTIONARY_ACCESSIBILITY = false
Nls_language = american
Nls_territory = america
Nls_date_format = 'dd-MON-RR'
Nls_numeric_characters = '.,'
Nls_sort = binary
Nls_comp = binary
Nls_length_semantics = BYTE
Max_dump_file_size = 51200
Timed_statistics = true
Processes = 3000
Sessions = 6000
Aq_tm_processes = 2
Job_queue_processes = 30
_ Sqlexec_progression_cost = 2147483647
Workarea_size_policy = AUTO
Olap_page_pool_size = 4194304
Optimizer_mode = FIRST_ROWS
LOG_ARCHIVE_FORMAT = '% t _ % s _ % r. arc'
STANDBY_FILE_MANAGEMENT = auto
Slave database started to nomount status
Sqlplus '/as sysdba' < Startup nomount pfile =? /Dbs/fwy. ora
EOF
The source uses the 11g duplicate from active Technology
Source end
Rman target sys/oracle auxiliary sys/oracle @ erpdg
Duplicate target database for standby from active database;
After duplicate is complete, the slave database:
Create spfile = '? /Dbs/fwy2.ora 'from memory;
Cd $ ORACLE_HOME/dbs & cp fwy2.ora spfile $ {ORACLE_SID}. ora
Add a log group for the slave database and four groups for the execution four times.
Alter database add standby logfile size 50 m;
Enable log transfer for the master database
Alter system set LOG_ARCHIVE_DEST_STATE_2 = enable scope = both;
Do not open the database first, even if open fails, because the data files may be inconsistent at this time. Therefore, we should first recover it for a while and make it recover to a consistent state.
Alter database recover managed standby database using current logfile disconnect from session parallel 8;
After a while, stop the MRP process:
Alter database recover managed standby database cancel;
Then you can enable the open read only mode.
Alter database open read only;
Alter database recover managed standby database using current logfile disconnect from session parallel 8;
Check whether the mrp process works normally.
Select PROCESS, STATUS, CLIENT_PROCESS, GROUP #, THREAD #, SEQUENCE #, BLOCK # from v $ managed_standby where process = 'mrp0 ';
-- Compare the Maximum Application Log time of the master database and slave Database
Alter session set nls_date_format = 'yyyy-mm-dd hh24: mi: ss ';
Col max (first_time) for a30
Select max (first_time) from v $ log_history;
-- The master database is the largest log that has been written, and the slave database is the largest log that has been applied.
Alter session set nls_date_format = 'yyyy-mm-dd hh24: mi: ss ';
Select max (sequence #) from v $ log_history where resetlogs_time >=( select max (resetlogs_time) from v $ log_history );