暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

19c dbca 创建dataguard

原创 许玉冲 2023-06-28
341


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]

https://docs.oracle.com/en/database/oracle/oracle-database/19/sbydb/creating-oracle-data-guard-physical-standby.html#GUID-7C55FE8A-50C3-4601-9ADA-98BE6D65F1DD

Data Guard Concepts and Administration 19


--不支持多租户,RAC;仅支持单实例模式。



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.

--定制脚本

dbca -silent -createDuplicateDB -primaryDBConnectionString myprimary.domain:1523/chicago.domain
-gdbName chicago.domain -sid boston -initParams instance_name=boston -createAsStandby -customScripts /tmp/test.sql

Enter SYS user password:

Listener config step
25% complete
Auxiliary instance creation
50% complete
RMAN duplicate
75% complete
Running Custom Scripts
100% complete
Look at the log file " /u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/dbca/chicago/chicago.log" for further details.





#更正,支持PDB,CDB模式:

Before You Begin


https://docs.oracle.com/en/database/oracle/oracle-database/19/duplicate-cdbs-using-dbca-silent-mode/index.html






In Oracle Database 18c, duplicating a CDB requires several commands to be executed.

What Do You Need?
Oracle Database 19c installed
A CDB: ORCL with PDB1 in archivelog mode. 
HR schema installed in PDB1 as an example of application tables. If you want to use the HR.EMPLOYEES table, use the hr.sql. Download the SQL script to the labs directory created on your server /home/oracle/labs. In the script, update the password of the user connected to the database.
section 1Check the Existence of Application Data in the CDB
Log in to PDB1 in ORCL as SYSTEM.
sqlplus system@PDB1
Enter password: password
Use the hr.sql script to create the HR user and EMPLOYEES table in PDB1.
@/home/oracle/labs/hr.sql
Verify that PDB1 contains the HR.EMPLOYEES table.
SELECT count(*) FROM hr.employees;

COUNT(*)
----------
       107
Quit the session.
EXIT
section 2Use DBCA to Duplicate a CDB
In this section, you use DBCA in silent mode to duplicate ORCL as CDB19 .

Launch DBCA in silent mode to duplicate ORCL as CDB19. Update the hostname by your server name in the command. SI means Single Instance.
dbca -silent -createDuplicateDB -gdbName CDB19 -sid CDB19 -primaryDBConnectionString hostname:1521/ORCL -databaseConfigType SI -initParams db_unique_name=CDB19 -sysPassword password -datafileDestination /u02/app/oracle/oradata 
Prepare for db operation 22% complete
Listener config step 44% complete
Auxiliary instance creation 67% complete
RMAN duplicate 89% complete
Post duplicate database operations 100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/CDB19/CDB19.log" for further details.
section 3Check that the CDB Is Duplicated
Connect to CDB19 as SYS.
sqlplus sys@CDB19 AS SYSDBA
Enter password: password
SHOW PDBS

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
Check that PDB1 contains the HR.EMPLOYEES table as in PDB1 of ORCL.
CONNECT hr@PDB1
Enter password: password
SELECT count(*) FROM employees;

  COUNT(*)
----------
       107
section 4Use DBCA to Duplicate a CDB with OMF
In this section, you use DBCA in silent mode to duplicate ORCL as CDBOMF19 with OMF files.

Launch DBCA in silent mode to duplicate ORCL as CDBOMF19. Update the hostname by your server name in the command.
dbca -silent -createDuplicateDB -gdbName CDBOMF19 -sid CDBOMF19 -primaryDBConnectionString hostname:1521/ORCL -databaseConfigType SI -initParams db_unique_name=CDBOMF19 -sysPassword password -datafileDestination /u02/app/oracle/oradata –useOMF=TRUE 
Prepare for db operation 22% complete
Listener config step 44% complete
Auxiliary instance creation 67% complete
RMAN duplicate 89% complete
Post duplicate database operations 100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/CDBOMF19/CDBOMF19.log" for further details.
Connect to CDBOMF19 as SYS.
sqlplus sys@CDBOMF19 AS SYSDBA
Enter password: password
COL name FORMAT A78
SELECT name FROM v$datafile;
NAME
--------------------------------------------------------------------
/u02/app/oracle/oradata/CDBOMF19/system01.dbf
...
/u02/app/oracle/oradata/CDBOMF19/PDB1/system01.dbf
/u02/app/oracle/oradata/CDBOMF19/PDB1/sysaux01.dbf
/u02/app/oracle/oradata/CDBOMF19/PDB1/undotbs01.dbf
...
Quit the session.
EXIT
section 5Clean Up the CDBs Duplicated
Use DBCA to delete CDB19.
$ORACLE_HOME/bin/dbca -silent -deleteDatabase -sourceDB CDB19 -sid CDB19 -sysPassword password
Use DBCA to delete CDBOMF19.
$ORACLE_HOME/bin/dbca -silent -deleteDatabase -sourceDB CDBOMF19 -sid CDBOMF19 -sysPasswo











最后修改时间:2023-06-30 12:59:13
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论