oracle数据库克隆

前端之家收集整理的这篇文章主要介绍了oracle数据库克隆前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
oracleonlinux安装多台服务器时可以采用一次安装副本多台克隆即可,简单快速.
**************************************************************
1、检查下列包是否安装
**************************************************************

yum-yinstallgccgcc-c++makebinutilscompat-libstdc++-33compat-libcap1\
elfutils-libelfelfutils-libelf-develglibcglibc-develglibc-common\
libaiolibaio-devellibgcclibstdc++libstdc++-develsysstatexpat\
kshunixODBCunixODBC-devel



--配置系统#grepMemTotal/proc/meminfo
MemTotal:4946772kB


#grepSwapTotal/proc/meminfo
SwapTotal:12289716kB



#df-h
FilesystemSizeUsedAvailUse%Mountedon/dev/sda217G2.8G14G18%/
/dev/sda11012M40M921M5%/boot
none891M0891M0%/dev/shm
/dev/hdc192M192M0100%/media/cdrom




**************************************************************2.参数修改
**************************************************************1.设置需要的IP2、修改host文件
在/etc/hosts文件添加一个全限定域名,如:

vi/etc/hosts192.168.50.180vp01vp01.vpay.com192.168.50.190vp02vp02.vpay.com3.查看修改结果

hostname

cat/etc/hosts|grep`evalhostname`4、设置核心参数
 1、在/etc/sysctl.conf文件中加入下列行:
#vi/etc/sysctl.conf


fs.suid_dumpable=1fs.aio-max-nr=1048576fs.file-max=6815744kernel.shmmni=4096#semaphores:semmsl,semmns,semopm,semmni
kernel.sem=25032000100128net.ipv4.ip_local_port_range=900065500net.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.conf

oraclesoftnproc2047oraclehardnproc16384oraclesoftnofile1024oraclehardnofile65536oraclehardstack102407、在/etc/pam.d/login文件中加入下列行:

#vi+13/etc/pam.d/loginsessionrequiredpam_limits.so




**************************************************************3.创建下列组和用户
**************************************************************

groupaddoinstall
groupadddba
groupaddoper
useradd-goinstall-Gdba,oper-d/home/oracle-moracle
passwdoracle123**************************************************************4.设置oracle用户的环境变量
**************************************************************

用oracle登录在:/home/oracle/.bash_profile文件末尾,注意把其中ORACLE_SID换成自己的实例名:

#vi/home/oracle/.bash_profile

也可以
#su-oracle

#vi.bash_profile

增加下列内容:

#OracleSettings
TMP=/tmp;exportTMP
TMPDIR=$TMP;
exportTMPDIR

ORACLE_BASE=/u01/app/oracle;
exportORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1;
exportORACLE_HOME
ORACLE_SID=jinri;
exportORACLE_SID
ORACLE_TERM=xterm;
exportORACLE_TERM
PATH=/usr/sbin:$PATH;
exportPATH
PATH=$ORACLE_HOME/bin:$PATH;
exportPATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
exportLD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
exportCLASSPATH
#LD_ASSUME_KERNEL=2.4.1;
exportLD_ASSUME_KERNEL

#setlanguageNLS_LANG="SIMPLIFIEDCHINESE"_CHINA.AL32UTF8
exportNLS_LANG
EDITOR=vi
exportEDITORif[$USER="oracle"];then
if[$SHELL="/bin/ksh"];then
ulimit-p16384
ulimit-n65536
else
ulimit-u16384-n65536
fi
fi


aliasoratrace="cat$ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace/alert_jinri.log"
aliasoradata="cd$ORACLE_BASE/oradata/$ORACLE_SID"
aliasoranetwork="cd$ORACLE_HOME/network/admin"
aliastopc='ps-e-opcpu,pid,user,tty,args|sort-n-k1-r|head'
aliastopm='ps-e-opmem,args|sort-n-k1-r|head'----新建必要的数据目录#mkdir/u01/backup/&&chown-Roracle.oinstall/u01/backup/

#mkdir/data/ctl

#chown-Roracle.oinstall/data/ctl/

**************************************************************5.副本克隆安装数据库
**************************************************************--1.vp01正常关闭数据库[oracle@vp0120760982]$sqlplus/assysdbasql*Plus:Release11.2.0.4.0Productionon星期一9月2818:27:132015Copyright(c)1982,2013,Oracle.Allrightsreserved.


连接到:
OracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProductionWiththePartitioning,OLAP,DataMiningandRealApplicationTestingoptionssql>shutdownimmediate数据库已经关闭。
已经卸载数据库。
ORACLE例程已经关闭sql>exit



[oracle@vp0120760982]$lsnrctlstopLSNRCTLforLinux:Version11.2.0.4.0-Productionon28-9月-201518:27:39Copyright(c)1991,Oracle.Allrightsreserved.

正在连接到(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
命令执行成功---2.vp01打包$cd/u01/
$tarczvforacle.tar.gz/u01/---3.vp01将oracle安装副本压缩包传递到vp02scp-r-p-P16335/u01/oracle.tar.gzoracle@10.174.157.163:/u01/backup/---4.vp02解压修改权限#chown-Roracle.oinstall/u01/backup/oracle.tar.gz

#cd/u01/backup/

#tarzxvforacle.tar.gz-C/u01/--移动目录到上一层#cd/u01/u01/&&mvapp/../&&ls/u01/u01/&&ls/u01/app/


#rm-rf/u01/u01---控制文件有个副本在不同目录#cp/u01/app/oracle/oradata/jinri/control01.ctl/data/ctl/control03.ctl


#chown-Roracle.oinstall/u01/app/
#chown-Roracle.oinstall/data/ctl/--relink$cd
$relinkallwritingrelinklogto:/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.oraNetworkConfigurationFile:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
#GeneratedbyOracleconfigurationtools.
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
[oracle@vp02~]$


#将vp01修改为vp02对应IP


$cat/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
#tnsnames.oraNetworkConfigurationFile:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
#GeneratedbyOracleconfigurationtools.

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�Csilent-attachHome-invPrtLoc/u01/app/oraInventory/oraInst.loc\
ORACLE_HOME_NAME="OraDb11g_home1"\
ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1"StartingOracleUniversalInstaller...

Checkingswapspace:mustbegreaterthan500MB.Actual4999MBPassed
Theinventorypointerislocatedat/etc/oraInst.loc
Theinventoryislocatedat/u01/app/oraInventory
Pleaseexecutethe'/u01/app/oraInventory/orainstRoot.sh'scriptattheendofthesession.'AttachHome'wassuccessful.


#/u01/app/oraInventory/orainstRoot.sh--注册前$cat/u01/app/oraInventory/ContentsXML/inventory.xml<?xmlversion="1.0"standalone="yes"?>
<!--Copyright(c)1999,Oracleand/oritsaffiliates.Allrightsreserved.--><!--Donotmodifythecontentsofthisfilebyhand.--><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<?xmlversion="1.0"standalone="yes"?>
<!--Copyright(c)1999,Oracleand/oritsaffiliates.Allrightsreserved.--><!--Donotmodifythecontentsofthisfilebyhand.--><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>
<HOMENAME="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/oraInventory
inst_group=oinstall----7.分离oracle主目录(需要的时候)$ORACLE_HOME/oui/bin/runInstaller�Csilent-detachHome-invPrtLoc/u01/app/oraInventory/oraInst.loc\
ORACLE_HOME_NAME="OraDb11g_home1"\
ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1"----8.启动监听文件$lsnrctlstartLSNRCTLforLinux:Version11.2.0.4.0-Productionon28-9月-201519:30:48Copyright(c)1991,Oracle.Allrightsreserved.

启动/u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr:请稍候...

TNSLSNRforLinux:Version11.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
版本TNSLSNRforLinux:Version11.2.0.4.0-Production
启动日期28-9月-201519:30:48正常运行时间0天0小时0分2秒
跟踪级别off
安全性ON:LocalOSAuthentication
SNMPOFF
监听程序参数文件/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)))
监听程序不支持服务
命令执行成功



$tnspingjinri

TNSPingUtilityforLinux:Version11.2.0.4.0-Productionon28-9月-201519:31:11Copyright(c)1997,Oracle.Allrightsreserved.

已使用的参数文件:
/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/assysdbasql*Plus:Release11.2.0.4.0Productionon星期一9月2820:17:452015Copyright(c)1982,Oracle.Allrightsreserved.

已连接到空闲例程。sql>startup
ORACLE例程已经启动。

TotalSystemGlobalArea3925032960bytes
FixedSize		2259240bytes
VariableSize		822085336bytesDatabaseBuffers	3087007744bytes
RedoBuffers		13680640bytes
数据库装载完毕。
数据库已经打开。sql>selectopen_modefromv$database;OPEN_MODE--------------------READWRITE
原文链接:https://www.f2er.com/oracle/210063.html

猜你在找的Oracle相关文章