搜尋
首頁資料庫mysql教程 单机搭建Data Guard

搭建环境:RedHatLinuxEnterprise5.4Oracle10gR2主机操作系统主要信息为192.168.199.128.搭建准备:已存在主库(生产库)DB_NAME=mustangSID=april开始搭建DataG

搭建环境: Red Hat Linux Enterprise 5.4 Oracle 10g R2 主机操作系统主要信息为192.168.199.128. 搭建准备: 已存在主库(生产库)DB_NAME=mustang   SID=april   开始搭建Data Guard 首先需要准备好参数文件,网站空间,设定一些必要的参数。在主库,先通过spfile生成pfile文件:
  • SQL>create pfile=’/home/oracle/product/10.2initapril.ora’ from spfile;  
  • 然后修改主库新生成的initapril.ora参数文件。在原有的基础上添加如下内容: 修改完参数文件之后,要重新打开主库,然后通过iniapril.ora来创建spfile。如下:
  • SQL>create spfile=’/home/oracle/product/10.2.0/db_1/dbs/spfileapril.ora’ from pfile=’ 
  • /home/oracle/product/10.2.0/db_1/dbs/initapril.ora’; 
  • 接下来的工作就是要通过主库的参数文件,创建备库需要的参数文件,在主库上运行:

  • SQL>create pfile=’ /home/oracle/product/10.2.0/db_1/dbs/initstandby.ora’ from spfile; 
  • 编辑initstandby.ora。如下所示: 保存initstandby.ora参数文件。通过initstandby.ora生成动态文件spfilestandby.ora 在主库上创建我们的密码文件:

  • [oracle@localhost dbs]$orapwd file=’ /home/oracle/product/10.2.0/db_1/dbs/orapwstandby’ password=oracle  entries=10 
  • 通过主库的控制文件生成我们备库的控制文件:
  • SQL>alter database create standby controlfile as ‘/home/oracle/standby.ctl’;  
  • 开始创建备库: 首先创建备库的目录结构,这里我们以主库位于同一目录: 主库:/home/oracle/mustang    主库归档文件:/home/oracle/archive 于是我们在/home/oracle下创建我们的备库目录:

    下一步就是要配置监听(如果没有监听standby是启动不了的)。在配置监听之前,首先要进行一步就是要生成备库的密码文件: 

  • [oracle@localhost dbs]$orapwd file=’ /home/oracle/product/10.2.0/db_1/dbs/orapwstandby’ password=oracle  entries=10 
  • 将路径切换到/home/oracle/product/10.2.0/db_1/network/admin下。通过ls命令可以看到: [oracle@localhost admin]$ ls listener.ora  shrept.lst  sqlnet.log  tnsnames.ora 再配置监听之前,要先将我们的监听服务停止:lsnrctl stop 开始配置监听 首先配置tnsnames.ora文件。设定服务名(因为我们这里是单机,所以配置在本机上配置就行了,如果是两台机的话,就要在主备库的tnsnames.ora同时修改): 接下来配置listener.ora文件(建议用途netmgr配置,香港服务器,比较方便,因为手工配置容易出错)。配置如下: 至此我们的监听配置就完成,启动监听器:

  • [oracle@localhost admin]$ lsnrctl start 
  • 出现如下内容说明,已经配置成功: LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 26-JUL-2012 20:59:37 Copyright (c) 1991, 2005, Oracle.  All rights reserved. Starting /home/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 10.2.0.1.0 - Production System parameter file is /home/oracle/product/10.2.0/db_1/network/admin/listener.ora Log messages written to /home/oracle/product/10.2.0/db_1/network/log/listener.log Trace information written to /home/oracle/product/10.2.0/db_1/network/trace/listener.trc Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1522))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias                     LISTENER Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production Start Date                26-JUL-2012 20:59:37 Uptime                    0 days 0 hr. 0 min. 0 sec Trace Level               user Security                  ON: Local OS Authentication SNMP                      OFF Listener Parameter File   /home/oracle/product/10.2.0/db_1/network/admin/listener.ora Listener Log File         /home/oracle/product/10.2.0/db_1/network/log/listener.log Listener Trace File       /home/oracle/product/10.2.0/db_1/network/trace/listener.trc Listening Endpoints Summary...   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1522))) Services Summary... Service "mustang" has 1 instance(s).   Instance "april", status UNKNOWN, has 1 handler(s) for this service... Service "standby" has 1 instance(s).   Instance "standby", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully 我们也可以通过tnsping来检查,是否配置成功:
    陳述
    本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
    在MySQL中使用視圖的局限性是什麼?在MySQL中使用視圖的局限性是什麼?May 14, 2025 am 12:10 AM

    mysqlviewshavelimitations:1)他們不使用Supportallsqloperations,限制DatamanipulationThroughViewSwithJoinsOrsubqueries.2)他們canimpactperformance,尤其是withcomplexcomplexclexeriesorlargedatasets.3)

    確保您的MySQL數據庫:添加用戶並授予特權確保您的MySQL數據庫:添加用戶並授予特權May 14, 2025 am 12:09 AM

    porthusermanagementinmysqliscialforenhancingsEcurityAndsingsmenting效率databaseoperation.1)usecReateusertoAddusers,指定connectionsourcewith@'localhost'or@'%'。

    哪些因素會影響我可以在MySQL中使用的觸發器數量?哪些因素會影響我可以在MySQL中使用的觸發器數量?May 14, 2025 am 12:08 AM

    mysqldoes notimposeahardlimitontriggers,butacticalfactorsdeterminetheireffactective:1)serverConfiguration impactactStriggerGermanagement; 2)複雜的TriggerSincreaseSySystemsystem load; 3)largertablesslowtriggerperfermance; 4)highConconcConcrencerCancancancancanceTigrignecentign; 5); 5)

    mysql:存儲斑點安全嗎?mysql:存儲斑點安全嗎?May 14, 2025 am 12:07 AM

    Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

    mySQL:通過PHP Web界面添加用戶mySQL:通過PHP Web界面添加用戶May 14, 2025 am 12:04 AM

    通過PHP網頁界面添加MySQL用戶可以使用MySQLi擴展。步驟如下:1.連接MySQL數據庫,使用MySQLi擴展。 2.創建用戶,使用CREATEUSER語句,並使用PASSWORD()函數加密密碼。 3.防止SQL注入,使用mysqli_real_escape_string()函數處理用戶輸入。 4.為新用戶分配權限,使用GRANT語句。

    mysql:blob和其他無-SQL存儲,有什麼區別?mysql:blob和其他無-SQL存儲,有什麼區別?May 13, 2025 am 12:14 AM

    mysql'sblobissuitableForStoringBinaryDataWithInareLationalDatabase,而ilenosqloptionslikemongodb,redis和calablesolutionsolutionsolutionsoluntionsoluntionsolundortionsolunsonstructureddata.blobobobissimplobisslowdeperformberbutslowderformandperformancewithlararengedata;

    mySQL添加用戶:語法,選項和安全性最佳實踐mySQL添加用戶:語法,選項和安全性最佳實踐May 13, 2025 am 12:12 AM

    toaddauserinmysql,使用:createUser'username'@'host'Indessify'password'; there'showtodoitsecurely:1)choosethehostcarecarefullytocon trolaccess.2)setResourcelimitswithoptionslikemax_queries_per_hour.3)usestrong,iniquepasswords.4)Enforcessl/tlsconnectionswith

    MySQL:如何避免字符串數據類型常見錯誤?MySQL:如何避免字符串數據類型常見錯誤?May 13, 2025 am 12:09 AM

    toAvoidCommonMistakeswithStringDatatatPesInMysQl,CloseStringTypenuances,chosethirtightType,andManageEngencodingAndCollat​​ionsEttingSefectery.1)usecharforfixed lengengtrings,varchar forvariable-varchar forbariaible length,andtext/blobforlargerdataa.2 seterters seterters seterters

    See all articles

    熱AI工具

    Undresser.AI Undress

    Undresser.AI Undress

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

    AI Clothes Remover

    AI Clothes Remover

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

    Undress AI Tool

    Undress AI Tool

    免費脫衣圖片

    Clothoff.io

    Clothoff.io

    AI脫衣器

    Video Face Swap

    Video Face Swap

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

    熱門文章

    熱工具

    SublimeText3 英文版

    SublimeText3 英文版

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

    SecLists

    SecLists

    SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

    Safe Exam Browser

    Safe Exam Browser

    Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

    Atom編輯器mac版下載

    Atom編輯器mac版下載

    最受歡迎的的開源編輯器

    記事本++7.3.1

    記事本++7.3.1

    好用且免費的程式碼編輯器