二、创建第二个备库stddb
2.1 调整pridb主库设置
1.配置log_archive_config
SQL>alter system set log_archive_config='dg_config=(pridb,auxdb,stddb)';
2.设置归档目标地
SQL>alter system set log_archive_dest_3='service=stddb lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=stddb';
3.设置端点提取
SQL>alter system set fal_server=stddb;
System altered.
2.2 准备新备库stddb
1.建立参数
*.audit_file_dest='/u01/app/oracle/admin/stddb/adump'
*.audit_trail='db'
*.compatible='12.1.0.2.0'
*.control_files='/u01/app/oracle/oradata/stddb/control01.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4560m
*.memory_target=600m
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
*.db_name='orcl'
--下面是调整参数
*.instance_name=stddb
*.db_unique_name='stddb'
*.log_archive_config='dg_config=(pridb,auxdb,stddb)'
*.db_file_name_convert='/u01/app/oracle/oradata/orcl/','/u01/app/oracle/oradata/stddb/'
*.log_file_name_convert='/u01/app/oracle/oradata/orcl/','/u01/app/oracle/oradata/stddb/'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=stddb'
*.log_archive_dest_2='service=pridb lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=pridb'
*.standby_file_management='AUTO'
*.fal_client='stddb'
*.fal_server='pridb'
2.建立对应目录
[oracle@dbserver ~]$ mkdir -p /u01/app/oracle/admin/stddb/adump
[oracle@dbserver ~]$ mkdir -p /u01/app/oracle/oradata/stddb/
3.创建spfile
[oracle@dbserver dbs]$ echo $ORACLE_SID
stddb
sql>create spfile from pfile='/home/oracle/initstddb.ora';
4.创建口令文件
[oracle@dbserver dbs]$ pwd
/u01/app/oracle/product/12.1.0/dbhome_1/dbs
[oracle@dbserver dbs]$ cp orapworcl orapwstddb
5.使用spfile启动到nomount;
sql>startup nomount;
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/12.1.0
/dbhome_1/dbs/spfilestddb.ora
SQL>
6.添加静态监听
$ORACLE_HOME/network/admin/listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = auxdb)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = auxdb)
)
(SID_DESC =
(GLOBAL_DBNAME = stddb)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = stddb)
)
)
7.加载监听配置
lsnrctl reload
8.验证监听神效
LSNRCTL> status
Service "PRIDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "auxdb" has 2 instance(s).
Instance "auxdb", status UNKNOWN, has 1 handler(s) for this service...
Instance "auxdb", status READY, has 1 handler(s) for this service...
Service "stddb" has 2 instance(s).
Instance "stddb", status UNKNOWN, has 1 handler(s) for this service...
Instance "stddb", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully
9.建立到新备库连接串
$ORACLE_HOME/network/admin/tnsnames.ora
stddb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbserver)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = stddb)
)
)
10.测试联通性
SQL> conn sys/oracle_4U@stddb as sysdba
Connected.
2.3 开始复制
rman target sys/oracle_4U@pridb auxiliary sys/oracle_4U@stddb
rman > duplicate target database for standby NOFILENAMECHECK from active database;
2.4 备库处于恢复模式
recover managed standby database disconnect from session;
导此,两个备库已经建立连接
|