oracle資料庫複製

來源:互聯網
上載者:User

標籤:oracle   伺服器   資料庫   

oracle on linux安裝多台伺服器時可以採用一次安裝副本多台複製即可,簡單快速.**************************************************************1、檢查下列包是否安裝**************************************************************yum -y install  gcc gcc-c++ make binutils compat-libstdc++-33 compat-libcap1 elfutils-libelf elfutils-libelf-devel glibc  glibc-devel glibc-common  libaio libaio-devel libgcc libstdc++ libstdc++-devel  sysstat   expat ksh unixODBC unixODBC-devel  --配置系統# grep MemTotal /proc/meminfoMemTotal:      4946772 kB# grep SwapTotal /proc/meminfoSwapTotal:    12289716 kB# df -hFilesystem            Size  Used Avail Use% Mounted on/dev/sda2              17G  2.8G   14G  18% //dev/sda1            1012M   40M  921M   5% /bootnone                  891M     0  891M   0% /dev/shm/dev/hdc              192M  192M     0 100% /media/cdrom**************************************************************2.參數修改**************************************************************1.設定需要的IP2、修改host檔案在/etc/hosts檔案中添加一個全限定網域名稱,如:vi /etc/hosts192.168.50.180  vp01  vp01.vpay.com192.168.50.190  vp02  vp02.vpay.com3. 查看修改結果hostnamecat /etc/hosts | grep `eval hostname`4、設定核心參數 1、在/etc/sysctl.conf檔案中加入下列行:#vi /etc/sysctl.conffs.suid_dumpable = 1fs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmmni = 4096# semaphores: semmsl, semmns, semopm, semmnikernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default=4194304net.core.rmem_max=4194304net.core.wmem_default=262144net.core.wmem_max=1048586 5、運行下列命令改變核心參數:#/sbin/sysctl -p 6、在/etc/security/limits.conf檔案中加入下列行:# vi /etc/security/limits.conforacle           soft    nproc   2047oracle           hard    nproc   16384oracle           soft    nofile  1024oracle           hard    nofile  65536oracle           hard    stack   102407、在/etc/pam.d/login檔案中加入下列行:# vi +13 /etc/pam.d/loginsession    required     pam_limits.so**************************************************************3.建立下列組和使用者**************************************************************groupadd oinstallgroupadd dbagroupadd operuseradd -g oinstall -G dba,oper -d /home/oracle -m oraclepasswd oracle123**************************************************************4.設定oracle使用者的環境變數**************************************************************用oracle登入在:/home/oracle/.bash_profile檔案末尾,注意把其中ORACLE_SID換成自己的執行個體名:# vi /home/oracle/.bash_profile也可以 #su - oracle#vi .bash_profile增加下列內容:# Oracle SettingsTMP=/tmp;export TMPTMPDIR=$TMP;export TMPDIRORACLE_BASE=/u01/app/oracle;export ORACLE_BASEORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1;export ORACLE_HOMEORACLE_SID=jinri;export ORACLE_SIDORACLE_TERM=xterm;export ORACLE_TERMPATH=/usr/sbin:$PATH;export PATHPATH=$ORACLE_HOME/bin:$PATH;export PATHLD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;export LD_LIBRARY_PATHCLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;export CLASSPATH#LD_ASSUME_KERNEL=2.4.1;export LD_ASSUME_KERNEL#set languageNLS_LANG="SIMPLIFIED CHINESE"_CHINA.AL32UTF8export  NLS_LANGEDITOR=viexport EDITORif [ $USER = "oracle" ]; thenif [ $SHELL = "/bin/ksh" ]; thenulimit -p 16384ulimit -n 65536elseulimit -u 16384 -n 65536fifialias  oratrace="cat   $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace/alert_jinri.log"alias  oradata="cd $ORACLE_BASE/oradata/$ORACLE_SID"alias  oranetwork="cd $ORACLE_HOME/network/admin"alias topc=‘ps -e -o pcpu,pid,user,tty,args | sort -n -k 1 -r | head‘alias topm=‘ps -e -o pmem,pid,user,tty,args | sort -n -k 1 -r | head‘----建立必要的資料目錄#mkdir /u01/backup/  && chown -R   oracle.oinstall  /u01/backup/# mkdir /data/ctl# chown -R   oracle.oinstall /data/ctl/**************************************************************5.副本複製安裝資料庫**************************************************************--1.vp01正常關閉資料庫[[email protected] 20760982]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on 星期一 9月 28 18:27:13 2015Copyright (c) 1982, 2013, Oracle.  All rights reserved.串連到: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> shutdown immediate資料庫已經關閉。已經卸載資料庫。ORACLE 常式已經關閉。SQL> exit[[email protected] 20760982]$ lsnrctl stopLSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-9月 -2015 18:27:39Copyright (c) 1991, 2013, Oracle.  All rights reserved.正在串連到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))命令執行成功---2.vp01打包$cd /u01/$tar czvf oracle.tar.gz /u01/---3.vp01將oracle安裝副本壓縮包傳遞到vp02scp -r -p -P 16335 /u01/oracle.tar.gz  [email protected]:/u01/backup/---4.vp02解壓修改許可權#chown -R   oracle.oinstall /u01/backup/oracle.tar.gz#cd /u01/backup/# tar zxvf oracle.tar.gz -C /u01/--移動目錄到上一層# cd /u01/u01/ && mv app/  ../ && ls /u01/u01/ &&  ls /u01/app/ #rm -rf /u01/u01---控制檔案有個副本在不同目錄#cp /u01/app/oracle/oradata/jinri/control01.ctl  /data/ctl/control03.ctl#chown -R   oracle.oinstall  /u01/app/#chown -R   oracle.oinstall /data/ctl/--relink$cd$relink allwriting relink log to: /u01/app/oracle/product/11.2.0/dbhome_1/install/relink.log----5.修改監聽解析檔案$ cat   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora# Generated by Oracle configuration tools.SID_LIST_LISTENER =(SID_LIST =    (SID_DESC =  (GLOBAL_DBNAME = jinri)  (SID_NAME = jinri)  ) )   LISTENER =  (DESCRIPTION_LIST =    (DESCRIPTION =       (ADDRESS = (PROTOCOL = TCP)(HOST = 10.174.157.163)(PORT = 1521))    )  ) ADR_BASE_LISTENER = /u01/app/oracle[[email protected] ~]$ #將vp01修改為vp02對應IP$ cat   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora# Generated by Oracle configuration tools.JINRI =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = vp02)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = jinri)    )  )-----6.附加oracle主目錄cd $ORACLE_HOME/oui/bin$ $ORACLE_HOME/oui/bin/runInstaller –silent -attachHome -invPrtLoc /u01/app/oraInventory/oraInst.loc  ORACLE_HOME_NAME="OraDb11g_home1" ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1"Starting Oracle Universal Installer...Checking swap space: must be greater than 500 MB.   Actual 4999 MB    PassedThe inventory pointer is located at /etc/oraInst.locThe inventory is located at /u01/app/oraInventoryPlease execute the ‘/u01/app/oraInventory/orainstRoot.sh‘ script at the end of the session.‘AttachHome‘ was successful.#/u01/app/oraInventory/orainstRoot.sh--註冊前$ cat /u01/app/oraInventory/ContentsXML/inventory.xml <?xml version="1.0" standalone="yes" ?><!-- Copyright (c) 1999, 2013, Oracle and/or its affiliates.All rights reserved. --><!-- Do not modify the contents of this file by hand. --><INVENTORY><VERSION_INFO>   <SAVED_WITH>11.2.0.4.0</SAVED_WITH>   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER></VERSION_INFO><HOME_LIST></HOME_LIST><COMPOSITEHOME_LIST></COMPOSITEHOME_LIST></INVENTORY>--註冊前$ cat /u01/app/oraInventory/ContentsXML/inventory.xml <?xml version="1.0" standalone="yes" ?><!-- Copyright (c) 1999, 2013, Oracle and/or its affiliates.All rights reserved. --><!-- Do not modify the contents of this file by hand. --><INVENTORY><VERSION_INFO>   <SAVED_WITH>11.2.0.4.0</SAVED_WITH>   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER></VERSION_INFO><HOME_LIST><HOME NAME="OraDb11g_home1" LOC="/u01/app/oracle/product/11.2.0/dbhome_1" TYPE="O" IDX="1"/></HOME_LIST><COMPOSITEHOME_LIST></COMPOSITEHOME_LIST></INVENTORY>$ cat /etc/oraInst.loc inventory_loc=/u01/app/oraInventoryinst_group=oinstall----7.分離oracle主目錄(需要的時候)$ORACLE_HOME/oui/bin/runInstaller –silent -detachHome -invPrtLoc /u01/app/oraInventory/oraInst.loc  ORACLE_HOME_NAME="OraDb11g_home1" ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1"----8.啟動監聽檔案$ lsnrctl startLSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-9月 -2015 19:30:48Copyright (c) 1991, 2013, Oracle.  All rights reserved.啟動/u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: 請稍候...TNSLSNR for Linux: Version 11.2.0.4.0 - Production系統參數檔案為/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora寫入/u01/app/oracle/diag/tnslsnr/vp02/listener/alert/log.xml的日誌資訊監聽: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))監聽: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vp02)(PORT=1521)))正在串連到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))LISTENER 的 STATUS------------------------別名                      LISTENER版本                      TNSLSNR for Linux: Version 11.2.0.4.0 - Production啟動日期                  28-9月 -2015 19:30:48正常已耗用時間              0 天 0 小時 0 分 2 秒追蹤層級                  off安全性                    ON: Local OS AuthenticationSNMP                      OFF監聽程式參數檔案          /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora監聽程式記錄檔          /u01/app/oracle/diag/tnslsnr/vp02/listener/alert/log.xml監聽端點概要...  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vp02)(PORT=1521)))監聽程式不支援服務命令執行成功$ tnsping jinriTNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 28-9月 -2015 19:31:11Copyright (c) 1997, 2013, Oracle.  All rights reserved.已使用的參數檔案:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora已使用 TNSNAMES 適配器來解析別名嘗試串連 (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = vp02)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = jinri)))OK (0 毫秒)$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on 星期一 9月 28 20:17:45 2015Copyright (c) 1982, 2013, Oracle.  All rights reserved.已串連到空閑常式。SQL> startupORACLE 常式已經啟動。Total System Global Area 3925032960 bytesFixed Size    2259240 bytesVariable Size  822085336 bytesDatabase Buffers 3087007744 bytesRedo Buffers   13680640 bytes資料庫裝載完畢。資料庫已經開啟。SQL> select open_mode from v$database;OPEN_MODE--------------------READ WRITE


本文出自 “半生流離ぶ” 部落格,請務必保留此出處http://zhangzhankuan.blog.51cto.com/12619683/1908392

oracle資料庫複製

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.