1. Set the main library to archive mode
sql> shutdown Immediate Sql> Startup Mount sql> ALTER DATABASE Archivelog; sql> archive log list; |
2. Open Force logging
sql> ALTER DATABASE force logging; Database altered. Sql> Sql> select name,database_role,log_mode,force_logging from V$database; NAME database_role Log_mode Force_log ---------- ------------------------- --------------- --------- ORCL PRIMARY ARCHIVELOG YES |
3. Configure the listening files and configure them on the auxiliary library.
LISTENER = (Description_list = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = Localhost.localdomain) (PORT = 1521)) (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521)) ) ) Sid_list_listener = (Sid_list = (Sid_desc = (Global_dbname = ORCL) (oracle_home=/u01/app/oracle/product/11.2.0/dbhome_1) (Sid_name = ORCL) ) ) Adr_base_listener =/u01/app/oracle |
4. Configuring the Tnsnames.ora File
# Tnsnames.ora Network Configuration File:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.100.40) (PORT = 1521)) (Connect_data = (SERVER = dedicated) (service_name = ORCL) ) ) Orcldb = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.100.41) (PORT = 1521)) (Connect_data = (SERVER = dedicated) (service_name = ORCL) ) ) |
5, the CP target database password file to the auxiliary library
6. Create the necessary directories for the auxiliary library
7. Prepare a parameter file for auxiliary, including two parameters:
Db_name=orcl
Db_unique_name=orcl
8. Start Auxiliary Library to Nomount status
9. Rman connects to target Library and auxiliary library
[[email protected] dbs]$ Rman target Sys/[email protected] auxiliary sys/[email protected] Recovery manager:release 11.2.0.4.0-production on Thu Jul 7 16:01:51 2016 Copyright (c) 1982, Oracle and/or its affiliates. All rights reserved. Connected to target DATABASE:ORCL (dbid=1439188069) Connected to auxiliary DATABASE:ORCL (not mounted) Rman> |
10. Run the following script under Rman
First look at the physical structure of the target database:
sql> Select n Ame from V$datafile; NAME -------------------------------------------------------------------------------- /data /ORADATA/ORCL/ORCL/SYSTEM01.DBF /data/oradata/orcl/orcl/sysaux01.dbf /data/oradata/orcl/orcl/ UNDOTBS01.DBF /data/oradata/orcl/orcl/users01.dbf /u01/app/oracle/oradata/orcl/efmis01.dbf |
run{ Duplicate target Database To ORCL From active database Db_file_name_convert '/data/oradata/orcl/orcl ', '/data/oradata/orcl ', '/u01/app/oracle/oradata/orcl ', '/data/ ORADATA/ORCL ' SPFile Set Db_unique_name= ' ORCL ' Set Log_file_name_convert '/data/oradata/orcl/orcl ', '/DATA/ORADATA/ORCL ' Set control_files= '/data/oradata/orcl/control.ctl ' ; } |
Take a look at the physical structure of the Auxiliary library:
Sql> select name from V$datafile; NAME -------------------------------------------------------------------------------- /data/oradata/orcl/system01.dbf /data/oradata/orcl/sysaux01.dbf /data/oradata/orcl/undotbs01.dbf /data/oradata/orcl/users01.dbf /data/oradata/orcl/efmis01.dbf |
11. Edit the/etc/oratab file and add the following entries:
Orcl:/u01/app/oracle/product/11.2.0/dbhome_1:y
Attention:
Db_file_name_convert The data files of the primary and standby databases are converted to the directory mappings (if the directory structure of the two databases is different), if there are multiple mappings, specify the mapping relationship.
Rman Active database replication