1.从库安装12c软件
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/app/oracle/oraInventory
ORACLE_HOME=/data/app/oracle/product/12.2.0.1/dbhome_1
ORACLE_BASE=/data/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oinstall
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.password.ALL=oracle
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
./runInstaller -slient -noconfig -responseFile /database/response/db_install.rsp -ignoreSysPrereqs
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 DATAOPPDB READ WRITE NO
SQL> select force_logging from v$database;
FORCE_LOGGING
------------------------------------------------------------------------------
YES
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 72811
Next log sequence to archive 72838
Current log sequence 72838
SQL> show parameter recovery
NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
db_recovery_file_dest string
/data/app/oracle/flash_recover
y_area
db_recovery_file_dest_size big integer
800G
recovery_parallelism integer
0
remote_recovery_file_dest string
SQL>
2.在主库添加 standby redo logfile
在Oracle 12c的架构里,online redo log 和控制文件是保存在CDB中的,PDB中只有运行需要的数据文件,所以我们这里加standby redo log,也是在CDB中加。
SQL> select group#,members,bytes/1024/1024 from v$log;
GROUP# MEMBERS BYTES/1024/1024
---------- ---------- ---------------
1 1 1024
2 1 1024
3 1 1024
4 1 1024
5 1 1024
6 1 1024
7 1 1024
8 1 1024
9 1 1024
10 1 1024
11 1 1024
12 1 1024
13 1 1024
14 1 1024
15 1 1024
16 1 1024
17 1 1024
18 1 1024
19 1 1024
20 1 1024
21 1 1024
22 1 1024
23 1 1024
24 1 1024
25 1 1024
26 1 1024
27 1 1024
28 1 1024
28 rows selected.
SQL> select member from v$logfile;
MEMBER
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/data/app/oracle/datafile/dataop/redo03.log
/data/app/oracle/datafile/dataop/redo02.log
/data/app/oracle/datafile/dataop/redo01.log
/data/app/oracle/datafile/dataop/redo04.log
/data/app/oracle/datafile/dataop/redo05.log
/data/app/oracle/datafile/dataop/redo06.log
/data/app/oracle/datafile/dataop/redo07.log
/data/app/oracle/datafile/dataop/redo08.log
/data/app/oracle/datafile/dataop/redo09.log
/data/app/oracle/datafile/dataop/redo10.log
/data/app/oracle/datafile/dataop/redo11.log
/data/app/oracle/datafile/dataop/redo12.log
/data/app/oracle/datafile/dataop/redo13.log
/data/app/oracle/datafile/dataop/redo14.log
/data/app/oracle/datafile/dataop/redo15.log
/data/app/oracle/datafile/dataop/redo16.log
/data/app/oracle/datafile/dataop/redo17.log
/data/app/oracle/datafile/dataop/redo18.log
/data/app/oracle/datafile/dataop/redo19.log
/data/app/oracle/datafile/dataop/redo20.log
/data/app/oracle/datafile/dataop/redo21.log
/data/app/oracle/datafile/dataop/redo22.log
/data/app/oracle/datafile/dataop/redo23.log
/data/app/oracle/datafile/dataop/redo24.log
/data/app/oracle/datafile/dataop/redo25.log
/data/app/oracle/datafile/dataop/redo26.log
/data/app/oracle/datafile/dataop/redo27.log
/data/app/oracle/datafile/dataop/redo28.log
28 rows selected.
添加28+1个standby logfile
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo01.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo02.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo03.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo04.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo05.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo06.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo07.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo08.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo09.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo10.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo11.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo12.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo13.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo14.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo15.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo16.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo17.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo18.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo19.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo20.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo21.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo22.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo23.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo24.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo25.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo26.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo27.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo28.log' size 1024M;
alter database add standby logfile '/data/app/oracle/datafile/dataop/stdredo29.log' size 1024M;
3.主备库配置监听文件
主库
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dataop)
(ORACLE_HOME = /data/app/oracle/product/12.2.0.1/dbhome_1)
(SID_NAME = dataop)
)
)
ADR_BASE_LISTENER1 = /data/app/oracle
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.xxx.xxx.76)(PORT = 1521))
)
)
[oracle@dataop admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /data/app/oracle/product/12.2.0.1/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
DATAOP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.xxx.xxx.76)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = dataop)
)
)
DATAOPDG1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.xxx.xxx.44)(PORT = 1544))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dataopdg1)
)
)
备库
[oracle@dataopdg1 admin]$ cat listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dataoppdb) //客户端连接pdb数据库的名字
(ORACLE_HOME = /data/app/oracle/product/12.2.0.1/dbhome_1)
(SID_NAME = dataopdg1)
)
(SID_DESC =
(GLOBAL_DBNAME = dataopdg1) //主库同步archive_dest设置目录名字
(ORACLE_HOME = /data/app/oracle/product/12.2.0.1/dbhome_1)
(SID_NAME = dataopdg1)
)
)
ADR_BASE_LISTENER1 = /data/app/oracle
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.xxx.xxx.44)(PORT = 1544))
)
)
[oracle@dataopdg1 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /data/app/oracle/product/12.2.0.1/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
DATAOP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.xxx.xxx.76)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = dataop)
)
)
DATAOPDG1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.xxx.xxx.44)(PORT = 1544))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dataopdg1)
)
)
4.主库配置DG备库信息
alter system set log_archive_config='dg_config=(DATAOP,DATAOPDG1)' scope=both;
alter system set log_archive_dest_2='SERVICE=DATAOPDG1 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=DATAOPDG1' scope=both;
alter system set db_unique_name=dataop scope=both;
alter system set FAL_SERVER='DATAOPDG1' scope=both;
5.备库配置必要参数文件
监听文件,密码文件,参数文件传到备库。
从库配置文件,提前创建出目录文件
dataopdg1.__data_transfer_cache_size=0
dataopdg1.__db_cache_size=81067507712
dataopdg1.__inmemory_ext_roarea=0
dataopdg1.__inmemory_ext_rwarea=0
dataopdg1.__java_pool_size=1879048192
dataopdg1.__large_pool_size=3221225472
dataopdg1.__oracle_base='/data/app/oracle'#ORACLE_BASE set from environment
dataopdg1.__shared_io_pool_size=0
dataopdg1.__shared_pool_size=10200547328
dataopdg1.__streams_pool_size=0
*.aq_tm_processes=1
*.audit_file_dest='/data/app/oracle/admin/dataop/adump'
*.audit_trail='db'
*.compatible='12.2.0'
*.control_files='/data/app/oracle/datafile/dataop/control01.ctl','/data/app/oracle/flash_recovery_area/dataop/control02.ctl'
*.db_block_size=8192
*.db_file_name_convert='/data/app/oracle/datafile/dataop/dataoppdb/','/data/app/oracle/datafile/dataop/dataopdg1/','/data/app/oracle/datafile/dataop/pdbseed/','/data/app/oracle/datafile/dataop/pdbseed/'
*.db_files=2000
*.db_name='dataop'
*.db_recovery_file_dest='/data/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=858993459200
*.db_unique_name='dataopdg1'
*.diagnostic_dest='/data/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=dataopXDB)'
*.enable_pluggable_database=true
*.fal_server='DATAOP'
*.job_queue_processes=4000
*.log_archive_config='dg_config=(DATAOP,DATAOPDG1)'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dataopdg1'
*.log_archive_dest_2='SERVICE=DATAOP LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=DATAOP'
*.log_archive_dest_state_1='enable'
*.log_archive_dest_state_2='ENABLE'
*.log_file_name_convert='/data/app/oracle/datafile/dataop/','/data/app/oracle/datafile/dataopdg1/','/data/app/oracle/flash_recovery_area/DATAOP/','/data/app/oracle/flash_recovery_area/DATAOPDG1/'
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.open_links_per_instance=50
*.open_links=50
*.pga_aggregate_target=9663676416
*.processes=2560
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='auto'
*.undo_retention=1800
*.undo_tablespace='UNDOTBS1'
[oracle@dataop ~]$ rman target sys/oracle auxiliary sys/oracle@dataopdg1
RMAN> duplicate target database for standby from active database nofilenamecheck dorecover;
alter database recover managed standby database disconnect from session;
select sequence#, first_time, next_time, applied, archived from v$archived_log;
select process, client_process, sequence#, status from v$managed_standby;
alter database recover managed standby database cancel;
SQL>alter database open;
SQL> alter pluggable database dataoppdb open;
SQL> alter database recover managed standby database using current logfile disconnect from session;
详细文档(包括GI图形安装)自取:
链( )接:https://pan.quark.cn/s/7bb68ae4c58f
提取码:vGdm