How to Change Data Protection Mode ofa Primary Database Step 1Select a dataprotection mode that meets your availability, performance, and data protectionrequirements. Maximum Availability This protection mode provides the highest level of
How to Change Data Protection Mode ofa Primary Database
Step 1 Select a dataprotection mode that meets your availability, performance, and data protectionrequirements.
Maximum Availability
This protection mode provides the highest level of data protectionthat is possible without compromising the availability of a primary database.Transactions do not commit until all redo data needed to recover thosetransactions has been written to the online redo log and to the standby redolog on at least one synchronized standby database. If the primary databasecannot write its redo stream to at least one synchronized standby database, itoperates as if it were in maximum performance mode to preserve primary databaseavailability until it is again able to write its redo stream to a synchronizedstandby database.
This mode ensures that no data loss will occur if the primarydatabase fails, but only if a second fault does not prevent a complete set ofredo data from being sent from the primary database to at least one standbydatabase.
Maximum Performance
This protection mode provides the highest level of data protectionthat is possible without affecting the performance of a primary database. Thisis accomplished by allowing transactions to commit as soon as all redo datagenerated by those transactions has been written to the online log. Redo datais also written to one or more standby databases, but this is doneasynchronously with respect to transaction commitment, so primary databaseperformance is unaffected by delays in writing redo data to the standbydatabase(s).
This protection mode offers slightly less data protection thanmaximum availability mode and has minimal impact on primary databaseperformance.
This is the default protection mode.
Maximum Protection
This protection mode ensures that no data loss will occur if theprimary database fails. To provide this level of protection, the redo dataneeded to recover a transaction must be written to both the online redo log andto the standby redo log on at least one synchronized standby database beforethe transaction commits. To ensure that data loss cannot occur, the primarydatabase will shut down, rather than continue processing transactions, if itcannot write its redo stream to at least one synchronized standby database.
Transactions on the primary are considered protected as soon as DataGuard has written the redo data to persistent storage in a standby redo logfile. Once that is done, acknowledgment is quickly made back to the primarydatabase so that it can proceed to the next transaction. This minimizes theimpact of synchronous transport on primary database throughput and responsetime. To fully benefit from complete Data Guard validation at the standbydatabase, be sure to operate in real-time apply mode so that redo changes areapplied to the standby database as fast as they are received. Data Guardsignals any corruptions that are detected so that immediate corrective actioncan be taken.
Because this data protection mode prioritizes data protection overprimary database availability, Oracle recommends that a minimum of two standbydatabases be used to protect a primary database that runs in maximum protectionmode to prevent a single standby database failure from causing the primarydatabase to shut down.
Note:
Asynchronously committed transactions are not protected by DataGuard against loss until the redo generated by those transactions has beenwritten to the standby redo log of at least one synchronized standby database.
For more information about the asynchronous commit feature, see:
- Oracle Database Concepts
- Oracle Database SQL Language Reference
- Oracle Database Advanced Application Developer's Guide
- Oracle Database PL/SQL Language Reference
Step 2 Verify thatat least one standby database meets the redo transport requirements for thedesired data protection mode.
The LOG_ARCHIVE_DEST_n database initializationparameter that corresponds to at least one standby database must include theredo transport attributes listed inTable5-1 for the desired data protection mode.
Table 5-1 RequiredRedo Transport Attributes for Data Protection Modes
Maximum Availability |
Maximum Performance |
Maximum Protection |
AFFIRM |
NOAFFIRM |
AFFIRM |
SYNC |
ASYNC |
SYNC |
DB_UNIQUE_NAME |
DB_UNIQUE_NAME |
DB_UNIQUE_NAME |
Step 3 Verify thatthe DB_UNIQUE_NAME database initialization parameter has been set to a uniquevalue on the primary database and on each standby database.
Step 4 Verify thatthe LOG_ARCHIVE_CONFIG database initialization parameter has been defined onthe primary database and on each standby database, and that its value includesa DG_CONFIG list that includes the DB_UNIQUE_NAME of the primary database andeach standby database.
For example, the following SQL statement might be used to configurethe LOG_ARCHIVE_CONFIG parameter:
SQL> showparameter log_archive_config
NAME TYPE VALUE
----------------------------------------------- ------------------------------
log_archive_config string DG_CONFIG=(prod,standby)
Step 5 Set the dataprotection mode.
Execute the following SQL statement on the primary database:
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE{AVAILABILITY | PERFORMANCE | PROTECTION};
SQL> ALTERDATABASE SET STANDBY DATABASE TO MAXIMIZE AVAILABILITY;
Database altered.
SQL> selectLOG_MODE,OPEN_MODE,PROTECTION_MODE,PROTECTION_LEVEL,DATABASE_ROLE,SWITCHOVER_STATUSfrom v$database;
LOG_MODE OPEN_MODE PROTECTION_MODE PROTECTION_LEVEL DATABASE_ROLE SWITCHOVER_STATUS
-------------------------------- -------------------- -------------------- ------------------------------------
ARCHIVELOG READ WRITE MAXIMUM AVAILABILITY MAXIMUMAVAILABILITY PRIMARY TO STANDBY
Note that the data protection mode can be set to MAXIMUM PROTECTIONon an open database only if the current data protection mode is MAXIMUMAVAILABILITY and if there is at least one synchronized standby database.
You can change the protection mode from MAXIMUM AVAILABILITY to MAXIMUM PROTECTION when the database is open:
SQL> ALTERDATABASE SET STANDBY DATABASE TO MAXIMIZE PROTECTION;
Database altered.
SQL> selectLOG_MODE,OPEN_MODE,PROTECTION_MODE,PROTECTION_LEVEL,DATABASE_ROLE,SWITCHOVER_STATUSfrom v$database;
LOG_MODE OPEN_MODE PROTECTION_MODE PROTECTION_LEVEL DATABASE_ROLE SWITCHOVER_STATUS
-------------------------------- -------------------- -------------------- ------------------------------------
ARCHIVELOG READ WRITE MAXIMUM PROTECTION MAXIMUM PROTECTION PRIMARY TO STANDBY
But you cannot change the protection mode from MAXIMUM PERFORCEMANCE to MAXIMUM PROTECTION when the database is open
SQL> selectLOG_MODE,OPEN_MODE,PROTECTION_MODE,PROTECTION_LEVEL,DATABASE_ROLE,SWITCHOVER_STATUSfrom v$database;
LOG_MODE OPEN_MODE PROTECTION_MODE PROTECTION_LEVEL DATABASE_ROLE SWITCHOVER_STATUS
-------------------------------- -------------------- -------------------- ------------------------------------
ARCHIVELOG READ WRITE MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE PRIMARY FAILED DESTINATION
SQL> ALTERDATABASE SET STANDBY DATABASE TO MAXIMIZE PROTECTION;
ALTER DATABASE SETSTANDBY DATABASE TO MAXIMIZE PROTECTION
*
ERROR at line 1:
ORA-01126: databasemust be mounted in this instance and not open in any instance
To change the data protection mode from MAXIMUMPERFORMANCE to MAXIMUM PROTECTION , the database must be mounted, not open.
SQL> shutdownimmediate
SQL> startupmount;
SQL> selectLOG_MODE,OPEN_MODE,PROTECTION_MODE,PROTECTION_LEVEL,DATABASE_ROLE,SWITCHOVER_STATUSfrom v$database;
LOG_MODE OPEN_MODE PROTECTION_MODE PROTECTION_LEVEL DATABASE_ROLE SWITCHOVER_STATUS
-------------------------------- -------------------- -------------------- ------------------------------------
ARCHIVELOG MOUNTED MAXIMUM PERFORMANCE UNPROTECTED PRIMARY NOT ALLOWED
SQL> ALTERDATABASE SET STANDBY DATABASE TO MAXIMIZE PROTECTION;
Database altered.
SQL> selectLOG_MODE,OPEN_MODE,PROTECTION_MODE,PROTECTION_LEVEL,DATABASE_ROLE,SWITCHOVER_STATUSfrom v$database;
LOG_MODE OPEN_MODE PROTECTION_MODE PROTECTION_LEVEL DATABASE_ROLE SWITCHOVER_STATUS
-------------------------------- -------------------- -------------------- ------------------------------------
ARCHIVELOG MOUNTED MAXIMUM PROTECTION UNPROTECTED PRIMARY NOT ALLOWED
Pls Note, If the listener of the standby is notstarted, the switchover status here shows "FAILED DESTINATION" .Afteryou start the standby's listener
, the status will change to "TO STANDBY".
SQL> selectLOG_MODE,OPEN_MODE,PROTECTION_MODE,PROTECTION_LEVEL,DATABASE_ROLE,SWITCHOVER_STATUSfrom v$database;
LOG_MODE OPEN_MODE PROTECTION_MODE PROTECTION_LEVEL DATABASE_ROLE SWITCHOVER_STATUS
-------------------------------- -------------------- -------------------- ------------------------------------
ARCHIVELOG READ WRITE MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE PRIMARY TO STANDBY
作者:xiangsir
QQ:444367417
MSN:xiangsir@hotmail.com

存儲過程是MySQL中的預編譯SQL語句集合,用於提高性能和簡化複雜操作。 1.提高性能:首次編譯後,後續調用無需重新編譯。 2.提高安全性:通過權限控制限制數據表訪問。 3.簡化複雜操作:將多條SQL語句組合,簡化應用層邏輯。

MySQL查詢緩存的工作原理是通過存儲SELECT查詢的結果,當相同查詢再次執行時,直接返回緩存結果。 1)查詢緩存提高數據庫讀取性能,通過哈希值查找緩存結果。 2)配置簡單,在MySQL配置文件中設置query_cache_type和query_cache_size。 3)使用SQL_NO_CACHE關鍵字可以禁用特定查詢的緩存。 4)在高頻更新環境中,查詢緩存可能導致性能瓶頸,需通過監控和調整參數優化使用。

MySQL被廣泛應用於各種項目中的原因包括:1.高性能與可擴展性,支持多種存儲引擎;2.易於使用和維護,配置簡單且工具豐富;3.豐富的生態系統,吸引大量社區和第三方工具支持;4.跨平台支持,適用於多種操作系統。

MySQL數據庫升級的步驟包括:1.備份數據庫,2.停止當前MySQL服務,3.安裝新版本MySQL,4.啟動新版本MySQL服務,5.恢復數據庫。升級過程需注意兼容性問題,並可使用高級工具如PerconaToolkit進行測試和優化。

MySQL備份策略包括邏輯備份、物理備份、增量備份、基於復制的備份和雲備份。 1.邏輯備份使用mysqldump導出數據庫結構和數據,適合小型數據庫和版本遷移。 2.物理備份通過複製數據文件,速度快且全面,但需數據庫一致性。 3.增量備份利用二進制日誌記錄變化,適用於大型數據庫。 4.基於復制的備份通過從服務器備份,減少對生產系統的影響。 5.雲備份如AmazonRDS提供自動化解決方案,但成本和控制需考慮。選擇策略時應考慮數據庫大小、停機容忍度、恢復時間和恢復點目標。

MySQLclusteringenhancesdatabaserobustnessandscalabilitybydistributingdataacrossmultiplenodes.ItusestheNDBenginefordatareplicationandfaulttolerance,ensuringhighavailability.Setupinvolvesconfiguringmanagement,data,andSQLnodes,withcarefulmonitoringandpe

在MySQL中優化數據庫模式設計可通過以下步驟提升性能:1.索引優化:在常用查詢列上創建索引,平衡查詢和插入更新的開銷。 2.表結構優化:通過規範化或反規範化減少數據冗餘,提高訪問效率。 3.數據類型選擇:使用合適的數據類型,如INT替代VARCHAR,減少存儲空間。 4.分區和分錶:對於大數據量,使用分區和分錶分散數據,提升查詢和維護效率。

tooptimizemysqlperformance,lofterTheSeSteps:1)inasemproperIndexingTospeedUpqueries,2)使用ExplaintplaintoAnalyzeandoptimizequeryPerformance,3)ActiveServerConfigurationStersLikeTlikeTlikeTlikeIkeLikeIkeIkeLikeIkeLikeIkeLikeIkeLikeNodb_buffer_pool_sizizeandmax_connections,4)


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

Atom編輯器mac版下載
最受歡迎的的開源編輯器

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3 英文版
推薦:為Win版本,支援程式碼提示!