In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The previous article introduced three features in Data Guard 12cR2, and this article will continue to introduce some of the new features.
| | Using DBCA to Create a Data Guard Standby |
The ways to create a physical repository before 12c are as follows:
1. Using the RMAN backup recovery method
two。 You can choose duplicate to create a physical backup database at 11g; in this way, you can build a physical backup database directly from the main database online.
After arriving at 12cR2, Oracle provides a simpler way to create a physical repository, which is introduced in this article: even if you use DBCA to build a physical repository directly. This feature once again simplifies the complexity of creating a standby library.
With the parameter createDuplicateDB provided by DBCA, we can easily build a physical repository. The specific syntax is as follows:
Dbca-createDuplicateDB-gdbName global_database_name-primaryDBConnectionString easy_connect_string_to_primary-sid database_system_ identifiers [- createAsStandby [- dbUniqueName db_unique_name_for_standby]] [- customScripts scripts_list] [- datafileDestination data_files_directory] [- initParams initialization_parameters [- initParamsEscapeChar initialization_parameters_escape_character]] [- useWalletForDBCredentials {true | false}-dbCredentialsWalletPassword wallet_account_password-dbCredentialsWalletLocation wallet_files_directory]
Although it is very easy to create a physical repository through DBCA, the following conditions must be met to use this feature:
The main database must be a stand-alone environment, not a RAC database
The primary library must be a non-CDB environment
One of the most important new features in 12c is the multi-tenant environment, but this feature does not support databases in the CDB environment, and the main library cannot be a RAC environment. If the above conditions are not met, the following error will be prompted when creating a slave library using DBCA:
The main library is the CDB environment, and the errors are as follows: [FATAL] [DBT-16057] Specified primary database is a container database (CDB). CAUSE: Duplicate database operation is supported only for non container databases. The main database is RAC database, and the error is as follows: [FATAL] [DBT-16056] Specified primary database is not a Single Instance (SI) database.CAUSE: Duplicate database operation is supported only for SI databases.
In other words, the slave built through DBCA is also a stand-alone non-CDB slave. If you want to build a slave for RAC, you need to convert it manually or use Oracle Enterprise Manager Cloud Control to convert it into a RAC database.
Next we will demonstrate how to use DBCA to create a physical repository. Assume that the master / slave environment is as follows:
At the same time, it is assumed that the master / slave database already has the following environment:
1. The main library is stand-alone and uses ASM
two。 The main library has enabled archiving mode.
3. Password files and SPFILE are stored in ASM
4. The standby database also uses ASM to store data, and the standby environment already has
The creation steps are as follows:
1. Open Force Logging in the main library
[oracle@dbpri] $sqlplus / as sysdbaSQL > alter database force logging;Database altered.SQL >
two。 The main library creates Standby Redo logs
View the size of the Redo log:
[oracle@dbpri] $sqlplus / as sysdbaSQL > select thread#,group#,bytes/1024/1024 SIZE _ MB, status from v$log THREAD# GROUP# SIZE_MB STATUS--1 1 100 CURRENT1 2 100 INACTIVE1 3 100 INACTIVE1 4 100 INACTIVE1 5 100 INACTIVE1 6 100 INACTIVE
Create a Standby redo logs:
[oracle@dbpri] $sqlplus / as sysdbaSQL > alter database add standby logfile thread 1 group 7 ('+ DATADG') size 100M database altered.SQL > alter database add standby logfile thread 1 group 8 ('+ DATADG') size 100M database altered.SQL > alter database add standby logfile thread 1 group 9 ('+ DATADG') size 100M database altered.SQL > alter database add standby logfile thread 1 group 10 ('+ DATADG') size 100M database altered.SQL > alter database add standby logfile thread 1 group 11 ('+ DATADG') size 100m Database altered.SQL > alter database add standby logfile thread 1 group 12 ('+ DATADG') size 100m database altered.SQL > alter database add standby logfile thread 1 group 13 ('+ DATADG') size 100m database altered.SQL >
When the Standby redo logs is created in the main library, the standby library is also created automatically.
3. Create a network service name
Main library tnsnames.ora
Ordbpri = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS= (PROTOCOL= TCP) (HOST=dbpri) (PORT=1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ordbpri)) ordbstd = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS= (PROTOCOL= TCP) (HOST=dbstd) (PORT=1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ordbstd)) ordbpri_local_listener = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS= (PROTOCOL= TCP) (HOST=dbpri) (PORT=1521)
Reserve library tnsnames.ora
Ordbpri = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS= (PROTOCOL= TCP) (HOST=dbpri) (PORT=1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ordbpri)) ordbstd = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS= (PROTOCOL= TCP) (HOST=dbstd) (PORT=1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ordbstd)) ordbstd_local_listener = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS= (PROTOCOL= TCP) (HOST=dbstd) (PORT=1521)
4. Execute DBCA in the repository
[oracle@dbstd] $dbca-silent-createDuplicateDB-gdbName ordbpri-sid ordbstd-sysPassword oracle-primaryDBConnectionString dbpri:1521/ordbpri-createAsStandby-dbUniqueName ordbstd-initParams db_create_file_dest=+DATADG, db_create_online_log_dest_1=+DATADG,local_listener= "ordbstd_local_listener" output is as follows: Enter SYS user password:Listener config step33% completeAuxiliary instance creation66% completeRMAN duplicate100% completeLook at the log file "/ u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/dbca/ordbpri/ordbpri.log" for further details.
Note: you can also use a custom script to execute the custom script when the standby library is created.
5. Complete the environment configuration in the repository
SQL > alter system set LOG_ARCHIVE_DEST_1='LOCATION=+DATADG VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ordbstd'scope=spfile;SQL > alter system set db_file_name_convert='+DATADG/ordbpri','+DATADG/ordbstd' scope=spfile;SQL > alter system set log_file_name_convert='+DATADG/ordbpri','+DATADG/ordbstd' scope=spfile;SQL > alter system set standby_file_management=auto scope=spfile;SQL > alter system set remote_listener=' dbstd:1521' scope=spfile;SQL > shutdown immediateSQL > startupSQL > alter system register
Note: at 12c, you can try to use DG Broker for Data Guard management and maintenance.
6. Prepare the library to create password files and SPFILE to ASM
[grid@dbstd ~] $export ORACLE_SID=+ ASM1 [grid @ dbstd ~] $export ORACLE_HOME=/u01/app/12.2.0.1/ grid [grid @ dbstd ~] $export PATH=$ORACLE_HOME/bin:$PATH [grid@dbstd] $asmcmd-pASMCMD [+] > mkdir DATADG/ORDBSTD/ PASSWORDASMCMD [+] > pwcopy / u01/app/oracle/product/12.2.0.1/dbhome_1/dbs/orapwordbstd + DATADG/ORDBSTD/PASSWORD/pwordbstd [oracle@dbstd] $rm / u01/app/oracle/product/ 12.2.0.1/dbhome_1/dbs/ orapworddbstd [oracle @ dbstd ~] $export ORACLE_HOME=/u01/app/12.2.0.1/dbhome_1 [oracle@dbstd ~] $export ORACLE_SID= ordbstd [oracle @ dbstd ~] $export PATH=$ORACLE_HOME/bin:$ path [oracle @ dbstd] $sqlplus / as sysdbaSQL > create pfile='/tmp/pfilestd.ora' from spfile SQL > create spfile='+DATADG/ORDBSTD/spfileordbstd.ora' from pfile='/tmp/pfilestd.ora'; [oracle@dbstd] $rm / u01/app/oracle/product/12.2.0.1/dbhome_1/dbs/spfileordbstd.ora
7. The standby library creates PFILE and closes the standby library.
[oracle@dbstd] $echo "spfile='+DATADG/ORDBSTD/spfileordbstd.ora'" > / u01/app/oracle/product/12.2.0.1/dbhome_1/dbs/ initordbstd.ora [oracle @ dbstd] sqlplus / as sysdbaSQL > shutdown immediateSQL > exit
8. Register the slave library with Oracle Restart and start the slave library.
[oracle@dbstd] $srvctl add database-db ordbstd-oraclehome / u01/app/oracle/product/12.2.0.1/dbhome_1-dbtype Single-instance ordbstd-node dbstd-dbname ordbpri-diskgroup DATADG-role physical_standby-spfile'+ DATADG/ORDBSTD/spfileordbstd.ora'-pwfile'+ DATADG/ORDBSTD/PASSWORD/pwordbstd' [oracle@dbstd] $srvctl start database-db ordbstd
At this point, the DBCA is completed from the single instance master database to the creation of a single instance standby database.
| | author profile |
Yang Bo, database technology expert of Waldorf Science and Technology
Mainly participate in the company's product implementation, testing, maintenance and optimization.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.