dbca 创建standby 数据库-阿里云开发者社区

开发者社区> 数据库> 正文

dbca 创建standby 数据库

简介: dbca -silent -createDuplicateDB

1,参考文档和手册

参考手册:

《Data Guard Concepts and Administration》
3.4 Using DBCA to Create a Data Guard Standby

《Database Administrator’s Guide》
2.3 Creating a Database with DBCA

The Database Configuration Assistant (DBCA) can also be used as a simple command-line method to create an Oracle Data Guard physical standby database.

非多租户的数据库环境,单实例环境。

The DBCA command qualifier used to create the physical standby database is createDuplicateDB .

DBCA can only be used to create standby databases for non-multitenant primary databases. In addition, this capability creates only single instance standby databases, not Oracle Real Application Clusters (Oracle RAC) databases. If required, the standby can then be converted to an Oracle RAC standby database, either manually or using Oracle Enterprise Manager Cloud Control

dbca -createDuplicateDB 
    -gdbName global_database_name 
    -primaryDBConnectionString easy_connect_string_to_primary
    -sid database_system_identifier
    [-createAsStandby 
        [-dbUniqueName db_unique_name_for_standby]]
    [-customScripts scripts_list]

创建备用数据库:

dbca –silent -createDuplicateDB -primaryDBConnectionString  myprimary.domain:1523/chicago.domain 
-gdbName chicago.domain -sid boston -initParams instance_name=boston –createAsStandby

Enter SYS user password:
Listener config step
33% complete
Auxiliary instance creation
66% complete
RMAN duplicate
100% complete
Look at the log file " /u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/dbca/chicago/chicago.log" for further details.

2,实战操错练习

数据库版本

Release 12.2.0.1.0

主机环境设置

192.168.0.196 prod04 #primary db
192.168.0.197 prod05#standby db

主库sid:

[oracle@prod04 ~]$ ps -ef|grep pmon
oracle     6047      1  0 09:05 ?        00:00:02 ora_pmon_orcl
oracle    10361  10343  0 13:29 pts/0    00:00:00 grep --color=auto pmon

备库sid:

[oracle@prod05 ~]$ 
[oracle@prod05 ~]$ ps -ef|grep pmon
oracle     9800      1  0 11:07 ?        00:00:01 ora_pmon_sborcl
oracle    10492  10471  0 13:25 pts/2    00:00:00 grep --color=auto pmon

主备机需要配置tnsname.ora

[oracle@prod04 admin]$ cat tnsnames.ora 
orcl =
(DESCRIPTION =
    (ADDRESS_LIST =(ADDRESS=(PROTOCOL= TCP)(HOST=prod04)(PORT=1521)))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = orcl))
)

sborcl =
(DESCRIPTION =
    (ADDRESS_LIST =(ADDRESS=(PROTOCOL = TCP)(HOST=prod05) (PORT=1521)))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = sborcl))
)

>主数据库要求:
打开数据库归档
非cdb模式数据库
打开监听
配置tnsname.ora.

>备机要求
配置tnsname.ora
执行dbca.(自动创建静态监听和启动监听程序)

[oracle@prod05 ~]$ dbca -silent -createDuplicateDB -primaryDBConnectionString 192.168.0.196:1521/orcl -gdbName orcl -sid sborcl -initParams instance_name=sborcl -createAsStandby
Enter SYS user password: 

Listener config step
33% complete
Auxiliary instance creation
66% complete
RMAN duplicate
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.

如果未配置tnsname.ora报错信息:

[oracle@prod05 ~]$ dbca -silent -createDuplicateDB -primaryDBConnectionString 192.168.0.196:1521/orcl -gdbName orcl -sid sborcl -initParams instance_name=sborcl -createAsStandby
Enter SYS user password: 

Listener config step
33% complete
Auxiliary instance creation
66% complete
RMAN duplicate
DBCA Operation failed.
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.

删除数据库:
dbca -silent -deleteDatabase -sourceDB sborcl

3,光放参考文档:

Creating a Physical Standby database using DBCA duplicate (文档 ID 2283697.1)

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
数据库
使用钉钉扫一扫加入圈子
+ 订阅

分享数据库前沿,解构实战干货,推动数据库技术变革

其他文章