您好,欢迎访问一九零五行业门户网

oracle的clone及冷迁移(直接拷贝数据文件)

最近做了个oracle 10g数据冷迁移,很简单,但还是写一下基本的操作过程: 首先是准备迁移目标服务器,初始化环境,安装数据软件。 基本的环境初始化、依赖包先安装好、相关目录、用户都需要安装好(目标机器环境要与原一样),安装数据库软件我是采用的clone
最近做了个oracle 10g数据冷迁移,很简单,但还是写一下基本的操作过程:
首先是准备迁移目标服务器,初始化环境,安装数据软件。
基本的环境初始化、依赖包先安装好、相关目录、用户都需要安装好(目标机器环境要与原一样),安装数据库软件我是采用的clone,将线上的product目录打包传到目标服务器。
内存检查
grep memtotal /proc/meminfomemtotal: 32949816 kb
磁盘空间检查
df -k /dev/shm/filesystem 1k-blocks used available use% mounted ontmpfs 16474908 0 16474908 0% /dev/shmdf -h /tmpfilesystem size used avail use% mounted on/dev/shm 16g 0 16g 0% /tmp
内核检查
uname -r2.6.18-194.el5
依赖包检查
rpm -q \binutils \compat-libstdc++-33 \elfutils-libelf \elfutils-libelf-devel \gcc \gcc-c++ \glibc \glibc-common \glibc-devel \glibc-headers \ksh \libaio \libaio-devel \libgcc \libgomp \libstdc++ \libstdc++-devel \make \numactl-devel \sysstat \unixodbc \unixodbc-devel | grep not installed
创建用户
groupadd oinstallgroupadd dbachattr -i /etc/passwd /etc/shadowuseradd -g oinstall -g dba oraclepasswd oraclechattr +i /etc/passwd /etc/shadow
目录创建、环境参数修改等
vi /etc/sysctl.conffs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 8388608kernel.shmmax = 34359738368kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048586sysctl -pvi /etc/security/limits.conforacle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240mkdir -p /u01/app/oracle/chown -r oracle:oinstall /u01/chmod -r 775 /u01/vi /etc/pam.d/loginsession required pam_limits.sovi /etc/profileif [ $user = oracle ]; then if [ $shell = /bin/ksh ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fifivi .bash_profileexport oracle_base=/u01/app/oracleexport oracle_home=$oracle_base/product/10.2.0/db_1 export oracle_sid=testexport path=$oracle_home/bin:$oracle_home/opatch:$oracle_home/jdk/bin:$path export lang=en_us.utf-8 export nls_lang=american_america.utf8 export nls_date_format=yyyy-mm-dd hh24:mi:ss
开始打包原服务器oracle软件
[@crm.cyou.com product]# pwd/u01/app/oracle/product[@crm.cyou.com product]# tar -zcf 10.2.0.tgz 10.2.0
拷贝到目标服务器,解压,开始clone
cd $oracle_home/clone/bin/perl clone.pl oracle_base=/u01/app/oracle oracle_home=/u01/app/oracle/product/10.2.0 oracle_home_name=db_1./runinstaller -clone -waitforcompletion oracle_base=/u01/app/oracle oracle_home=/u01/app/oracle/product/10.2.0/db_1 oracle_home_name=db_1 -silent -noconfig -nowaitstarting oracle universal installer...checking swap space: must be greater than 500 mb. actual 16386 mb passedpreparing to launch oracle universal installer from /tmp/orainstall2012-03-21_05-09-02pm. please wait ...oracle universal installer, version 10.2.0.0 productioncopyright (c) 1999, 2011, oracle. all rights reserved.you can find the log of this install session at:/u01/app/oracle/orainventory/logs/cloneactions.....2pm.log.................................................................................................... 100% done.installation in progress (wednesday, march 21, ... 5:09:10 pm cst)............................................................................... 79% done.install successfullinking in progress (wednesday, march 21,... 5:09:16 pm cst)link successfulsetup in progress (wednesday, march 21, ... 5:09:46 pm cst)setup successfulend of install phases.(wednesday, march 21, ....:08 pm cst)warning:a new inventory has been created in this session. however, it has not yet been registered as the central inventory of this system.to register the new inventory please run the script '/u01/app/oracle/orainventory/orainstroot.sh' with root privileges.if you do not register the inventory, you may not be able to update or patch the products you installed.the following configuration scripts need to be executed as the root user./u01/app/oracle/orainventory/orainstroot.sh/u01/app/oracle/product/10.2.0/db_1/root.shto execute the configuration scripts: 1. open a terminal window 2. log in as root 3. run the scriptsthe cloning of db_1 was successful.please check '/u01/app/oracle/orainventory/logs/cloneactions......pm.log' for more details.9.run sh scripts[root@bf_test_qd_119 ~]# /u01/app/oracle/orainventory/orainstroot.shchanging permissions of /u01/app/oracle/orainventory.adding read,write permissions for group.removing read,write,execute permissions for world.changing groupname of /u01/app/oracle/orainventory to oinstall.the execution of the script is complete.[root@bf_test_qd_119 ~]# /u01/app/oracle/product/10.2.0/db_1/root.shcheck /u01/app/oracle/product/10.2.0/db_1/install/......
这个clone很快,ok后,可以停原oracle实例及监听
select distinct username from v$session; 查看应用是否停完下面停掉所有监听lsnrctl stop listenerlsnrctl stop listener1532lsnrctl stop listener1528lsnrctl stop listener1525
停数据库
shutdown immediate //确定应用停完后,开始停数据库
开始拷贝数据文件
scp -r /u01/app/oracle/product/10.2.0/dbs/* 1.1.1.1:/u01/app/oracle/product/10.2.0/dbs/scp -r oradata/ 1.1.1.1:/u01/app/oracle/cd /u01/app/oracle/admin/ldjbmdb && mkdir -p adump bdump cdump dpdump pfile udump utl_filecd /u01/app/oracle && mkdir -p arch flash_recovery_area orainventory
需要拷贝的包括如下:
1、控制文件
2、数据文件
3、参数文件spfile ? (环境一致)
4、密码文件
5、redo
没有首先检查这些文件的路径,然后再进行拷贝,这里我的目录基本都没有变,控制文件、数据文件、redo都 在oradata里,密码文件、参数文件都在dbs目录里。所以我只要拷贝两个目录就行。
然后就创建相应的目录,启动数据库
startup mount;alter database archivelog;alter database open;archive log list;alter database force logging;select log_mode,force_logging from v$database;启监听lsnrctl start listenerlsnrctl start listener1532lsnrctl start listener1528lsnrctl start listener1525
把数据库开启了archivelog(选择冷迁移的原因就在这里)
后面还有些步骤就是:
a.检查计划任务
b.防火墙
c.数据库自启动
原文地址:oracle的clone及冷迁移(直接拷贝数据文件), 感谢原作者分享。
其它类似信息

推荐信息