稍有区别的地方有:
1)静态监听配置
点击(此处)折叠或打开
-
SID_LIST_LISTENER =
-
(SID_LIST =
-
(SID_DESC =
-
(SID_NAME = jiangsu)
-
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/db_1)
-
(GLOBAL_DBNAME = jiangsu)
-
)
- )
点击(此处)折叠或打开
-
$ srvctl config database -db racdb
-
Database unique name: racdb
-
Database name: racdb
-
Oracle home: /u01/app/oracle/product/12.1.0/db_1
-
Oracle user: oracle
-
Spfile: +DATA/RACDB/PARAMETERFILE/spfile.272.912277345
- Password file: +DATA/RACDB/PASSWORD/pwdracdb.257.912274501
点击(此处)折叠或打开
-
ASMCMD> cp pwdracdb.257.912274501 /tmp
- copying +DATA/RACDB/PASSWORD/pwdracdb.257.912274501 -> /tmp/pwdracdb.257.912274501
点击(此处)折叠或打开
-
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 SIZE 500M;
-
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 SIZE 500M;
-
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 SIZE 500M;
-
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 SIZE 500M;
-
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 SIZE 500M;
- SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 SIZE 500M;
4)spfile的链接
使用duplicate时,默认寻找spfile的路径在+DATA/racdb/spfileracdb.ora,而这并不是spfile的实际路径,因此需要在asmcmd中进行链接
点击(此处)折叠或打开
- ASMCMD> mkalias +DATA/RACDB/PARAMETERFILE/spfile.272.912277345 +DATA/racdb/spfileracdb.ora
点击(此处)折叠或打开
-
set cluster_database='FALSE'
- set remote_listener=''
点击(此处)折叠或打开
-
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
-
or
-
- SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING ARCHIVED LOGFILE DISCONNECT;
完整示例:
点击(此处)折叠或打开
-
connect target sys/oracle@racdb
-
connect auxiliary sys/oracle@stby
-
run {
-
allocate channel prmy1 type disk;
-
allocate channel prmy2 type disk;
-
allocate channel prmy3 type disk;
-
allocate channel prmy4 type disk;
-
allocate channel prmy5 type disk;
-
allocate auxiliary channel stby1 type disk;
-
duplicate target database for standby from active database
-
spfile
-
parameter_value_convert 'racdb','stby'
-
set 'db_unique_name'='stby'
-
set control_files='/oradata/STBY/controlfile/control01.ctl','/fra/STBY/controlfile/control02.ctl'
-
set db_create_file_dest='/oradata'
-
set db_create_online_log_dest_1='/oradata'
-
set db_create_online_log_dest_2='/fra'
-
set db_recovery_file_dest='/fra'
-
set DB_RECOVERY_FILE_DEST_SIZE='45G'
-
set cluster_database='FALSE'
-
set remote_listener=''
-
set DB_FILE_NAME_CONVERT='+DATA/RACDB/','/oradata/STBY/'
-
set audit_file_dest='/u01/app/oracle/admin/stby/adump'
-
set log_archive_max_processes='4'
-
set fal_client='stby'
-
set fal_server='racdb'
-
set standby_file_management='AUTO'
-
set log_archive_config='dg_config=(racdb,stby)'
-
set log_archive_dest_2='service=racdb LGWR ASYNC
-
valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)
-
db_unique_name=racdb'
-
nofilenamecheck;
-
sql channel prmy1 "alter system set
-
log_archive_config=''dg_config=(racdb,stby)''";
-
sql channel prmy1 "alter system set
-
log_archive_dest_2=''service=stby LGWR ASYNC
-
valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)
-
db_unique_name=stby''";
-
sql channel prmy1 "alter system set log_archive_max_processes=4";
-
sql channel prmy1 "alter system set fal_client=racdb";
-
sql channel prmy1 "alter system set fal_server=stby";
- sql channel prmy1 "alter system set standby_file_management=AUTO";
-
sql channel prmy1 "alter system archive log current";
-
allocate auxiliary channel stby type disk;
-
sql channel stby "alter database recover managed standby database
-
disconnect";
- }
点击(此处)折叠或打开
- alter system set DB_FILE_NAME_CONVERT='/oradata/STBY/','+DATA/RACDB/' scope=spfile;
完成。
注意,另一个相似的参数log_file_name_convert不要配置,因为经测试新创建logfile时设置该参数并不能自动在Standby端同步建立log文件。所以Standby端需手动建立log文件。
MOS ID 1367014.1曾建议在OMF下,不要设置log_file_name_convert和db_file_name_convert参数。但PDB确实需要db_file_name_convert参数,当Primary端新建PDB时将在Standby端依此转换路径。
另外,如果要以ADG方式运行,必须先启动到只读打开模式,再开启redo apply。不能反过来,否则会报错。